10 function install_kernel()
12 if [[ "$1" =~ ^3.* ]]; then
15 PREFIX="v2.6/longterm/v2.6.32"
18 wget https://www.kernel.org/pub/linux/kernel/${PREFIX}/linux-${1}.tar.gz
19 tar xzvf linux-${1}.tar.gz > /dev/null
23 # Older kernels do not include openvswitch
24 if [ -d "net/openvswitch" ]; then
31 if [ ! "$DPDK" ]; then
32 EXTRA_OPTS="--with-linux=$(pwd)"
34 echo "Installed kernel source in $(pwd)"
38 function install_dpdk()
40 if [ -n "$DPDK_GIT" ]; then
41 git clone $DPDK_GIT dpdk-$1
45 wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-$1.tar.gz
46 tar xzvf dpdk-$1.tar.gz > /dev/null
49 find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/'
50 sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' config/common_linuxapp
51 sed -ri 's,(CONFIG_RTE_LIBRTE_VHOST=).*,\1y,' config/common_linuxapp
52 sed -ri '/CONFIG_RTE_LIBNAME/a CONFIG_RTE_BUILD_FPIC=y' config/common_linuxapp
53 sed -ri '/EXECENV_CFLAGS = -pthread -fPIC/{s/$/\nelse ifeq ($(CONFIG_RTE_BUILD_FPIC),y)/;s/$/\nEXECENV_CFLAGS = -pthread -fPIC/}' mk/exec-env/linuxapp/rte.vars.mk
54 make config CC=gcc T=x86_64-native-linuxapp-gcc
55 make CC=gcc RTE_KERNELDIR=$KERNELSRC
56 echo "Installed DPDK source in $(pwd)"
60 function configure_ovs()
62 ./boot.sh && ./configure $*
65 if [ "$KERNEL" ] || [ "$DPDK" ]; then
66 install_kernel $KERNEL
70 if [ -z "$DPDK_VER" ]; then
73 install_dpdk $DPDK_VER
74 # Disregard bad function casts until DPDK is fixed
75 CFLAGS="$CFLAGS -Wno-error=bad-function-cast -Wno-error=cast-align"
76 EXTRA_OPTS+="--with-dpdk=./dpdk-$DPDK_VER/build"
77 elif [ "$CC" != "clang" ]; then
78 # DPDK headers currently trigger sparse errors
79 SPARSE_FLAGS="$SPARSE_FLAGS -Wsparse-error"
82 configure_ovs $EXTRA_OPTS $*
84 # Only build datapath if we are testing kernel w/o running testsuite
85 if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && [ ! "$DPDK" ]; then
89 if [ "$CC" = "clang" ]; then
90 make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
91 elif [[ $BUILD_ENV =~ "-m32" ]]; then
92 # Disable sparse for 32bit builds on 64bit machine
93 make CFLAGS="$CFLAGS $BUILD_ENV"
95 make CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
98 if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
99 if ! make distcheck; then
100 # testsuite.log is necessary for debugging.
101 cat */_build/tests/testsuite.log