11%define _unpackaged_files_terminate_build 0
2+
3+ # Define variables for kernel version and source directory
4+ %global KVERSION %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION }-%{RPMTAG_RELEASE }' $(/bin/rpm -q --whatprovides kernel-headers))
5+ %global K_SRC %{_libdir }/modules/%{KVERSION }/build
6+ %global moddestdir /lib/modules/%{KVERSION }/kernel/drivers/net/kni
7+
28# Add option to build without examples
39%define target %{machine_arch }-%{machine_tmpl }-linuxapp-gcc
410# machine_arch maps between rpm and dpdk arch name, often same as _target_cpu
2733# Add option to build with examples, tools subpackages
2834%bcond_with examples
2935%bcond_without tools
36+
3037Summary: Set of libraries and drivers for fast packet processing
3138Name: dpdk
3239Version: 21.11.2
33- Release: 2 %{?dist }
40+ Release: 3 %{?dist }
3441License: BSD AND LGPLv2 AND GPLv2
3542Vendor: Microsoft Corporation
3643Distribution: Mariner
@@ -47,6 +54,7 @@ BuildRequires: meson
4754BuildRequires: python3-pyelftools
4855BuildRequires: python3-sphinx
4956BuildRequires: zlib-devel
57+ BuildRequires: kernel-devel
5058#
5159# The DPDK is designed to optimize througput of network traffic using, among
5260# other techniques, carefully crafted assembly instructions. As such it
@@ -114,6 +122,8 @@ CFLAGS="$(echo %{optflags} -fcommon)" \
114122 -Ddrivers_install_subdir=dpdk-pmds \
115123 -Denable_docs=true \
116124 -Dmachine=default \
125+ -Denable_kmods=true \
126+ -Dkernel_dir=%{K_SRC } \
117127%if %{with examples }
118128 -Dexamples=all \
119129%endif
@@ -128,6 +138,12 @@ CFLAGS="$(echo %{optflags} -fcommon)" \
128138%install
129139%meson_install
130140
141+ # Install the kernel modules to the specified directory
142+ mkdir -p %{buildroot }%{moddestdir }
143+ echo "find %{_builddir }/dpdk-stable-%{version } -name rte_kni.ko -exec install -D -m 755 '{}' %{buildroot }%{moddestdir } \;" > install_kni.sh
144+ chmod +x install_kni.sh
145+ ./install_kni.sh
146+
131147%files
132148# BSD
133149%doc README MAINTAINERS
@@ -140,6 +156,7 @@ CFLAGS="$(echo %{optflags} -fcommon)" \
140156%{_bindir }/dpdk-proc-info
141157%{_libdir }/* .so.*
142158%{pmddir }/* .so.*
159+ %{moddestdir }/rte_kni.ko
143160
144161%files devel
145162#BSD
@@ -179,6 +196,11 @@ CFLAGS="$(echo %{optflags} -fcommon)" \
179196%endif
180197
181198%changelog
199+ * Wed May 22 2024 Dinesh Kumar Ramasamy <dramasamy@microsoft.com> - 21.11.2-3
200+ - Enable KNI module in DPDK build
201+ - Update spec file to set kernel source directory using KVERSION and K_SRC variables.
202+ - Ensure correct installation directory for kernel modules using moddestdir variable.
203+
182204* Wed Sep 20 2023 Jon Slobodzian <joslobo@microsoft.com> - 21.11.2-2
183205- Recompile with stack-protection fixed gcc version (CVE-2023-4039)
184206
0 commit comments