diff mbox series

kernel-module-split: Remove get_ext_mod

Message ID 20260905092125.2771306-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 02890c1eff104de94ad22023232fd36baaf228dc
Headers show
Series kernel-module-split: Remove get_ext_mod | expand

Commit Message

Richard Purdie Sept. 5, 2026, 9:21 a.m. UTC
This function is calling make on the kernel makefiles. Even through --dry-run is
specificed, in my local tests it executes things and this is bad in itself.

The function is called from a shell function meaning it is always expanded during
parsing, which means we're executing make during every datastore parse, which is
also very bad.

Simplfy the function down to ${S} for now. If there is need to change that we can
parameterise it but we need working/safe builds and this is the least worse alternative
besides reverting the changes.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../kernel-module-split.bbclass               |  2 +-
 meta/lib/oe/kernel_module.py                  | 21 -------------------
 2 files changed, 1 insertion(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass
index 413f39d641a..99c2d129629 100644
--- a/meta/classes-recipe/kernel-module-split.bbclass
+++ b/meta/classes-recipe/kernel-module-split.bbclass
@@ -62,7 +62,7 @@  post_strip_kernel_modules_signing(){
         oe_runmake \
             -C ${KBUILD_OUTPUT}  \
             MODLIB=${PKGD}${KERNEL_MODULE_INSTALL_PREFIX} \
-            ${@'M=%s' % oe.kernel_module.get_ext_mod(d) if not "virtual/kernel" in d.getVar('PROVIDES') else ''} \
+            ${@'M=%s' % '${S}' if not "virtual/kernel" in d.getVar('PROVIDES') else ''} \
             modules_sign
     fi
 }
diff --git a/meta/lib/oe/kernel_module.py b/meta/lib/oe/kernel_module.py
index edf723033f1..0d27fbaa57f 100644
--- a/meta/lib/oe/kernel_module.py
+++ b/meta/lib/oe/kernel_module.py
@@ -25,24 +25,3 @@  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")