summaryrefslogtreecommitdiff
path: root/meta/classes/kernel-module-split.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/kernel-module-split.bbclass')
-rw-r--r--meta/classes/kernel-module-split.bbclass36
1 files changed, 28 insertions, 8 deletions
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index d43f7431cb..ed42d2b19d 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -30,6 +30,8 @@ PACKAGESPLITFUNCS_prepend = "split_kernel_module_packages "
KERNEL_MODULES_META_PACKAGE ?= "kernel-modules"
+KERNEL_MODULE_PACKAGE_PREFIX ?= ""
+
python split_kernel_module_packages () {
import re
@@ -70,12 +72,12 @@ python split_kernel_module_packages () {
m = kerverrexp.match(kernelver)
if m:
kernelver_stripped = m.group(1)
- staging_kernel_dir = d.getVar("STAGING_KERNEL_DIR", True)
+ staging_kernel_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
system_map_file = "%s/boot/System.map-%s" % (dvar, kernelver)
if not os.path.exists(system_map_file):
system_map_file = "%s/System.map-%s" % (staging_kernel_dir, kernelver)
if not os.path.exists(system_map_file):
- bb.fatal("System.map-%s does not exist in '%s/boot' nor STAGING_KERNEL_DIR '%s'" % (kernelver, dvar, staging_kernel_dir))
+ bb.fatal("System.map-%s does not exist in '%s/boot' nor STAGING_KERNEL_BUILDDIR '%s'" % (kernelver, dvar, staging_kernel_dir))
cmd = "depmod -n -a -b %s -F %s %s" % (dvar, system_map_file, kernelver_stripped)
f = os.popen(cmd, 'r')
@@ -130,26 +132,37 @@ python split_kernel_module_packages () {
# If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
# appropriate modprobe commands to the postinst
+ autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD", True) or "").split()
autoload = d.getVar('module_autoload_%s' % basename, True)
- if autoload:
+ if autoload and autoload == basename:
+ 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))
+ if basename in autoloadlist:
name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
f = open(name, 'w')
- for m in autoload.split():
- f.write('%s\n' % m)
+ if autoload:
+ for m in autoload.split():
+ f.write('%s\n' % m)
+ else:
+ f.write('%s\n' % basename)
f.close()
postinst = d.getVar('pkg_postinst_%s' % pkg, True)
if not postinst:
bb.fatal("pkg_postinst_%s not defined" % pkg)
- postinst += d.getVar('autoload_postinst_fragment', True) % autoload
+ postinst += d.getVar('autoload_postinst_fragment', True) % (autoload or basename)
d.setVar('pkg_postinst_%s' % pkg, postinst)
# Write out any modconf fragment
+ modconflist = (d.getVar("KERNEL_MODULE_PROBECONF", True) or "").split()
modconf = d.getVar('module_conf_%s' % basename, True)
- if modconf:
+ if modconf and basename in modconflist:
name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
f = open(name, 'w')
f.write("%s\n" % modconf)
f.close()
+ elif modconf:
+ bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
files = d.getVar('FILES_%s' % pkg, True)
files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
@@ -165,9 +178,14 @@ python split_kernel_module_packages () {
rdepends[dep] = []
d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False))
+ # Avoid automatic -dev recommendations for modules ending with -dev.
+ d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
+
module_deps = parse_depmod()
module_regex = '^(.*)\.k?o$'
- module_pattern = 'kernel-module-%s'
+
+ module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX', True)
+ module_pattern = module_pattern_prefix + 'kernel-module-%s'
postinst = d.getVar('pkg_postinst_modules', True)
postrm = d.getVar('pkg_postrm_modules', True)
@@ -185,3 +203,5 @@ python split_kernel_module_packages () {
if len(os.listdir(dir)) == 0:
os.rmdir(dir)
}
+
+do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF", True) or "").split()))}'