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 sed -ri 's,(CONFIG_RTE_LIBRTE_VHOST=).*,\1y,' config/common_linuxapp
54 sed -ri 's,(CONFIG_RTE_LIBRTE_VHOST_USER=).*,\1n,' config/common_linuxapp
55 sed -ri '/CONFIG_RTE_LIBNAME/a CONFIG_RTE_BUILD_FPIC=y' config/common_linuxapp
56 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
57 make config CC=gcc T=x86_64-native-linuxapp-gcc
58 make CC=gcc RTE_KERNELDIR=$KERNELSRC
59 echo "Installed DPDK source in $(pwd)"
63 function configure_ovs()
65 ./boot.sh && ./configure $*
68 if [ "$KERNEL" ] || [ "$DPDK" ]; then
69 install_kernel $KERNEL
73 if [ -z "$DPDK_VER" ]; then
76 install_dpdk $DPDK_VER
77 if [ "$CC" = "clang" ]; then
78 # Disregard cast alignment errors until DPDK is fixed
79 CFLAGS="$CFLAGS -Wno-cast-align"
81 EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=./dpdk-$DPDK_VER/build"
82 elif [ "$CC" != "clang" ]; then
83 # DPDK headers currently trigger sparse errors
84 SPARSE_FLAGS="$SPARSE_FLAGS -Wsparse-error"
87 configure_ovs $EXTRA_OPTS $*
89 # Only build datapath if we are testing kernel w/o running testsuite
90 if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && [ ! "$DPDK" ]; then
94 if [ "$CC" = "clang" ]; then
95 make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
96 elif [[ $BUILD_ENV =~ "-m32" ]]; then
97 # Disable sparse for 32bit builds on 64bit machine
98 make CFLAGS="$CFLAGS $BUILD_ENV"
100 make CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
103 if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
104 if ! make distcheck; then
105 # testsuite.log is necessary for debugging.
106 cat */_build/tests/testsuite.log