10 function install_kernel()
12 if [[ "$1" =~ ^4.* ]]; then
14 elif [[ "$1" =~ ^3.* ]]; then
17 PREFIX="v2.6/longterm/v2.6.32"
20 wget https://www.kernel.org/pub/linux/kernel/${PREFIX}/linux-${1}.tar.gz
21 tar xzvf linux-${1}.tar.gz > /dev/null
25 # Older kernels do not include openvswitch
26 if [ -d "net/openvswitch" ]; then
33 if [ ! "$DPDK" ]; then
34 EXTRA_OPTS="--with-linux=$(pwd)"
36 echo "Installed kernel source in $(pwd)"
40 function install_dpdk()
42 if [ -n "$DPDK_GIT" ]; then
43 git clone $DPDK_GIT dpdk-$1
47 wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-$1.tar.gz
48 tar xzvf dpdk-$1.tar.gz > /dev/null
51 find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/'
52 echo '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 if [ "$CC" = "clang" ]; then
75 # Disregard cast alignment errors until DPDK is fixed
76 CFLAGS="$CFLAGS -Wno-cast-align"
78 EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=./dpdk-$DPDK_VER/build"
79 elif [ "$CC" != "clang" ]; then
80 # DPDK headers currently trigger sparse errors
81 SPARSE_FLAGS="$SPARSE_FLAGS -Wsparse-error"
84 configure_ovs $EXTRA_OPTS $*
86 # Only build datapath if we are testing kernel w/o running testsuite
87 if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && [ ! "$DPDK" ]; then
91 if [ "$CC" = "clang" ]; then
92 make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
93 elif [[ $BUILD_ENV =~ "-m32" ]]; then
94 # Disable sparse for 32bit builds on 64bit machine
95 make CFLAGS="$CFLAGS $BUILD_ENV"
97 make CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
100 if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
101 if ! make distcheck RECHECK=yes; then
102 # testsuite.log is necessary for debugging.
103 cat */_build/tests/testsuite.log