On Tue, 2026-08-25 at 22:49 +0200, Anis Bougrine wrote: > 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]> > --- > .../kernel-module-split.bbclass | 21 +++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/meta/classes-recipe/kernel-module-split.bbclass > b/meta/classes-recipe/kernel-module-split.bbclass > index ab2f0d1c37..bde7cd02dd 100644 > --- a/meta/classes-recipe/kernel-module-split.bbclass > +++ b/meta/classes-recipe/kernel-module-split.bbclass > @@ -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 >
Sorry, a couple of more things. I'm not sure if it helps but there is a scripts/makefile-getvar which may be a simpler way to do this? It was created for this kind of usage. Also, we're aiming to move python functions into meta/lib/oe, probably kernel.py in this case so new functions should really go in there. Cheers, Richard
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#244368): https://lists.openembedded.org/g/openembedded-core/message/244368 Mute This Topic: https://lists.openembedded.org/mt/120927789/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
