Add dpdk development packaging

Change-Id: I6aa2a6709241d99ce734c29e47487eb456907351
Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
Damjan Marion
2017-01-09 20:24:50 +01:00
committed by Damjan Marion
parent 18b2816551
commit 2ce7f9834a
18 changed files with 234 additions and 105 deletions

View File

@ -30,6 +30,12 @@ OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"
OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
endif
ifeq ($(OS_ID),ubuntu)
PKG=deb
else ifeq ($(OS_ID),centos)
PKG=rpm
endif
DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache
DEB_DEPENDS += debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd
DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
@ -84,6 +90,7 @@ help:
@echo " run-vat - run vpp-api-test tool"
@echo " pkg-deb - build DEB packages"
@echo " pkg-rpm - build RPM packages"
@echo " dpdk-install-dev - install DPDK development packages"
@echo " ctags - (re)generate ctags database"
@echo " gtags - (re)generate gtags database"
@echo " cscope - (re)generate cscope database"
@ -295,6 +302,9 @@ pkg-deb:
pkg-rpm: dist
$(call make,$(PLATFORM),install-rpm)
dpdk-install-dev:
make -C dpdk install-$(PKG)
ctags: ctags.files
@ctags --totals --tag-relative -L $<
@rm $<
@ -340,26 +350,19 @@ define banner
@echo " "
endef
verify: install-dep $(BR)/.bootstrap.ok
verify: install-dep $(BR)/.bootstrap.ok dpdk-install-dev
$(call banner,"Building for PLATFORM=vpp using gcc")
@make -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
$(call banner,"Building for PLATFORM=vpp_lite using gcc")
@make -C build-root PLATFORM=vpp_lite TAG=vpp_lite wipe-all install-packages
ifeq ($(OS_ID),ubuntu)
ifeq ($(OS_VERSION_ID),16.04)
ifeq ($(OS_ID)-$(OS_VERSION_ID),ubuntu-16.04)
$(call banner,"Installing dependencies")
@sudo -E apt-get update
@sudo -E apt-get $(CONFIRM) $(FORCE) install clang
$(call banner,"Building for PLATFORM=vpp using clang")
@make -C build-root CC=clang PLATFORM=vpp TAG=vpp_clang wipe-all install-packages
endif
$(call banner,"Building deb packages")
@make pkg-deb
endif
ifeq ($(OS_ID),centos)
$(call banner,"Building rpm packages")
@make pkg-rpm
endif
@make test
$(call banner,"Building $(PKG) packages")
@make pkg-$(PKG)

View File

@ -42,8 +42,8 @@ ifneq ($(DPDK_MAKE_EXTRA_ARGS),)
DPDK_MAKE_ARGS += DPDK_MAKE_EXTRA_ARGS="$(DPDK_MAKE_EXTRA_ARGS)"
endif
dpdk_configure = echo
dpdk_configure = echo
dpdk_make_args = $(DPDK_MAKE_ARGS) config
dpdk_make_args = $(DPDK_MAKE_ARGS) ebuild-build
dpdk_install = make $(DPDK_MAKE_ARGS) build
dpdk_install = make $(DPDK_MAKE_ARGS) ebuild-install

View File

@ -19,8 +19,9 @@ vpp_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir)
vpp_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir)
else
vpp_configure_depend += dpdk-install
vpp_CPPFLAGS += $(call installed_includes_fn, dpdk)
vpp_CPPFLAGS += $(call installed_includes_fn, dpdk)/dpdk
vpp_LDFLAGS += $(call installed_libs_fn, dpdk)
vpp_CPPFLAGS += -I/usr/include/dpdk
endif
ifeq ($($(PLATFORM)_uses_dpdk_cryptodev),yes)
vpp_configure_args += --with-dpdk-crypto

View File

@ -63,10 +63,6 @@ install-deb: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
./scripts/find-vpp-api-python-contents $(INSTALL_PREFIX)$(ARCH) \
deb/debian/vpp-api-python.install ; \
\
: dpdk headers ; \
./scripts/find-dpdk-contents $(INSTALL_PREFIX)$(ARCH) \
deb/debian/vpp-dpdk-dev.install ; \
\
: bin package needs startup config ; \
echo ../../src/vpp/conf/startup.conf /etc/vpp \
>> deb/debian/vpp.install ; \

View File

@ -1167,5 +1167,4 @@ distclean:
rm -rf $(MU_BUILD_ROOT_DIR)/python
if [ -e /usr/bin/dh ];then (cd $(MU_BUILD_ROOT_DIR)/deb/;debian/rules clean); fi
rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.install
rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.dkms
rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/changelog

View File

@ -3,12 +3,9 @@ files
*debhelper*
*.substvars
*.install
vpp-dpdk-dkms*
vpp/
vpp-dev/
vpp-lib/
vpp-dpdk-dev/
vpp-dpdk-dkms/
vpp-dbg/
vppctl/
vpp-api-lua/

View File

@ -2,7 +2,7 @@ Source: vpp
Section: net
Priority: extra
Maintainer: Cisco OpenVPP Packaging Team <bogus.address@cisco.com>
Build-Depends: debhelper (>= 9), dkms, dh-systemd, dh-python, chrpath
Build-Depends: debhelper (>= 9), dh-systemd, dh-python, chrpath
Standards-Version: 3.9.4
Package: vpp
@ -26,14 +26,6 @@ Description: Vector Packet Processing--development support
This package contains development support files for the VPP libraries
.
Package: vpp-dpdk-dev
Architecture: any
Depends: ${misc:Depends}
Description: Vector Packet Processing--development support
This package contains dpdk header files which match the dpdk version
compiled into the vpp executable
.
Package: vpp-lib
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
@ -41,7 +33,6 @@ Description: Vector Packet Processing--runtime libraries
This package contains the VPP shared libraries, including:
.
vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
dpdk - DPDK library
svm - vm library
vlib - vector processing library
vlib-api - binary API library
@ -54,12 +45,6 @@ Description: Vector Packet Processing--runtime plugins
This package contains VPP plugins
.
Package: vpp-dpdk-dkms
Architecture: any
Depends: ${misc:Depends}
Description: DPDK 2.1 igb_uio_driver
This package contains Linux kernel modules distributed with DPDK.
Package: vpp-api-lua
Architecture: any
Depends: ${misc:Depends}, vpp (= ${source:Version})

View File

@ -18,7 +18,7 @@ include /usr/share/dpkg/default.mk
# main packaging script based on dh7 syntax
%:
dh $@ --with dkms --with systemd,python2
dh $@ --with systemd,python2
override_dh_install:
dh_install --exclude .git
@ -31,6 +31,3 @@ override_dh_shlibdeps:
override_dh_strip:
dh_strip --dbg-package=vpp-dbg
override_dh_dkms:
dh_dkms -pvpp-dpdk-dkms

View File

@ -43,7 +43,6 @@ Group: System Environment/Libraries
%description lib
This package contains the VPP shared libraries, including:
vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
dpdk - DPDK library
svm - vm library
vlib - vector processing library
vlib-api - binary API library

View File

@ -1,29 +0,0 @@
#!/bin/bash
# includes
rm -rf dpdk-includes
mkdir dpdk-includes
(cd $1/dpdk/include; tar cfh - . | (cd ../../../dpdk-includes; tar xf -))
# If CDPATH is set, the "Change Directory" builtin (cd) will output the
# destination directory when a relative path is passed as an argument.
# In this case, this has the negative side effect of polluting the "paths"
# variable with the destination directory, breaking the package generation.
#
# Patient: Doctor! Doctor! It hurts when I do this...
# Doctor: Don't do that!
#
unset CDPATH
paths=`cd dpdk-includes; find . -type f -print`
rm -f $2
for path in $paths
do
dir=`dirname $path`
if [ $dir = "." ] ; then
echo ../dpdk-includes/$path /usr/include/vpp-dpdk >> $2
else
echo ../dpdk-includes/$path /usr/include/vpp-dpdk/$dir >> $2
fi
done

View File

@ -27,6 +27,7 @@ DPDK_MLX5_PMD ?= n
B := $(DPDK_BUILD_DIR)
I := $(DPDK_INSTALL_DIR)
DPDK_VERSION ?= 16.11
PKG_SUFFIX ?= vpp1
DPDK_BASE_URL ?= http://fast.dpdk.org/rel
DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
@ -81,11 +82,11 @@ endif
DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
T=$(DPDK_TARGET) \
RTE_CONFIG_TEMPLATE=../custom-config \
RTE_OUTPUT=$(I) \
EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
CPU_LDFLAGS="$(DPDK_CPU_LDFLAGS)" \
DESTDIR=$(I) \
$(DPDK_MAKE_EXTRA_ARGS)
DPDK_SOURCE_FILES := $(shell [ -e $(DPDK_SOURCE) ] && find $(DPDK_SOURCE) -name "*.[chS]")
@ -140,7 +141,6 @@ $(B)/custom-config: $(B)/.patch.ok Makefile
@rm -f .config.ok
$(CURDIR)/$(DPDK_TARBALL):
@mkdir -p $(B)
@if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
@ -148,6 +148,7 @@ $(CURDIR)/$(DPDK_TARBALL):
@rm -f $(B)/.download.ok
$(B)/.download.ok: $(CURDIR)/$(DPDK_TARBALL)
@mkdir -p $(B)
@openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum
@([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \
( echo "Bad Checksum! Please remove $< and retry" && \
@ -168,7 +169,7 @@ extract: $(B)/.extract.ok
$(B)/.patch.ok: $(B)/.extract.ok
ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
@echo --- patching ---
for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
@for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
echo Applying patch: $$(basename $$f) ; \
patch -p1 -d $(DPDK_SOURCE) < $$f ; \
done
@ -188,13 +189,130 @@ config: $(B)/.config.ok
$(B)/.build.ok: $(DPDK_SOURCE_FILES)
@if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
@make $(DPDK_MAKE_ARGS) install
@dkms/create_deb_manifest.sh $(DPDK_VERSION) $(subst $(realpath ..)/,,$(B))
@touch $@
.PHONY: build
build: $(B)/.build.ok
.PHONY: install
install: $(B)/.build.ok
.PHONY: clean
clean:
@rm -rf $(B) $(I)
##############################################################################
# .deb packaging
##############################################################################
DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null)
.PHONY: build-deb install-deb check-deb
deb/debian/changelog: Makefile
@echo "vpp-dpdk ($(DPDK_VERSION)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
@echo "" >> $@
@echo " * DPDK Release $(DPDK_VERSION)" >> $@
@echo "" >> $@
@echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@
$(DEV_DEB): deb/debian/changelog
@cd deb && dpkg-buildpackage -b -uc -us
git clean -fdx deb
build-deb: $(DEV_DEB)
install-deb:
ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
@make $(DEV_DEB)
@sudo dpkg -i $(DEV_DEB)
else
@echo "=========================================================="
@echo " Up-to-date DPDK package already installed"
@echo "=========================================================="
endif
check-deb:
ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
@echo "=========================================================="
@echo " Outdated DPDK package detected:"
@echo " Installed: vpp-dpdk-dev $(INSTALLED_DEB_VER)"
@echo " Current: vpp-dpdk-dev $(DPDK_VERSION)-$(PKG_SUFFIX)"
@echo ""
@echo " Please upgrade by invoking 'make dpdk-install-dev'"
@echo " from the top level directory."
@echo "=========================================================="
endif
##############################################################################
# .rpm packaging
##############################################################################
RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-dpdk-devel | grep -v "not inst")
.PHONY: build-rpm install-rpm check-rpm
$(DEV_RPM): Makefile rpm/vpp-dpdk.spec
@rpmbuild -bb \
--define "_topdir $(CURDIR)/rpm" \
--define "_version $(DPDK_VERSION)" \
--define "_release $(PKG_SUFFIX)" \
$(CURDIR)/rpm/vpp-dpdk.spec
mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
git clean -fdx rpm
build-rpm: $(DEV_RPM)
install-rpm:
ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
@make $(DEV_RPM)
sudo rpm -Uih $(DEV_RPM)
else
@echo "=========================================================="
@echo " Up-to-date DPDK package already installed"
@echo "=========================================================="
endif
check-rpm:
ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
@echo "=========================================================="
@echo " Outdated DPDK package detected:"
@echo " Installed: vpp-dpdk-devel $(INSTALLED_RPM_VER)"
@echo " Current: vpp-dpdk-devel $(DPDK_VERSION)-$(PKG_SUFFIX)"
@echo ""
@echo " Please upgrade by invoking 'make dpdk-install-dev'"
@echo " from the top level directory."
@echo "=========================================================="
endif
##############################################################################
# ebuild support
##############################################################################
.PHONY: ebuild-build ebuild-install
ebuild-build:
ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
@echo "=========================================================="
@echo "Building DPDK from source. Consider installing development"
@echo "package by invoking 'make dpdk-install-dev' from the"
@echo "top level directory"
@echo "=========================================================="
make config
else
ifneq ($(INSTALLED_DEB_VER),)
make check-deb
endif
ifneq ($(INSTALLED_RPM_VER),)
make check-rpm
endif
endif
ebuild-install:
ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
make install
endif

1
dpdk/deb/debian/compat Executable file
View File

@ -0,0 +1 @@
9

18
dpdk/deb/debian/control Normal file
View File

@ -0,0 +1,18 @@
Source: vpp-dpdk
Section: net
Priority: extra
Maintainer: vpp-dev@lists.fd.io
Build-Depends: debhelper (>= 9), dkms
Standards-Version: 3.9.4
Package: vpp-dpdk-dev
Architecture: any
Depends: ${shlibs:Depends}
Description: DPDK Development Package for VPP
Conflicts: dpdk, dpdk-dev, libdpdk-dev
Package: vpp-dpdk-dkms
Architecture: any
Depends: ${misc:Depends}
Description: DPDK Development Package for VPP - Kernel Modules
Conflicts: dpdk-igb-uio-dkms

38
dpdk/deb/debian/rules Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/make -f
DH_VERBOSE = 1
PKG=vpp-dpdk
VERSION = $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: //p')
BASE_VER = $(word 1, $(subst -, ,$(VERSION)))
export DPDK_BUILD_DIR=$(CURDIR)/_build
export DPDK_INSTALL_DIR=$(CURDIR)/debian/tmp/usr
SRC=_build/dpdk-$(BASE_VER)
MAKE_ARGS=-C ..
include /usr/share/dpkg/default.mk
%:
dh $@ --with dkms
override_dh_clean:
make $(MAKE_ARGS) clean
override_dh_auto_configure:
make $(MAKE_ARGS) config
override_dh_install:
make $(MAKE_ARGS) install
dh_install -p$(PKG)-dkms \
$(SRC)/lib/librte_eal/common/include/rte_pci_dev_feature_defs.h \
$(SRC)/lib/librte_eal/common/include/rte_pci_dev_features.h \
$(SRC)/lib/librte_eal/linuxapp/igb_uio/igb_uio.c \
$(SRC)/lib/librte_eal/linuxapp/igb_uio/compat.h \
debian/dkms/Makefile \
/usr/src/$(PKG)-dkms-$(VERSION)
dh_install -p$(PKG)-dev --autodest /usr
override_dh_dkms:
dh_dkms -p$(PKG)-dkms -V $(VERSION)

View File

@ -0,0 +1,8 @@
PACKAGE_VERSION=#MODULE_VERSION#
PACKAGE_NAME="vpp-dpdk-dkms"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="igb_uio"
BUILT_MODULE_LOCATION[0]="./"
DEST_MODULE_LOCATION[0]="/kernel/net"
MAKE[1]="make"
AUTOINSTALL="yes"

View File

@ -1,28 +0,0 @@
#!/bin/sh
VER=$1
DPDK_ROOT=../../$2/dpdk-${VER}
DEBIAN_DIR=../build-root/deb/debian
SRC_DIR=/usr/src/vpp-dpdk-dkms-${VER}/
cat > ${DEBIAN_DIR}/vpp-dpdk-dkms.install << _EOF_
${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_feature_defs.h ${SRC_DIR}
${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_features.h ${SRC_DIR}
${DPDK_ROOT}/lib/librte_eal/linuxapp/igb_uio/igb_uio.c ${SRC_DIR}
${DPDK_ROOT}/lib/librte_eal/linuxapp/igb_uio/compat.h ${SRC_DIR}
../../dpdk/dkms/Makefile ${SRC_DIR}
_EOF_
# dkms config
cat > ${DEBIAN_DIR}/vpp-dpdk-dkms.dkms << _EOF_
PACKAGE_VERSION="${VER}"
PACKAGE_NAME="vpp-dpdk-dkms"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="igb_uio"
BUILT_MODULE_LOCATION[0]="./"
DEST_MODULE_LOCATION[0]="/kernel/net"
MAKE[1]="make"
AUTOINSTALL="yes"
_EOF_

26
dpdk/rpm/vpp-dpdk.spec Normal file
View File

@ -0,0 +1,26 @@
%define _make_args -C ../.. DPDK_BUILD_DIR=%{_topdir}/tmp DPDK_INSTALL_DIR=%{buildroot}/usr
Name: vpp-dpdk
Version: %{_version}
Release: %{_release}
Summary: DPDK development packages for VPP
License: BSD
%description
%package devel
Summary: DPDK development package for VPP
Group: Development/Libraries
%description devel
%install
make %{_make_args} config
make %{_make_args} install
%files devel
/usr/bin/*
/usr/include/dpdk
/usr/lib/*
/usr/sbin/*
/usr/share/dpdk