From patchwork Tue Mar 28 20:46:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 96177 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1897371qgd; Tue, 28 Mar 2017 14:01:44 -0700 (PDT) X-Received: by 10.28.155.65 with SMTP id d62mr16457430wme.7.1490734904648; Tue, 28 Mar 2017 14:01:44 -0700 (PDT) Return-Path: Received: from dpdk.org ([2001:4b98:dc0:41:216:3eff:fe72:dd13]) by mx.google.com with ESMTP id 134si4589579wmn.151.2017.03.28.14.01.44; Tue, 28 Mar 2017 14:01:44 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 as permitted sender) client-ip=2001:4b98:dc0:41:216:3eff:fe72:dd13; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D4B6669D4; Tue, 28 Mar 2017 23:01:43 +0200 (CEST) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) by dpdk.org (Postfix) with ESMTP id 7D89369C6 for ; Tue, 28 Mar 2017 23:01:42 +0200 (CEST) Received: by mail-lf0-f45.google.com with SMTP id j90so44454699lfk.2 for ; Tue, 28 Mar 2017 14:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/cTz0hUDPOYmxwG6HoM/4ldT85E1K7d6SbiR0MI2Oqo=; b=JWvDuPrybwYQefj82BG4Bf1TxkIU8tch+aXO2cLdFFEfRceojzOYC9lyoBSbDA2/0+ zsFTj+hM4J5hNsguCKKskWeOEDhUUYhRvvnwP5WCGHXJwQhUQ/Q5jwQtUl9GbXVjkXg3 GLojnQIKUHnawUjzErNVrcAzcSKK2Dz6eSaM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/cTz0hUDPOYmxwG6HoM/4ldT85E1K7d6SbiR0MI2Oqo=; b=WZYZJFtHADZW60y2gGOtN6rf47xr8FnMeDWI7j/XDiRaUg2rgyW1T1pBe5uZezK/xG tCkK6tGm61xhKgR3kDy6BevWrUv1QO8EmFRjlOJkG3nByxKSUmdM4iZZkhdNa1mlamCe EGTGy7XSBCmQJnHMHguxEreIs6LWwjYd3+GDZn0tcH95Xo2IplzgQ4HLhEOiw3e94U0B Cm3Dq5moBRCd6m2Y15SZLvdpvwhtVMtSySmH/q3YZnNfY9+Ng/w9DMpApUgigcTuHvYu AW31Q4Tvk7XRz4/PNBJHgJp/dWEf4Kmo7O7PxKxVeeSwJ8pJY/Bk3niC7hDp3NaTE3Je Spiw== X-Gm-Message-State: AFeK/H3pkbctzS1sUf5lCL6LspdXZ+hWHqJjH66S6I/+prfSJxl3KiI6EB7fJfPC2PRV93zt X-Received: by 10.46.7.18 with SMTP id 18mr2320420ljh.5.1490734902023; Tue, 28 Mar 2017 14:01:42 -0700 (PDT) Received: from localhost (c-793370d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.51.121]) by smtp.gmail.com with ESMTPSA id u128sm887399lff.4.2017.03.28.14.01.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 14:01:41 -0700 (PDT) From: Anders Roxell To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, ricardo.salveti@linaro.org, Anders Roxell Date: Tue, 28 Mar 2017 22:46:00 +0200 Message-Id: <1490733960-29458-1-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20170118214505.30663-1-anders.roxell@linaro.org> References: <20170118214505.30663-1-anders.roxell@linaro.org> Subject: [dpdk-dev] [PATCHv2] pkg/dpdk.spec: add dkms to build kernel module X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Build igb-uio and rte-kni kernel module using dkms. Signed-off-by: Anders Roxell --- pkg/dpdk.spec | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) -- 2.1.4 diff --git a/pkg/dpdk.spec b/pkg/dpdk.spec index 7bc5780..550fb76 100644 --- a/pkg/dpdk.spec +++ b/pkg/dpdk.spec @@ -40,6 +40,8 @@ Summary: Data Plane Development Kit core Group: System Environment/Libraries License: BSD and LGPLv2 and GPLv2 +%define with_dkms %{?_without_dkms: 0} %{?!_without_dkms: 1} + ExclusiveArch: i686 x86_64 aarch64 %ifarch aarch64 %global machine armv8a @@ -72,6 +74,28 @@ Requires: %{name}%{?_isa} = %{version}-%{release} DPDK devel is a set of makefiles, headers and examples for fast packet processing on x86 platforms. +%if %{with_dkms} +%package igb-uio +Summary: Data Plane Development Kit, igb_uio kernel module +Group: System/Kernel +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: gcc, make +Requires(post): dkms +Requires(preun): dkms +%description igb-uio +Data Plane Development Kit, igb_uio kernel module + +%package rte-kni +Summary: Data Plane Development Kit, rte_kni kernel module +Group: System/Kernel +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: gcc, make +Requires(post): dkms +Requires(preun): dkms +%description rte-kni +Data Plane Development Kit, rte_kni kernel module +%endif + %package doc Summary: Data Plane Development Kit API documentation BuildArch: noarch @@ -86,6 +110,10 @@ and guides in sphinx HTML/PDF formats. make O=%{target} T=%{config} config sed -ri 's,(RTE_MACHINE=).*,\1%{machine},' %{target}/.config sed -ri 's,(RTE_APP_TEST=).*,\1n,' %{target}/.config +%if %{with_dkms} +sed -ri 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' %{target}/.config +sed -ri 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' %{target}/.config +%endif sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' %{target}/.config sed -ri 's,(RTE_NEXT_ABI=).*,\1n,' %{target}/.config sed -ri 's,(LIBRTE_VHOST=).*,\1y,' %{target}/.config @@ -103,10 +131,50 @@ make install O=%{target} DESTDIR=%{buildroot} \ includedir=%{_includedir}/dpdk libdir=%{_libdir} \ datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk +%if %{with_dkms} +# Kernel module sources install for dkms +%{__mkdir_p} %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/ +%{__cp} -r lib/librte_eal/linuxapp/igb_uio/* %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/ + +%{__mkdir_p} %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/ +%{__cp} -r lib/librte_eal/linuxapp/kni/* %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/ + +cat > %{buildroot}%{_datadir}/dpdk/buildtools/dpdk-sdk-env.sh << EOF +export RTE_TARGET=%{target} +export RTE_SDK="/usr/share/dpdk/" +export RTE_INCLUDE="/usr/include/dpdk" +EOF + +# Prepare dkms.conf +cat > %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/dkms.conf << EOF + +PACKAGE_NAME="dpdk-igb-uio" +PACKAGE_VERSION="%{version}-%{release}" +MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h'" +CLEAN="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make clean" +BUILT_MODULE_NAME[0]=igb_uio +DEST_MODULE_LOCATION[0]=/updates/dkms +AUTOINSTALL=yes +EOF + +# Prepare dkms.conf +cat > %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/dkms.conf << EOF +PACKAGE_NAME="dpdk-rte-kni" +PACKAGE_VERSION="%{version}-%{release}" +MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h -I%{_usrsrc}/dpdk-rte-kni-%{version}/ethtool/ixgbe -I%{_usrsrc}/dpdk-rte-kni-%{version}/ethtool/igb'" +CLEAN="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make clean" +BUILT_MODULE_NAME[0]=rte_kni +DEST_MODULE_LOCATION[0]=/updates/dkms +AUTOINSTALL="YES" +EOF +%endif + %files %dir %{_datadir}/dpdk %{_datadir}/dpdk/usertools +%if ! %{with_dkms} /lib/modules/%(uname -r)/extra/* +%endif %{_sbindir}/* %{_bindir}/* %{_libdir}/* @@ -118,6 +186,16 @@ make install O=%{target} DESTDIR=%{buildroot} \ %{_datadir}/dpdk/%{target} %{_datadir}/dpdk/examples +%if %{with_dkms} +%files igb-uio +%defattr(-,root,root) +%{_usrsrc}/dpdk-igb-uio-%{version}/ + +%files rte-kni +%defattr(-,root,root) +%{_usrsrc}/dpdk-rte-kni-%{version}/ +%endif + %files doc %doc %{_docdir}/dpdk @@ -125,6 +203,32 @@ make install O=%{target} DESTDIR=%{buildroot} \ /sbin/ldconfig /sbin/depmod +%if %{with_dkms} +%post igb-uio +# Add to DKMS registry +isadded=`dkms status -m "dpdk-igb-uio" -v "%{version}"` +if [ "x${isadded}" = "x" ] ; then + dkms add -m "dpdk-igb-uio" -v "%{version}" || : +fi +dkms build -m "dpdk-igb-uio" -v "%{version}" || : +dkms install -m "dpdk-igb-uio" -v "%{version}" --force || : + +%post rte-kni +# Add to DKMS registry +isadded=`dkms status -m "dpdk-rte-kni" -v "%{version}"` +if [ "x${isadded}" = "x" ] ; then + dkms add -m "dpdk-rte-kni" -v "%{version}" || : +fi +dkms build -m "dpdk-rte-kni" -v "%{version}" || : +dkms install -m "dpdk-rte-kni" -v "%{version}" --force || : + +%preun igb-uio +dkms remove -m "dpdk-igb-uio" -v "%{version}" --all || : + +%preun rte-kni +dkms remove -m "dpdk-rte-kni" -v "%{version}" --all || : +%endif + %postun /sbin/ldconfig /sbin/depmod