aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts/build-guestkernel
blob: b408d73897d385c7b6b0ff0a96492a8e89dcea53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash

DIR=$(dirname `readlink -f $0`)
. $DIR/../testing.conf
. $DIR/function.sh

echo "Building guest kernel version $KERNELVERSION"

[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"

check_commands bunzip2 bzcat make wget

cd $BUILDDIR

if [ ! -f "$KERNELTARBALL" ]
then
	url=ftp://ftp.kernel.org/pub/linux/kernel/v4.x/$KERNELTARBALL
	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

log_action "Unpacking kernel"
execute "tar xJf $KERNELTARBALL"

KERNELDIR=$BUILDDIR/$KERNEL
cd $KERNELDIR

if [ $KERNELPATCH ]
then
	log_action "Applying kernel patch"
	bzcat ../$KERNELPATCH | patch -p1 >>$LOGFILE 2>&1
	log_status $?
	[ $? -eq 0 ] || exit 1
fi

execute "cp $KERNELCONFIG .config" 0

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"