SHA256
1
0
forked from pool/dpdk
dpdk/0001-build-try-to-get-kernel-version-from-kernel-source.patch

39 lines
1.5 KiB
Diff

From 4034cebe2d0c36d8762fb4c06ba216b17f308e22 Mon Sep 17 00:00:00 2001
From: Ferdinand Thiessen <rpm@fthiessen.de>
Date: Sat, 26 Feb 2022 22:14:14 +0100
Subject: [PATCH] build: try to get kernel version from kernel source
When building the kernel modules, try to get the kernel
version from the kernel sources first. This fixes the
kernel modules installation directory if the target kernel
version differs from the host kernel version, like for
CI build or when packaging for linux distributions.
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
---
kernel/linux/meson.build | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
--- dpdk-stable-21.11.1/kernel/linux/meson.build 2022-04-26 12:21:45.000000000 +0200
+++ mew/kernel/linux/meson.build 2022-04-27 18:17:06.676254482 +0200
@@ -11,7 +11,17 @@
if not meson.is_cross_build()
# native build
- kernel_version = run_command('uname', '-r', check: true).stdout().strip()
+ kernel_version = ''
+ if kernel_source_dir != ''
+ # Try kernel makefile first
+ r = run_command('make', '-s', '-C', kernel_source_dir, 'kernelrelease', check: false)
+ if r.returncode() == 0
+ kernel_version = r.stdout().strip()
+ endif
+ endif
+ if kernel_version == ''
+ kernel_version = run_command('uname', '-r').stdout().strip()
+ endif
kernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk'
if kernel_build_dir == ''
# use default path for native builds