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 sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' config/common_linuxapp
53 echo 'CONFIG_RTE_BUILD_FPIC=y' >>config/common_linuxapp
54 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
55 make config CC=gcc T=x86_64-native-linuxapp-gcc
56 make CC=gcc RTE_KERNELDIR=$KERNELSRC
57 echo "Installed DPDK source in $(pwd)"
61 function configure_ovs()
63 ./boot.sh && ./configure $*
66 if [ "$KERNEL" ] || [ "$DPDK" ]; then
67 install_kernel $KERNEL
71 if [ -z "$DPDK_VER" ]; then
74 install_dpdk $DPDK_VER
75 if [ "$CC" = "clang" ]; then
76 # Disregard cast alignment errors until DPDK is fixed
77 CFLAGS="$CFLAGS -Wno-cast-align"
79 EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=./dpdk-$DPDK_VER/build"
80 elif [ "$CC" != "clang" ]; then
81 # DPDK headers currently trigger sparse errors
82 SPARSE_FLAGS="$SPARSE_FLAGS -Wsparse-error"
85 configure_ovs $EXTRA_OPTS $*
87 # Only build datapath if we are testing kernel w/o running testsuite
88 if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && [ ! "$DPDK" ]; then
92 if [ "$CC" = "clang" ]; then
93 make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
94 elif [[ $BUILD_ENV =~ "-m32" ]]; then
95 # Disable sparse for 32bit builds on 64bit machine
96 make CFLAGS="$CFLAGS $BUILD_ENV"
98 make CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
101 if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
102 if ! make distcheck RECHECK=yes; then
103 # testsuite.log is necessary for debugging.
104 cat */_build/tests/testsuite.log