f-stack/dpdk/kernel/linux/meson.build

35 lines
1.0 KiB
Meson
Raw Normal View History

2019-06-25 11:12:58 +00:00
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
2022-09-02 08:51:22 +00:00
subdirs = ['kni']
2019-06-25 11:12:58 +00:00
# if we are cross-compiling we need kernel_dir specified
if get_option('kernel_dir') == '' and meson.is_cross_build()
2021-02-05 08:48:47 +00:00
error('Need "kernel_dir" option for kmod compilation when cross-compiling')
2020-06-18 16:55:50 +00:00
endif
2019-06-25 11:12:58 +00:00
2020-06-18 16:55:50 +00:00
kernel_dir = get_option('kernel_dir')
if kernel_dir == ''
# use default path for native builds
2022-09-02 07:34:10 +00:00
kernel_version = run_command('uname', '-r', check: true).stdout().strip()
2020-06-18 16:55:50 +00:00
kernel_dir = '/lib/modules/' + kernel_version
2020-06-18 16:55:50 +00:00
endif
2019-06-25 11:12:58 +00:00
2022-09-02 04:40:05 +00:00
kernel_source_dir = get_option('kernel_dir')
if kernel_source_dir == ''
# use default path for native builds
kernel_source_dir = '/lib/modules/' + kernel_version + '/source'
2020-06-18 16:55:50 +00:00
endif
2019-06-25 11:12:58 +00:00
2020-06-18 16:55:50 +00:00
# test running make in kernel directory, using "make kernelversion"
2020-06-18 16:55:50 +00:00
make_returncode = run_command('make', '-sC', kernel_dir + '/build',
2022-09-02 04:40:05 +00:00
'kernelversion', check: true).returncode()
2020-06-18 16:55:50 +00:00
if make_returncode != 0
2021-02-05 08:48:47 +00:00
error('Cannot compile kernel modules as requested - are kernel headers installed?')
2020-06-18 16:55:50 +00:00
endif
2019-06-25 11:12:58 +00:00
# DO ACTUAL MODULE BUILDING
2020-06-18 16:55:50 +00:00
foreach d:subdirs
subdir(d)
endforeach