build: add dpdk as a submodule

This will allow a git clone to default to an SPDK-specific
version of the DPDK repository.  Users can still override
to use a separate DPDK repository/installation with the
--with-dpdk configure script options.

While here, remove gzip option for the git-archive operations
in autopackage.sh.  We need to add a git-archive for the DPDK
submodule if we are using it, and compressing at -9 adds a lot
of unnecessary time.  Since we are not archiving these packages,
there is no need to compress them.  Also explicitly disable
coverage and ubsan for the autopackage build, since this build
is only to test compilation and is not actually used for any
test execution.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3cf8a2ed984003a175cdece6542636ede8cb2479
This commit is contained in:
Jim Harris 2017-05-08 15:07:13 -07:00
parent 8de75f8107
commit 737b1b571b
9 changed files with 138 additions and 32 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "dpdk"]
path = dpdk
url = https://github.com/spdk/dpdk.git

View File

@ -40,11 +40,17 @@ DIRS-y += lib test examples app
.PHONY: all clean $(DIRS-y) config.h CONFIG.local mk/cc.mk
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
DPDKBUILD = dpdkbuild
DIRS-y += dpdkbuild
endif
all: $(DIRS-y)
clean: $(DIRS-y)
$(Q)rm -f mk/cc.mk
$(Q)rm -f config.h
lib: $(DPDKBUILD)
app: lib
test: lib
examples: lib

View File

@ -53,20 +53,13 @@ FreeBSD:
sudo pkg install gmake cunit openssl
Additionally, [DPDK](http://dpdk.org/doc/quick-start) is required.
Additionally, [DPDK](http://dpdk.org/doc/quick-start) is required. The SPDK
repository includes a suitable version of DPDK as a submodule. Newer versions
of git will automatically fetch the DPDK submodule. Older versions of git may
require:
1) cd /path/to/spdk
2) wget http://fast.dpdk.org/rel/dpdk-17.02.tar.xz
3) tar xf dpdk-17.02.tar.xz
4) mv dpdk-17.02 dpdk
Linux:
4) (cd dpdk && make install T=x86_64-native-linuxapp-gcc DESTDIR=.)
FreeBSD:
4) (cd dpdk && gmake install T=x86_64-native-bsdapp-clang DESTDIR=.)
1) git submodule init
2) git submodule update
Building
========
@ -94,8 +87,6 @@ quickly. Currently this has only been tested on MacOS with the
[VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads) must
also be installed for NVMe support.
Download DPDK as a subdirectory in the SPDK repository as described above.
You do *not* need to build DPDK - the Vagrant scripts will do this for you.
If you are behind a corporate firewall, set http_proxy and https_proxy in
your environment before running the following steps.
@ -135,6 +126,20 @@ line:
make CONFIG_RDMA=y
Users may wish to use a version of DPDK different from the submodule included
in the SPDK repository. To specify an alternate DPDK installation, run
configure with the --with-dpdk option. For example:
Linux:
./configure --with-dpdk=/path/to/dpdk/x86_64-native-linuxapp-gcc
make
FreeBSD:
./configure --with-dpdk=/path/to/dpdk/x86_64-native-bsdapp-clang
gmake
The options specified on the `make` command line take precedence over the
default values in `CONFIG` and `CONFIG.local`. This can be useful if you, for
example, generate a `CONFIG.local` using the `configure` script and then have

View File

@ -20,20 +20,31 @@ if [ `git status --porcelain | wc -l` -ne 0 ]; then
exit 1
fi
pv=spdk-$(date +%Y_%m_%d)
spdk_pv=spdk-$(date +%Y_%m_%d)
spdk_tarball=${spdk_pv}.tar
dpdk_pv=dpdk-$(date +%Y_%m_%d)
dpdk_tarball=${dpdk_pv}.tar
find . -iname "spdk-*.tar.gz" -delete
git archive HEAD -9 --prefix=${pv}/ -o ${pv}.tar.gz
tarball=$(ls -1 spdk-*.tar.gz)
find . -iname "spdk-*.tar* dpdk-*.tar*" -delete
git archive HEAD --prefix=${spdk_pv}/ -o ${spdk_tarball}
# Build from packaged source
tmpdir=$(mktemp -d)
echo "tmpdir=$tmpdir"
tar -C "$tmpdir" -xf $tarball
tar -C "$tmpdir" -xf $spdk_tarball
if [ -z "$WITH_DPDK_DIR" ]; then
cd dpdk
git archive HEAD --prefix=dpdk/ -o ../${dpdk_tarball}
cd ..
tar -C "$tmpdir/${spdk_pv}" -xf $dpdk_tarball
fi
(
cd "$tmpdir"/spdk-*
./configure $config_params --disable-debug --enable-werror
# use $config_params to get the right dependency options, but disable coverage and ubsan
# explicitly since they are not needed for this build
./configure $config_params --disable-debug --enable-werror --disable-coverage --disable-ubsan
time $MAKE ${MAKEFLAGS}
)
rm -rf "$tmpdir"

5
configure vendored
View File

@ -27,7 +27,7 @@ function usage()
echo " disable features and components."
echo ""
echo "Valid dependencies are listed below."
echo " dpdk Required unless providing an alternate env implementation."
echo " dpdk Optional. Uses dpdk submodule in spdk tree if not specified."
echo " example: /usr/share/dpdk/x86_64-default-linuxapp-gcc"
echo " fio Required to build fio_plugin."
echo " example: /usr/src/fio"
@ -121,8 +121,7 @@ done
if [ -z "$CONFIG_ENV" ]; then
if [ -z "$CONFIG_DPDK_DIR" ]; then
echo "You must specify the path to dpdk using --with-dpdk=path."
exit 1
CONFIG_DPDK_DIR=$(readlink -f $(dirname $0))/dpdk/build
fi
fi

1
dpdk Submodule

@ -0,0 +1 @@
Subproject commit 4811908e7fc15433f40b7555b0e7ac97caa7e0cd

72
dpdkbuild/Makefile Normal file
View File

@ -0,0 +1,72 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
.PHONY: all clean
DPDK_CONFIG := spdk
ifeq ($(OS),Linux)
DPDK_CONFIG := $(DPDK_CONFIG)-linuxapp
else
ifeq ($(OS),FreeBSD)
DPDK_CONFIG := $(DPDK_CONFIG)-bsdapp
endif
endif
ifeq ($(CC_TYPE),clang)
DPDK_CONFIG := $(DPDK_CONFIG)-clang
else
DPDK_CONFIG := $(DPDK_CONFIG)-gcc
endif
NPROC = $(shell nproc)
ifeq ($(CONFIG_FIO_PLUGIN),y)
DPDK_CFLAGS = -fPIC
endif
ifeq ($(CONFIG_DEBUG),y)
DPDK_CFLAGS += -O0
endif
$(SPDK_ROOT_DIR)/dpdk/build:
$(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/dpdk config T=$(DPDK_CONFIG)
all: $(SPDK_ROOT_DIR)/dpdk/build
$(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/dpdk/build EXTRA_CFLAGS="$(DPDK_CFLAGS)" MAKEFLAGS="T=$(DPDK_CONFIG) -j$(NPROC)"
clean:
$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build

View File

@ -29,12 +29,18 @@ export NRHUGE=4096
case `uname` in
FreeBSD)
config_params+=' --with-dpdk=/usr/local/share/dpdk/x86_64-native-bsdapp-clang'
DPDK_FREEBSD_DIR=/usr/local/share/dpdk/x86_64-native-bsdapp-clang
if [ -d $DPDK_FREEBSD_DIR ]; then
WITH_DPDK_DIR=$DPDK_FREEBSD_DIR
fi
MAKE=gmake
MAKEFLAGS=${MAKEFLAGS:--j$(sysctl -a | egrep -i 'hw.ncpu' | awk '{print $2}')}
;;
Linux)
config_params+=' --with-dpdk=/usr/local/share/dpdk/x86_64-native-linuxapp-gcc'
DPDK_LINUX_DIR=/usr/local/share/dpdk/x86_64-native-linuxapp-gcc
if [ -d $DPDK_LINUX_DIR ]; then
WITH_DPDK_DIR=$DPDK_LINUX_DIR
fi
MAKE=make
MAKEFLAGS=${MAKEFLAGS:--j$(nproc)}
config_params+=' --enable-coverage'
@ -46,6 +52,13 @@ case `uname` in
;;
esac
# By default, --with-dpdk is not set meaning the SPDK build will use the DPDK submodule.
# If a DPDK installation is found in a well-known location though, WITH_DPDK_DIR will be
# set which will override the default and use that DPDK installation instead.
if [ ! -z "$WITH_DPDK_DIR" ]; then
config_params+=" --with-dpdk=$WITH_DPDK_DIR"
fi
if [ -f /usr/include/infiniband/verbs.h ]; then
config_params+=' --with-rdma'
fi

View File

@ -1,7 +1,6 @@
#!/bin/bash
SPDK_DIR=/spdk
DPDK_DIR=$SPDK_DIR/dpdk
SUDOCMD="sudo -H -u vagrant"
echo 0:$0
@ -41,11 +40,8 @@ elif [ -f /etc/redhat-release ]; then
yum install -y gcc gcc-c++ CUnit-devel libaio-devel openssl-devel
fi
cd $DPDK_DIR
$SUDOCMD make -j2 install T=x86_64-native-linuxapp-gcc DESTDIR=.
cd $SPDK_DIR
$SUDOCMD ./configure --with-dpdk=$DPDK_DIR/x86_64-native-linuxapp-gcc --enable-debug
$SUDOCMD ./configure --enable-debug
$SUDOCMD make -j2
# Bind virtual NVMe controller to uio_pci_generic
sudo scripts/setup.sh