43 lines
1.5 KiB
Diff
43 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
|
||
|
index d8fb20c1c3..78f28ffb0c 100644
|
||
|
--- a/kernel/linux/meson.build
|
||
|
+++ b/kernel/linux/meson.build
|
||
|
@@ -11,7 +11,17 @@
|
||
|
|
||
|
if not meson.is_cross_build()
|
||
|
# native build
|
||
|
- kernel_version = run_command('uname', '-r').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
|
||
|
--
|
||
|
2.35.1
|
||
|
|