@@ -42,6 +42,27 @@ KERNEL_MODULE_PACKAGE_PREFIX ?= ""
KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}"
KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1"
+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")
+
python split_kernel_module_packages () {
import re
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> --- .../kernel-module-split.bbclass | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)