40220b7b0559a274cebb982a18e6d5da9bf3abab
[kvmfornfv.git] / fuel-plugin / build_kvm.sh
1 #!/bin/bash
2
3 SRC=/root
4 CONFIG="arch/x86/configs/opnfv.config"
5 VERSION="1.0.OPNFV"
6
7 quirks() {
8 #
9 # Apply out of tree patches
10 #
11 for i in $SRC/kvmfornfv/patches/$1/*.patch
12 do
13     if [ -f "$i" ]
14     then
15         echo "Applying: $i"
16         patch -p1 <$i
17     fi
18 done
19 }
20
21 apt-get update
22 apt-get install -y git fakeroot build-essential ncurses-dev xz-utils kernel-package bc autoconf automake libtool python python-pip libssl-dev
23
24 #
25 # Build kernel in another directory, so some files (which are root writeable only) generated during kernel
26 #   building wouldn't remain in the source directory mapped into Docker container
27 #
28 cp -r /kvmfornfv $SRC/.
29
30 cd $SRC/kvmfornfv/
31 quirks kernel
32
33 cd kernel
34
35 # Workaround build bug on Ubuntu 14.04
36 cat <<EOF > arch/x86/boot/install.sh
37 #!/bin/sh
38 cp -a -- "\$2" "\$4/vmlinuz-\$1"
39 EOF
40
41 # Configure the kernel
42 cp $CONFIG .config
43
44 make oldconfig </dev/null
45
46 # Build the kernel debs
47 make-kpkg clean
48
49 fakeroot make-kpkg --initrd --revision=$VERSION kernel_image kernel_headers -j$(nproc)
50
51 cp $SRC/kvmfornfv/linux-headers*.deb /kvmfornfv/.
52 cp $SRC/kvmfornfv/linux-image*.deb /kvmfornfv/.