summaryrefslogtreecommitdiffstats
path: root/dpdk
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-01-09 20:24:50 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-20 15:02:12 +0000
commit2ce7f9834ab55728520bff0dd15f8d82c10b95a0 (patch)
tree7abcda85a70e95ff1ad2714d9ea62f7f8c549002 /dpdk
parent18b2816551a8340a05dc69665d03707fdfcece23 (diff)
Add dpdk development packaging
Change-Id: I6aa2a6709241d99ce734c29e47487eb456907351 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'dpdk')
-rw-r--r--dpdk/Makefile126
-rwxr-xr-xdpdk/deb/debian/compat1
-rw-r--r--dpdk/deb/debian/control18
-rw-r--r--dpdk/deb/debian/dkms/Makefile (renamed from dpdk/dkms/Makefile)0
-rwxr-xr-xdpdk/deb/debian/rules38
-rw-r--r--dpdk/deb/debian/vpp-dpdk-dkms.dkms8
-rwxr-xr-xdpdk/dkms/create_deb_manifest.sh28
-rw-r--r--dpdk/rpm/vpp-dpdk.spec26
8 files changed, 213 insertions, 32 deletions
diff --git a/dpdk/Makefile b/dpdk/Makefile
index 82804f20db9..f6f90e0d6ff 100644
--- a/dpdk/Makefile
+++ b/dpdk/Makefile
@@ -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
diff --git a/dpdk/deb/debian/compat b/dpdk/deb/debian/compat
new file mode 100755
index 00000000000..ec635144f60
--- /dev/null
+++ b/dpdk/deb/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/dpdk/deb/debian/control b/dpdk/deb/debian/control
new file mode 100644
index 00000000000..9ffa1a0a25d
--- /dev/null
+++ b/dpdk/deb/debian/control
@@ -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
diff --git a/dpdk/dkms/Makefile b/dpdk/deb/debian/dkms/Makefile
index 452c7c265e9..452c7c265e9 100644
--- a/dpdk/dkms/Makefile
+++ b/dpdk/deb/debian/dkms/Makefile
diff --git a/dpdk/deb/debian/rules b/dpdk/deb/debian/rules
new file mode 100755
index 00000000000..98b1048bade
--- /dev/null
+++ b/dpdk/deb/debian/rules
@@ -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)
diff --git a/dpdk/deb/debian/vpp-dpdk-dkms.dkms b/dpdk/deb/debian/vpp-dpdk-dkms.dkms
new file mode 100644
index 00000000000..a166c313861
--- /dev/null
+++ b/dpdk/deb/debian/vpp-dpdk-dkms.dkms
@@ -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"
diff --git a/dpdk/dkms/create_deb_manifest.sh b/dpdk/dkms/create_deb_manifest.sh
deleted file mode 100755
index f83055882b9..00000000000
--- a/dpdk/dkms/create_deb_manifest.sh
+++ /dev/null
@@ -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_
diff --git a/dpdk/rpm/vpp-dpdk.spec b/dpdk/rpm/vpp-dpdk.spec
new file mode 100644
index 00000000000..cc617681318
--- /dev/null
+++ b/dpdk/rpm/vpp-dpdk.spec
@@ -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