3 KVM_COMMIT="0e68cb048bb8aadb14675f5d4286d8ab2fc35449"
4 OVS_COMMIT="4ff6642f3c1dd8949c2f42b3310ee2523ee970a6"
10 # Apply out of tree patches
12 for i in $SRC/kvmfornfv/patches/$1/*.patch
42 CONFIG=${2:-arch/x86/configs/opnfv.config}
43 VERSION=${3:-1.0.OPNFV}
45 # Check for necessary build tools
46 if ! type git >/dev/null 2>/dev/null
48 echo "Build tools missing, run the command
50 apt-get install git fakeroot build-essential ncurses-dev xz-utils kernel-package automake
52 as root and try again"
56 # Make sure the source dir exists
59 echo "$SRC: no such directory"
66 # Get the Open VSwitch sources
69 git clone https://github.com/openvswitch/ovs.git
72 # Get the KVM for NFV kernel sources
75 git clone https://gerrit.opnfv.org/gerrit/kvmfornfv
79 if [ x$KVM_COMMIT != x ]
81 git checkout $KVM_COMMIT
87 # Workaround build bug on Ubuntu 14.04
88 cat <<EOF > arch/x86/boot/install.sh
90 cp -a -- "\$2" "\$4/vmlinuz-\$1"
95 # Configure the kernel
98 make oldconfig </dev/null
100 # Build the kernel debs
105 fakeroot make-kpkg --initrd --revision=$VERSION kernel_image kernel_headers
106 git checkout arch/x86/boot/install.sh
107 git checkout fs/xfs/xfs_super.c
109 # Build OVS kernel modules
111 if [ x$OVS_COMMIT != x ]
113 git checkout $OVS_COMMIT
121 ./configure --with-linux=$SRC/kvmfornfv/kernel
124 # Add OVS kernel modules to kernel deb
125 dpkg-deb -x $SRC/kvmfornfv/linux-image*.deb ovs.$$
126 dpkg-deb --control $SRC/kvmfornfv/linux-image*.deb ovs.$$/DEBIAN
127 cp datapath/linux/*.ko ovs.$$/lib/modules/*/kernel/net/openvswitch
128 depmod -b ovs.$$ -a `ls ovs.$$/lib/modules`
129 dpkg-deb -b ovs.$$ $SRC/kvmfornfv/linux-image*.deb
133 mv $SRC/kvmfornfv/*.deb .