kernel/linux: 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> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
f2aebfc4e9
commit
c0ae70df35
@ -12,15 +12,21 @@ cross_args = []
|
||||
if not meson.is_cross_build()
|
||||
# native build
|
||||
kernel_version = run_command('uname', '-r', check: true).stdout().strip()
|
||||
if kernel_source_dir != ''
|
||||
# Try kernel release from sources first
|
||||
r = run_command('make', '-s', '-C', kernel_source_dir, 'kernelrelease', check: false)
|
||||
if r.returncode() == 0
|
||||
kernel_version = r.stdout().strip()
|
||||
endif
|
||||
else
|
||||
# use default path for native builds
|
||||
kernel_source_dir = '/lib/modules/' + kernel_version + '/source'
|
||||
endif
|
||||
kernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk'
|
||||
if kernel_build_dir == ''
|
||||
# use default path for native builds
|
||||
kernel_build_dir = '/lib/modules/' + kernel_version + '/build'
|
||||
endif
|
||||
if kernel_source_dir == ''
|
||||
# use default path for native builds
|
||||
kernel_source_dir = '/lib/modules/' + kernel_version + '/source'
|
||||
endif
|
||||
|
||||
# test running make in kernel directory, using "make kernelversion"
|
||||
make_returncode = run_command('make', '-sC', kernel_build_dir,
|
||||
|
Loading…
Reference in New Issue
Block a user