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 <[email protected]> Signed-off-by: Anis Bougrine <[email protected]> --- meta/lib/oe/__init__.py | 2 +- meta/lib/oe/kernel_module.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index d8db84dc9a..7357a71f27 100644 --- a/meta/lib/oe/__init__.py +++ b/meta/lib/oe/__init__.py @@ -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"] diff --git a/meta/lib/oe/kernel_module.py b/meta/lib/oe/kernel_module.py index 0d27fbaa57..edf723033f 100644 --- a/meta/lib/oe/kernel_module.py +++ b/meta/lib/oe/kernel_module.py @@ -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") -- 2.50.1 (Apple Git-155)
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#244436): https://lists.openembedded.org/g/openembedded-core/message/244436 Mute This Topic: https://lists.openembedded.org/mt/120949281/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
