From: Michal Sieron <michalwsieron@gmail.com>
To: bruce.ashfield@gmail.com
Cc: michalwsieron@gmail.com, openembedded-core@lists.openembedded.org
Subject: [PATCH v2] kernel-module-split: Allow for external conf files
Date: Tue, 29 Apr 2025 15:20:36 +0200 [thread overview]
Message-ID: <20250429132035.213425-2-michalwsieron@gmail.com> (raw)
In-Reply-To: <aAKpeGEgdlK3jOdy@gmail.com>
Some recipes might provide conf files produced during build phase or
simply tracked in the VCS instead of generating them with Yocto.
In such cases those conf files wouldn't be assigned to correct packages.
With this change, if user wants to generate a conf file they still can,
but not generating them won't prevent assigning the file to proper
package given the file exists.
Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
---
I am quite busy lately so didn't have time to go back to this topic.
This v2 differs from v1 by added comments and post install hook is now
treated the same way as (CONF)FILES:* variable modification.
.../kernel-module-split.bbclass | 27 +++++++++++++------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass
index 9487365eb7..a2d81f18e2 100644
--- a/meta/classes-recipe/kernel-module-split.bbclass
+++ b/meta/classes-recipe/kernel-module-split.bbclass
@@ -99,9 +99,12 @@ python split_kernel_module_packages () {
bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename)
if autoload and basename not in autoloadlist:
bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename))
+
+ # The .conf file can either be installed by a recipe or generated from module_autoload_*
+ conf = '%s/%s.conf' % (d.getVar('modulesloaddir'), basename)
+ name = '%s%s' % (dvar, conf)
+ # If module name is in KERNEL_MODULE_AUTOLOAD, then generate the .conf file and write to `name`.
if basename in autoloadlist:
- conf = '%s/%s.conf' % (d.getVar('modulesloaddir'), basename)
- name = '%s%s' % (dvar, conf)
os.makedirs(os.path.dirname(name), exist_ok=True)
with open(name, 'w') as f:
if autoload:
@@ -109,6 +112,9 @@ python split_kernel_module_packages () {
f.write('%s\n' % m)
else:
f.write('%s\n' % basename)
+ # If the .conf file exits, then add it to FILES:* and CONFFILES:* and add postinstall hook.
+ # It doesn't matter if it was generated from module_autoload_* or installed by the recipe.
+ if os.path.exists(name):
conf2append = ' %s' % conf
d.appendVar('FILES:%s' % pkg, conf2append)
d.appendVar('CONFFILES:%s' % pkg, conf2append)
@@ -121,18 +127,23 @@ python split_kernel_module_packages () {
# Write out any modconf fragment
modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()
modconf = d.getVar('module_conf_%s' % basename)
+
+ # The .conf file can either be installed by a recipe or generated from module_conf_*
+ conf = '%s/%s.conf' % (d.getVar('modprobedir'), basename)
+ name = '%s%s' % (dvar, conf)
+ # If module name is in KERNEL_MODULE_PROBECONF, then generate the .conf file and write to `name`.
if modconf and basename in modconflist:
- conf = '%s/%s.conf' % (d.getVar('modprobedir'), basename)
- name = '%s%s' % (dvar, conf)
os.makedirs(os.path.dirname(name), exist_ok=True)
with open(name, 'w') as f:
f.write("%s\n" % modconf)
- conf2append = ' %s' % conf
- d.appendVar('FILES:%s' % pkg, conf2append)
- d.appendVar('CONFFILES:%s' % pkg, conf2append)
-
elif modconf:
bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
+ # If the .conf file exits, then add it to FILES:* and CONFFILES:*.
+ # It doesn't matter if it was generated from module_conf_* or installed by the recipe.
+ if os.path.exists(name):
+ conf2append = ' %s' % conf
+ d.appendVar('FILES:%s' % pkg, conf2append)
+ d.appendVar('CONFFILES:%s' % pkg, conf2append)
if "description" in vals:
old_desc = d.getVar('DESCRIPTION:' + pkg) or ""
--
2.49.0
next prev parent reply other threads:[~2025-04-29 13:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 9:04 [PATCH] kernel-module-split: Allow for external conf files Michal Sieron
2025-04-10 13:42 ` [OE-core] " Bruce Ashfield
2025-04-17 15:11 ` Michal Sieron
2025-04-18 19:35 ` Bruce Ashfield
2025-04-29 13:20 ` Michal Sieron [this message]
2025-05-15 17:53 ` [PATCH v2] " Bruce Ashfield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250429132035.213425-2-michalwsieron@gmail.com \
--to=michalwsieron@gmail.com \
--cc=bruce.ashfield@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox