aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/.gitignore4
-rw-r--r--debian/changelog5
-rw-r--r--debian/control.modules.in14
-rw-r--r--debian/copyright21
-rwxr-xr-xdebian/kernel-version61
-rwxr-xr-xdebian/prep-modules118
-rwxr-xr-xdebian/rules58
7 files changed, 277 insertions, 4 deletions
diff --git a/debian/.gitignore b/debian/.gitignore
index 47f48539..4c32c181 100644
--- a/debian/.gitignore
+++ b/debian/.gitignore
@@ -5,9 +5,12 @@
*.prerm.debhelper
*.dkms.debhelper
build/
+control.modules
+control.orig
dpdk-dev/
dpdk-doc/
dpdk-igb-uio-dkms/
+dpdk-modules-*/
dpdk-rte-kni-dkms/
dpdk/
files
@@ -56,3 +59,4 @@ librte-sched1/
librte-table2/
librte-timer1/
librte-vhost3/
+VERSION
diff --git a/debian/changelog b/debian/changelog
index 4a843be7..359d9d73 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,11 @@ dpdk (16.07-0) UNRELEASED; urgency=medium
- E: libethdev4: symbols-file-contains-current-version-with-debian-revision
on symbol DPDK_16.04@DPDK_16.04 and 114 others
* Add lintian-overrides for: "W: dpdk-doc: embedded-javascript-library"
+ * Add optional binary kernel modules package, disabled by default (build with
+ DEB_BUILD_OPTIONS=kernel_modules to enable). If enabled will build kernel
+ modules agains the local, current kernel version (override by adding
+ ksrc=<path/to/kernel/sources> to DEB_BUILD_OPTIONS) into a
+ dpdk-modules-<kernel version> package
-- Christian Ehrhardt <christian.ehrhardt@canonical.com> Fri, 29 Jul 2016 08:18:50 +0200
diff --git a/debian/control.modules.in b/debian/control.modules.in
new file mode 100644
index 00000000..93148b60
--- /dev/null
+++ b/debian/control.modules.in
@@ -0,0 +1,14 @@
+
+Package: dpdk-modules-#KVERS#
+Section: kernel
+Architecture: amd64 arm64 i386
+Provides: dpdk-modules
+Recommends: linux-image-#KVERS#
+Built-Using: ${built:using:kernel}
+Description: Data Plane Development Kit (rte kni, igb uio modules)
+ DPDK is a set of libraries for fast packet processing. Applications run
+ in user-space and communicate directly with dedicated network interfaces.
+ This package contains the source code for the igb_uio kernel module.
+ .
+ This package provides the kernel drivers for userspace networking.
+ Includes Intel DPDK kernel modules.
diff --git a/debian/copyright b/debian/copyright
index 400c915a..48ca4f82 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -57,6 +57,27 @@ License: BSD+GPLv2+LGPLv2
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+Files: debian/kernel-version
+ debian/prepare-modules
+Copyright: 2009-2016 Andreas Beckmann <anbe@debian.org>
+ 2010-2016 Russ Allbery <rra@debian.org>
+License: GPL-2.0+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General Public
+ License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
Files: debian/*
Copyright: 2015, 2016 Canonical Ltd.
License: GPL-3
diff --git a/debian/kernel-version b/debian/kernel-version
new file mode 100755
index 00000000..16ab01b4
--- /dev/null
+++ b/debian/kernel-version
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+#
+# Copyright (c) 2009-2016 Andreas Beckmann <anbe@debian.org>
+# 2010-2016 Russ Allbery <rra@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script. If not, see <http://www.gnu.org/licenses/>.
+#
+# This program comes from:
+# https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version?view=markup
+# The original copyright and license (GPL2+) can be found at:
+# https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/copyright?view=markup
+#
+# Extract the kernel version from the kernel version header file. Takes the
+# kernel source path as its only argument. If the version header couldn't be
+# found, print nothing and exit quietly.
+
+use warnings;
+
+my $ksrc = shift;
+unless ($ksrc && (-f "$ksrc/include/linux/version.h" || -f "$ksrc/include/generated/uapi/linux/version.h")) {
+ exit 0;
+}
+my $found = 0;
+my $line;
+if (open (VERSION, "$ksrc/include/linux/version.h")) {
+ if (defined(VERSION) && ($line = <VERSION>)) {
+ if ($line =~ /"(.+)"/) {
+ print "$1\n";
+ $found = 1;
+ }
+ }
+}
+exit 0 if $found;
+if (open (VERSION, "$ksrc/include/generated/utsrelease.h")) {
+ if (defined(VERSION) && ($line = <VERSION>)) {
+ if ($line =~ /UTS_RELEASE *"(.+)"/) {
+ print "$1\n";
+ $found = 1;
+ }
+ }
+}
+exit 0 if $found;
+# kernel.release is no longer useful since 3.1.0
+unless (open (VERSION, "$ksrc/include/config/kernel.release")) {
+ exit 0;
+}
+if (defined(VERSION) && ($line = <VERSION>)) {
+ print "$line";
+}
+exit 0;
diff --git a/debian/prep-modules b/debian/prep-modules
new file mode 100755
index 00000000..3e1f9f88
--- /dev/null
+++ b/debian/prep-modules
@@ -0,0 +1,118 @@
+#! /bin/sh
+#
+# Copyright (c) 2009-2016 Andreas Beckmann <anbe@debian.org>
+# 2010-2016 Russ Allbery <rra@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script. If not, see <http://www.gnu.org/licenses/>.
+#
+# This script originally comes from:
+# https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules?view=markup
+# The original copyright and license (GPL2+) can be found at:
+# https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/copyright?view=markup
+#
+# Prepares to build kernel modules. This script figures out and munges
+# version strings. The goal is:
+#
+# * Set the package name to dpdk-modules-$(KVERS) where $(KVERS) is the
+# major kernel revision plus the debian subrevision and whatever
+# architecture string is appropriate if building against the stock Debian
+# kernels. $(KVERS) should be identical to the version component contained
+# in the Debian kernel package names (in other words, the ABI version, not
+# the package version).
+#
+# * Make the package recommend linux-image-$(KVERS) as appropriate for the
+# kernel version that we're building against. Use recommend rather than
+# depends since the user may have built their own kernel outside of the
+# Debian package infrastructure.
+#
+# * Save the version number of the binary package in debian/VERSION for later
+# use by dh_gencontrol. This will be the version number of the source
+# package followed by a + and the version number of the kernel package that
+# we're building against. If the kernel package version contains an epoch,
+# try to hack our way into doing the right thing by using that epoch number
+# as our own. This isn't quite the right thing, but seems reasonably good.
+#
+# This script generates debian/control from debian/control.template using sed.
+# Unfortunately, substvars cannot be used since the name of the package is
+# modified and substvars happens too late. It also outputs debian/VERSION,
+# containing the version of the binary package.
+
+set -e
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: $0 <kernel-source-location>"
+ exit 1
+fi
+
+# We can get the kernel version from one of three places. If KVERS and KDREV
+# are both already set in the environment (which will be the case when invoked
+# by make-kpkg or module-assistant), use them. Otherwise, if we have a kernel
+# source directory that contains debian/changelog (generated by make-kpkg),
+# parse that file to find the version information. Finally, if neither works,
+# extract the kernel version from the kernel headers, append INT_SUBARCH to
+# that version if it's available, and assume a kernel package revision of -1
+# if none is provided.
+#
+# Set the variables $dpdk_kvers, which will hold the revision of the kernel,
+# and $dpdk_kdrev, which will hold the version of the kernel package that
+# we're building against.
+
+changelog="$1/debian/changelog"
+if [ -n "$KVERS" ] && [ -n "$KDREV" ]; then
+ dpdk_kvers="${KVERS}${INT_SUBARCH}"
+ dpdk_kdrev="${KDREV}"
+elif [ ! -f "$changelog" ] ; then
+ if [ -n "$KVERS" ] ; then
+ dpdk_kvers="$KVERS"
+ else
+ dpdk_kvers=`perl debian/kernel-version "$1"`
+ fi
+ if [ -z "$KDREV" ] ; then
+ dpdk_kdrev="${dpdk_kvers}-1"
+ else
+ dpdk_kvers="${dpdk_kvers}${INT_SUBARCH}"
+ dpdk_kdrev="${KDREV}"
+ fi
+else
+ if [ -n "$KVERS" ] ; then
+ dpdk_kvers="$KVERS"
+ else
+ dpdk_kvers=`head -1 "$changelog" \
+ | sed -e 's/.*source-\([^ ]*\) (\([^)]*\)).*/\1/'`
+ fi
+ dpdk_kdrev=`head -1 "$changelog" \
+ | sed -e 's/.*source-\([^ ]*\) (\([^)]*\)).*/\2/'`
+fi
+
+# Sanitize.
+dpdk_kvers="$(echo "$dpdk_kvers" | tr _ -)"
+dpdk_kdrev="$(echo "$dpdk_kdrev" | tr _ -)"
+
+# Generate the control file from the template.
+
+sed "s/#KVERS#/${dpdk_kvers}/g" debian/control.modules.in > debian/control.modules
+
+# Now, calcuate the binary package version. Extract the epoch from the kernel
+# package revision and add it to the beginning of the binary package version
+# if present. Then, concatenate the source version, '+', and the kernel
+# package revision without the epoch.
+
+dpdk_version=`head -1 debian/changelog | sed -e 's/.*(\([^)]*\)).*/\1/'`
+dpdk_epoch=`echo ${dpdk_kdrev} | sed -n -e 's/^\([0-9]*\):.*/\1/p'`
+dpdk_version="${dpdk_version}+`echo ${dpdk_kdrev} | sed 's/^[0-9]*://'`"
+if [ -n "$dpdk_epoch" ] ; then
+ dpdk_version="${dpdk_epoch}:${dpdk_version}"
+fi
+
+echo "$dpdk_version" > debian/VERSION
diff --git a/debian/rules b/debian/rules
index 77f90d8f..da7e3c86 100755
--- a/debian/rules
+++ b/debian/rules
@@ -39,11 +39,55 @@ endif
DPDK_STATIC_DIR = "debian/build/static-root"
DPDK_SHARED_DIR = "debian/build/shared-root"
+# kernel_modules can be passed via DEB_BUILD_OPTIONS to enable building the
+# optional binary kernel modules package. By default it will be built against
+# the current kernel, or ksrc can be passed with a path to the target kernel
+# sources instead.
+ifeq (,$(findstring kernel_modules,$(DEB_BUILD_OPTIONS)))
+DPDK_CONFIG_BUILD_KMOD=n
+KSRC=""
+else
+ifneq (,$(filter ksrc=%,$(DEB_BUILD_OPTIONS)))
+ KSRC := $(patsubst ksrc=%,%,$(filter ksrc=%,$(DEB_BUILD_OPTIONS)))
+else
+ KSRC := /lib/modules/$(shell uname -r)/build
+endif
+
+KVERS := $(shell perl debian/kernel-version $(KSRC))
+export KVERS
+
+DPDK_CONFIG_BUILD_KMOD=y
+
+# Since the binary module package is generated at build time depending on the
+# local kernel version, we have to append the new package in d/control.
+# We cannot use a separate control file since that wouldn't work with
+# dpkg-genchanges, and also would require a lot of overrides for debhelpers.
+get_built_using ?= $(filter-out (=),$(shell dpkg-query -f='$${source:Package} (=$${source:Version})' -W $1))
+
+override_dh_gencontrol:
+ dh_gencontrol
+ dh_gencontrol -p dpdk-modules-$(KVERS) -- \
+ -v`cat debian/VERSION` \
+ -V'built:using:kernel=$(call get_built_using,linux-headers-$(KVERS))'
+
+build:
+ @if [ x"$(KVERS)" = x ] ; then \
+ echo 'No version in $(KSRC)/include/linux/version.h' >&2; \
+ exit 1; \
+ fi
+ sh debian/prep-modules $(KSRC)
+ test -f debian/control.orig || cp -v debian/control debian/control.orig
+ cat debian/control.orig debian/control.modules > debian/control
+ dh $@ --with python2,dkms
+endif
+
%:
dh $@ --with python2,dkms
override_dh_auto_clean:
- rm -rf debian/build debian/tmp
+ rm -rf debian/build debian/tmp debian/dpdk-modules-* \
+ debian/control.modules debian/VERSION
+ mv debian/control.orig debian/control || true
override_dh_auto_configure:
# report dpkg-buildflags status to build log
@@ -53,8 +97,8 @@ override_dh_auto_configure:
$(MAKE) V=$(DH_VERBOSE) O=$(DPDK_STATIC_DIR) T=$(DPDK_CONFIG) config
sed -ri -e 's,(RTE_MACHINE=).*,\1$(RTE_MACHINE),' \
-e 's,(RTE_NEXT_ABI=).*,\1n,' \
- -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' \
- -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' \
+ -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1$(DPDK_CONFIG_BUILD_KMOD),' \
+ -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1$(DPDK_CONFIG_BUILD_KMOD),' \
-e 's,(LIBRTE_PMD_PCAP=).*,\1y,' \
-e 's,(LIBRTE_PMD_XENVIRT=).*,\1y,' \
$(DPDK_STATIC_DIR)/.config
@@ -83,7 +127,7 @@ override_dh_auto_build-arch:
cp -a $(DPDK_STATIC_DIR) $(DPDK_SHARED_DIR)
sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' \
$(DPDK_SHARED_DIR)/.config
- $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_SHARED_DIR) build
+ $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_SHARED_DIR) RTE_KERNELDIR=$(KSRC) build
override_dh_auto_install-arch: LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
override_dh_auto_install-arch:
@@ -146,6 +190,12 @@ override_dh_auto_install-arch:
mkdir -p debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
cp -a lib/librte_eal/linuxapp/kni/* \
debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
+ifneq (,$(KVERS))
+ # Package: dpdk-modules-<kernel version>
+ mkdir -p debian/dpdk-modules-$(KVERS)/lib/modules/$(KVERS)/kernel/drivers/net
+ cp -a debian/build/shared-root/kmod/* \
+ debian/dpdk-modules-$(KVERS)/lib/modules/$(KVERS)/kernel/drivers/net
+endif
override_dh_dkms:
dh_dkms -V $(VERSION)