@@ -12,4 +12,4 @@ __path__ = extend_path(__path__, __name__)
BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \
"packagegroup", "sstatesig", "lsb", "cachedpath", "license", "qemu", \
"reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common", \
- "cve_check", "tune", "classextend", "purl", "kernel", "sanity"]
+ "cve_check", "tune", "classextend", "purl", "kernel", "kernel_module", "sanity"]
@@ -25,3 +25,24 @@ def kernel_module_os_env(d, env_dict):
env_dict['KBUILD_EXTRA_SYMBOLS'] = kbuild_extra_symbols
else:
env_dict['KBUILD_EXTRA_SYMBOLS'] = ''
+
+def get_ext_mod(d):
+ """
+ Extract the resolved Kbuild M= variable from an out of tree module Makefile variable database.
+ """
+ import re
+ import bb.process
+
+ try:
+ output = bb.process.run(
+ "make -C %s --dry-run --print-data-base" % d.getVar("B")
+ )[0]
+ except bb.process.ExecutionError:
+ return d.getVar("S")
+
+ for line in output.splitlines():
+ m = re.match(r'^M\s*=\s*(.*)$', line)
+ if m:
+ return m.group(1).strip()
+
+ return d.getVar("S")
Fixes [YOCTO #12927] Out-of-tree module Makefiles invoke the kernel Makefile by appending the M= (the module directory) variable to the MAKEFLAGS. However, they usually do not provide a modules_sign target. Therefore, the kernel modules_sign target has to be invoked manually after retrieving M= variable from package source code Makefile. This function retrieves the M= variable from an external module Makefile. Reported-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Anis Bougrine <anis.bougrine10@gmail.com> --- meta/lib/oe/__init__.py | 2 +- meta/lib/oe/kernel_module.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)