Bug 14124

Summary: MODULE_CLASSES like KERNEL_CLASSES but for handling kernel modules
Product: [Build System, Metadata & Runtime] OE-Core Reporter: jonathan.yong
Component: kernelAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: Medium CC: anuj.mittal, richard.purdie, tim.orling, tom.zanussi
Version: unspecified   
Target Milestone: 3.4   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description jonathan.yong 2020-11-10 17:24:39 UTC
Currently, to append or module handling behavior, the bbclass files are added through INHERIT and then filtered through "if bb.data.inherits_class('module-base', d)", making it awkward to use.

If an "inherit ${MODULE_CLASSES}" were added to modules.bbclass, pre-hooks and post-hooks can easily be inserted into the modules build process.

Can also be used to solve https://bugzilla.yoctoproject.org/show_bug.cgi?id=12927
Comment 1 jonathan.yong 2020-11-10 17:36:31 UTC
Example use case: add xz-native/gz-native to in-tree or out-of-tree modules build time dependency to allow compressed module support.

The order of the class inheritance may need to be sorted to ensure deterministic behavior, eg sign module first, and then compress.
Comment 2 Richard Purdie 2020-11-12 16:12:37 UTC
My instinct is that this is not a good way to solve the problem and that we wouldn't want do this. I suspect there are other ways to solve the problem but its hard to tell what exactly you're struggling with from the details here. As such my initial answer is no, we don't want to do this but if you can provide more information we might be able to find a better solution.
Comment 3 jonathan.yong 2020-11-13 01:50:51 UTC
Currently, there is no way to bbappend the module class except using INHERIT += bbclass and then checking "if bb.data.inherits_class('module-base', d)" for all recipes. This potentially pollutes other non-module recipes.

My current use case is to support compressed kernel modules, the xz-native/gzip-native dependency needs to be injected to all out of tree modules as well. If MODULE_CLASSES was implemented, it would be a simple DEPENDS_append line.
Comment 4 Stephen K Jolley 2020-11-13 19:19:56 UTC
It appears your question is answered.
Comment 5 Richard Purdie 2021-08-04 12:14:11 UTC
You do have the option of forking the module class and creating your own with the new functionality, Where people are adding new features like this, we really want to encourage people to submit it make to the core which is why we don't support appending classes.

As such we'd encourage patches to be sent against the core classes and don't want to make this kind of feature development to easy to maintain out of tree. Resolving the bug accordingly.