Skip to contentSkip to conversation

module.bbclass: enhance KBUILD_EXTRA_SYMBOLS retrieval

PATCH In review Daniel Chaves 3 participants 3 messages Jan 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module.bbclass: enhance KBUILD_EXTRA_SYMBOLS retrieval

Kernel packages may not always use the kernel-module- prefix. However, those listed in DEPENDS will consistently add Module.symvers to the STAGING_INCDIR.

---
 meta/classes-recipe/module.bbclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
meta/classes-recipe/module.bbclass +7 -7
index f2f0b25a2d..0f16522866 100644
@@ -11,13 +11,13 @@ EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
 MODULES_INSTALL_TARGET ?= "modules_install"
 MODULES_MODULE_SYMVERS_LOCATION ?= ""
 
-python __anonymous () {
-    depends = d.getVar('DEPENDS')
-    extra_symbols = []
-    for dep in depends.split():
-        if dep.startswith("kernel-module-"):
-            extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
-    d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
+python () {
+    import glob
+
+    extra_symbols = glob.glob(d.getVar('STAGING_INCDIR') + "/*/Module.symvers")
+
+    d.setVar('KBUILD_EXTRA_SYMBOLS', d.getVar('KBUILD_EXTRA_SYMBOLS') + " " + \
+        " ".join(extra_symbols))
 }
 
 python do_package:prepend () {
Signature · 1 line
2.40.1
#1 lore raw

Hello,

This should be sent to the oe-core mailing list, see README.OE-Core.md.

Quoted 15 lines · Daniel via lists.yoctoproject.org

Kernel packages may not always use the kernel-module- prefix. However, those listed in DEPENDS will consistently add Module.symvers to the STAGING_INCDIR.

---
 meta/classes-recipe/module.bbclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
meta/classes-recipe/module.bbclass +0 -0
index f2f0b25a2d..0f16522866 100644
@@ -11,13 +11,13 @@ EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
 MODULES_INSTALL_TARGET ?= "modules_install"

meta/classes-recipe/module.bbclass EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}" · line 14

Quoted 10 lines
meta/classes-recipe/module.bbclass +1 -7
 MODULES_MODULE_SYMVERS_LOCATION ?= ""
 
-python __anonymous () {
-    depends = d.getVar('DEPENDS')
-    extra_symbols = []
-    for dep in depends.split():
-        if dep.startswith("kernel-module-"):
-            extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
-    d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
+python () {

Why did you remove __anonymous?

Quoted 22 lines
meta/classes-recipe/module.bbclass +6 -0
+    import glob
+
+    extra_symbols = glob.glob(d.getVar('STAGING_INCDIR') + "/*/Module.symvers")
+
+    d.setVar('KBUILD_EXTRA_SYMBOLS', d.getVar('KBUILD_EXTRA_SYMBOLS') + " " + \
+        " ".join(extra_symbols))
 }
 
 python do_package:prepend () {
Signature · 11 lines
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64525): https://lists.yoctoproject.org/g/yocto/message/64525
Mute This Topic: https://lists.yoctoproject.org/mt/110529511/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
In reply to Daniel Chaves
Quoted 31 lines · Daniel via lists.yoctoproject.org

Kernel packages may not always use the kernel-module- prefix. However, those listed in DEPENDS will consistently add Module.symvers to the STAGING_INCDIR.

---
 meta/classes-recipe/module.bbclass | 14 +++++++-------

 1 file changed, 7 insertions(+), 7 deletions(-)
meta/classes-recipe/module.bbclass +0 -0
index f2f0b25a2d..0f16522866 100644
@@ -11,13 +11,13 @@ EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"

 MODULES_INSTALL_TARGET ?= "modules_install"
 MODULES_MODULE_SYMVERS_LOCATION ?= ""

meta/classes-recipe/module.bbclass +7 -7
-python __anonymous () {
-    depends = d.getVar('DEPENDS')
-    extra_symbols = []
-    for dep in depends.split():
-        if dep.startswith("kernel-module-"):
-            extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
-    d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
+python () {
+    import glob
+
+    extra_symbols = glob.glob(d.getVar('STAGING_INCDIR') + "/*/Module.symvers")
+
+    d.setVar('KBUILD_EXTRA_SYMBOLS', d.getVar('KBUILD_EXTRA_SYMBOLS') + " " + \
+        " ".join(extra_symbols))
Quoted 3 lines

 }

 python do_package:prepend () {

This is going to lead to non-determinism since STAGING_INCDIR may or may not exist (e.g. at parsing time before the build) and the value will therefore change.

If we really want/need to do that I'd at least expect an explanation of why the changes don't matter and how they don't affect task checksums.

As Alexandre mentions, this also needs to be submitted to the OE-Core list.

Cheers,

Richard