From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 2D7B6FAFB for ; Wed, 18 Jan 2017 22:45:26 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id c206so47344391wme.0 for ; Wed, 18 Jan 2017 13:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=KX97Y+OWtxY7NLb+2iAG5maFVawxSJyR7jRwQFVSPPw=; b=Fd8b9d2R73D8AVh5lS0QJxDmBzGjvK+Nm6jUd3F0gqajf+nOvuyQMZwfEKuKeQUN/a lS1/45wyPNURu9s0Hy6xBe8tKLrdc7qJUIWn1BGNkXLzyf6EGJNpkcaPd3u+AudBlbqE K1tFxIZ7xanCmic5n0tKIw81lzh4QHx38YS08= 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; bh=KX97Y+OWtxY7NLb+2iAG5maFVawxSJyR7jRwQFVSPPw=; b=mLD3JKNiA3ZInqPy4VveNxj97jOQ8rvBmSpMSTwwgBnkx76GiSpAVnftnYt+OV+OV0 RtkZ+Ml0ULCIsmwSVvzWmjYB/igMtjYxy3Ij5abMYgPc8lRN35K9+COo5bduwUhvEALz tHAarpFYw/QDnJgFr0qMxWXS9i/xOEGDwUbVLvGfILrNv3i4ZhJjCBLGorCKoJ0qqa8b munbvSpeeW6LN6aFl+QMm8Wc4lvD7ilck1vjw4qAyIMVRD91JvABgiilQvfsD89U1C1S Dh46X/RFztXHQVYojfvZ+BSNAOWbaJ1clPMqav0gjPjPjEPuqhIlZHJVNSaPHXU7/QE9 sWIw== X-Gm-Message-State: AIkVDXJnk1YAI2JN9XuKtHz/mSrgEnHmqD3PQXZDMGj/DUjysv7UoXMiW9Y049RHaFQTppx1 X-Received: by 10.223.135.244 with SMTP id c49mr4437319wrc.135.1484775925695; Wed, 18 Jan 2017 13:45:25 -0800 (PST) Received: from localhost (c-472271d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.113.34.71]) by smtp.gmail.com with ESMTPSA id 186sm6277897wmw.24.2017.01.18.13.45.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jan 2017 13:45:25 -0800 (PST) From: Anders Roxell To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, ricardo.salveti@linaro.org, Anders Roxell Date: Wed, 18 Jan 2017 22:45:05 +0100 Message-Id: <20170118214505.30663-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] pkg: 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: , X-List-Received-Date: Wed, 18 Jan 2017 21:45:26 -0000 Build igb-uio and rte-kni kernel module using dkms. Signed-off-by: Anders Roxell --- pkg/dpdk.spec | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/pkg/dpdk.spec b/pkg/dpdk.spec index 43ff9548..189cb2f2 100644 --- a/pkg/dpdk.spec +++ b/pkg/dpdk.spec @@ -63,6 +63,26 @@ Requires: %{name}%{?_isa} = %{version}-%{release} DPDK devel is a set of makefiles, headers and examples for fast packet processing on x86 platforms. +%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 + %package doc Summary: Data Plane Development Kit API documentation BuildArch: noarch @@ -77,6 +97,8 @@ 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 +sed -ri 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' %{target}/.config +sed -ri 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' %{target}/.config 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 @@ -92,10 +114,45 @@ make install O=%{target} DESTDIR=%{buildroot} \ includedir=%{_includedir}/dpdk libdir=%{_libdir} \ datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk +# 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 + %files %dir %{_datadir}/dpdk %{_datadir}/dpdk/usertools -/lib/modules/%(uname -r)/extra/* %{_sbindir}/* %{_bindir}/* %{_libdir}/* @@ -107,6 +164,14 @@ make install O=%{target} DESTDIR=%{buildroot} \ %{_datadir}/dpdk/%{target} %{_datadir}/dpdk/examples +%files igb-uio +%defattr(-,root,root) +%{_usrsrc}/dpdk-igb-uio-%{version}/ + +%files rte-kni +%defattr(-,root,root) +%{_usrsrc}/dpdk-rte-kni-%{version}/ + %files doc %doc %{_docdir}/dpdk @@ -114,6 +179,30 @@ make install O=%{target} DESTDIR=%{buildroot} \ /sbin/ldconfig /sbin/depmod +%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 || : + %postun /sbin/ldconfig /sbin/depmod -- 2.11.0