summaryrefslogtreecommitdiffstats
path: root/fuel-plugin/build_kvm.sh
blob: 40220b7b0559a274cebb982a18e6d5da9bf3abab (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
50
51
52
#!/bin/bash

SRC=/root
CONFIG="arch/x86/configs/opnfv.config"
VERSION="1.0.OPNFV"

quirks() {
#
# Apply out of tree patches
#
for i in $SRC/kvmfornfv/patches/$1/*.patch
do
    if [ -f "$i" ]
    then
        echo "Applying: $i"
        patch -p1 <$i
    fi
done
}

apt-get update
apt-get install -y git fakeroot build-essential ncurses-dev xz-utils kernel-package bc autoconf automake libtool python python-pip libssl-dev

#
# Build kernel in another directory, so some files (which are root writeable only) generated during kernel
#   building wouldn't remain in the source directory mapped into Docker container
#
cp -r /kvmfornfv $SRC/.

cd $SRC/kvmfornfv/
quirks kernel

cd kernel

# Workaround build bug on Ubuntu 14.04
cat <<EOF > arch/x86/boot/install.sh
#!/bin/sh
cp -a -- "\$2" "\$4/vmlinuz-\$1"
EOF

# Configure the kernel
cp $CONFIG .config

make oldconfig </dev/null

# Build the kernel debs
make-kpkg clean

fakeroot make-kpkg --initrd --revision=$VERSION kernel_image kernel_headers -j$(nproc)

cp $SRC/kvmfornfv/linux-headers*.deb /kvmfornfv/.
cp $SRC/kvmfornfv/linux-image*.deb /kvmfornfv/.