summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Sieron <michalwsieron@gmail.com>2025-04-29 15:20:36 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-05-20 14:47:50 +0100
commite3402fe00ca5602dbcfd151ab3fd4bfb3371f76c (patch)
tree60e8398adc1552da686376f88f299bdeb559669c
parent396e45480e59f7e0c5582c95c8a0d3b8c48a9fcc (diff)
downloadpoky-e3402fe00ca5602dbcfd151ab3fd4bfb3371f76c.tar.gz
kernel-module-split: Allow for external conf filesHEADmaster
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. (From OE-Core rev: c7faf141592d1e2a5cab32a83f7e1498ee498d65) Signed-off-by: Michal Sieron <michalwsieron@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-recipe/kernel-module-split.bbclass25
1 files changed, 18 insertions, 7 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 () {
99 bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename) 99 bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename)
100 if autoload and basename not in autoloadlist: 100 if autoload and basename not in autoloadlist:
101 bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename)) 101 bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename))
102
103 # The .conf file can either be installed by a recipe or generated from module_autoload_*
104 conf = '%s/%s.conf' % (d.getVar('modulesloaddir'), basename)
105 name = '%s%s' % (dvar, conf)
106 # If module name is in KERNEL_MODULE_AUTOLOAD, then generate the .conf file and write to `name`.
102 if basename in autoloadlist: 107 if basename in autoloadlist:
103 conf = '%s/%s.conf' % (d.getVar('modulesloaddir'), basename)
104 name = '%s%s' % (dvar, conf)
105 os.makedirs(os.path.dirname(name), exist_ok=True) 108 os.makedirs(os.path.dirname(name), exist_ok=True)
106 with open(name, 'w') as f: 109 with open(name, 'w') as f:
107 if autoload: 110 if autoload:
@@ -109,6 +112,9 @@ python split_kernel_module_packages () {
109 f.write('%s\n' % m) 112 f.write('%s\n' % m)
110 else: 113 else:
111 f.write('%s\n' % basename) 114 f.write('%s\n' % basename)
115 # If the .conf file exits, then add it to FILES:* and CONFFILES:* and add postinstall hook.
116 # It doesn't matter if it was generated from module_autoload_* or installed by the recipe.
117 if os.path.exists(name):
112 conf2append = ' %s' % conf 118 conf2append = ' %s' % conf
113 d.appendVar('FILES:%s' % pkg, conf2append) 119 d.appendVar('FILES:%s' % pkg, conf2append)
114 d.appendVar('CONFFILES:%s' % pkg, conf2append) 120 d.appendVar('CONFFILES:%s' % pkg, conf2append)
@@ -121,19 +127,24 @@ python split_kernel_module_packages () {
121 # Write out any modconf fragment 127 # Write out any modconf fragment
122 modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split() 128 modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()
123 modconf = d.getVar('module_conf_%s' % basename) 129 modconf = d.getVar('module_conf_%s' % basename)
130
131 # The .conf file can either be installed by a recipe or generated from module_conf_*
132 conf = '%s/%s.conf' % (d.getVar('modprobedir'), basename)
133 name = '%s%s' % (dvar, conf)
134 # If module name is in KERNEL_MODULE_PROBECONF, then generate the .conf file and write to `name`.
124 if modconf and basename in modconflist: 135 if modconf and basename in modconflist:
125 conf = '%s/%s.conf' % (d.getVar('modprobedir'), basename)
126 name = '%s%s' % (dvar, conf)
127 os.makedirs(os.path.dirname(name), exist_ok=True) 136 os.makedirs(os.path.dirname(name), exist_ok=True)
128 with open(name, 'w') as f: 137 with open(name, 'w') as f:
129 f.write("%s\n" % modconf) 138 f.write("%s\n" % modconf)
139 elif modconf:
140 bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
141 # If the .conf file exits, then add it to FILES:* and CONFFILES:*.
142 # It doesn't matter if it was generated from module_conf_* or installed by the recipe.
143 if os.path.exists(name):
130 conf2append = ' %s' % conf 144 conf2append = ' %s' % conf
131 d.appendVar('FILES:%s' % pkg, conf2append) 145 d.appendVar('FILES:%s' % pkg, conf2append)
132 d.appendVar('CONFFILES:%s' % pkg, conf2append) 146 d.appendVar('CONFFILES:%s' % pkg, conf2append)
133 147
134 elif modconf:
135 bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
136
137 if "description" in vals: 148 if "description" in vals:
138 old_desc = d.getVar('DESCRIPTION:' + pkg) or "" 149 old_desc = d.getVar('DESCRIPTION:' + pkg) or ""
139 d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"]) 150 d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"])