2012-12-07 10:33:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-12-18 15:44:21 +00:00
|
|
|
DIR=$(dirname `readlink -f $0`)
|
|
|
|
. $DIR/../testing.conf
|
|
|
|
. $DIR/function.sh
|
2012-12-07 10:33:27 +00:00
|
|
|
|
|
|
|
echo "Building guest kernel version $KERNELVERSION"
|
|
|
|
|
|
|
|
[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"
|
|
|
|
|
2012-12-09 08:49:04 +00:00
|
|
|
check_commands bunzip2 bzcat make wget
|
|
|
|
|
2012-12-07 10:33:27 +00:00
|
|
|
cd $BUILDDIR
|
|
|
|
|
|
|
|
if [ ! -f "$KERNELTARBALL" ]
|
|
|
|
then
|
2017-03-20 09:13:33 +00:00
|
|
|
url=https://cdn.kernel.org/pub/linux/kernel/v${KERNELVERSION:0:1}.x/$KERNELTARBALL
|
2012-12-07 10:33:27 +00:00
|
|
|
log_action "Downloading $url"
|
|
|
|
execute "wget -q $url"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $KERNELPATCH && ! -f "$KERNELPATCH" ]]
|
|
|
|
then
|
|
|
|
url=http://download.strongswan.org/uml/$KERNELPATCH
|
|
|
|
log_action "Downloading $url"
|
|
|
|
execute "wget -q $url"
|
|
|
|
fi
|
|
|
|
|
|
|
|
KERNELDIR=$BUILDDIR/$KERNEL
|
|
|
|
|
2015-05-29 20:28:05 +00:00
|
|
|
if [ ! -d "$KERNELDIR" ]
|
2012-12-07 10:33:27 +00:00
|
|
|
then
|
2015-05-29 20:28:05 +00:00
|
|
|
log_action "Unpacking kernel"
|
|
|
|
execute "tar xJf $KERNELTARBALL"
|
|
|
|
|
|
|
|
if [ $KERNELPATCH ]
|
|
|
|
then
|
|
|
|
log_action "Applying kernel patch"
|
2015-07-31 10:22:55 +00:00
|
|
|
bzcat $KERNELPATCH | patch -d $KERNELDIR -p1 >>$LOGFILE 2>&1
|
2015-05-29 20:28:05 +00:00
|
|
|
log_status $?
|
|
|
|
[ $? -eq 0 ] || exit 1
|
|
|
|
fi
|
2012-12-07 10:33:27 +00:00
|
|
|
fi
|
2015-07-31 10:22:55 +00:00
|
|
|
cd $KERNELDIR
|
2012-12-07 10:33:27 +00:00
|
|
|
|
2015-05-29 20:29:59 +00:00
|
|
|
if [ ! -f .config ]
|
|
|
|
then
|
|
|
|
execute "cp $KERNELCONFIG .config" 0
|
|
|
|
fi
|
2012-12-07 10:33:27 +00:00
|
|
|
|
|
|
|
echo "Creating kernel configuration, you might get prompted for new parameters"
|
|
|
|
make oldconfig 2>&1 | tee -a $LOGFILE
|
|
|
|
|
|
|
|
log_action "Compiling the kernel"
|
|
|
|
execute "make -j5"
|