diff options
Diffstat (limited to 'ci/kernel_build.sh')
-rwxr-xr-x | ci/kernel_build.sh | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/ci/kernel_build.sh b/ci/kernel_build.sh new file mode 100755 index 000000000..91e8b7765 --- /dev/null +++ b/ci/kernel_build.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +source ./ci/kernelConfigValidate.sh + +kernel_build_validate $@ +kernel_build_prep + +kernel_rpm_build() { + rpmbuild_dir=/tmp/kvmfornfv_rpmbuild.$$ + artifact_dir=${rpmbuild_dir}/RPMS/x86_64 + mkdir -p $artifact_dir + # Make timestamp part of version string for automated kernel boot verification + date "+-%y%m%d%H%M" > "${kernel_src_dir}/localversion-zzz" + + (cd ${kernel_src_dir}; make RPMOPTS="--define '_topdir ${rpmbuild_dir}'" rpm-pkg) + if [ ${?} -ne 0 ] ; then + echo "${0}: Kernel build failed" + rm -rf ${rpmbuild_dir} + exit 1 + fi + cp -f ${artifact_dir}/* ${output_dir} + rm -rf ${rpmbuild_dir} +} + +quirks(){ + # + # Apply out of tree patches + # + SRC=/root + for i in $SRC/kvmfornfv/patches/$1/*.patch + do + if [ -f "$i" ] + then + echo "Applying: $i" + patch -p1 <$i + fi + done +} + +kernel_deb_build(){ + VERSION="1.0.OPNFV" + # Configure the 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 + +# Build the kernel debs +make-kpkg clean +fakeroot make-kpkg --initrd --revision=$VERSION kernel_image kernel_headers +make +mv /root/kvmfornfv/linux-* /root/kvmfornfv/build_output +} + +if [ $pkg_type == "centos" ];then + kernel_rpm_build +elif [ $pkg_type == "ubuntu" ];then + quirks kernel + kernel_deb_build +fi + |