Also take the oportunity to only add configuration files to FILES and CONFFILES when they exist and are used.
The modules-load.d [1] - Configure kernel modules to load at boot should install their configuration files in /usr/lib/modules-load.d. The modprobe.d [2] - Configuration directory for modprobe should install their configuration files in /lib/modprobe.d [1] https://www.freedesktop.org/software/systemd/man/modules-load.d.html [2] https://www.man7.org/linux/man-pages//man5/modprobe.d.5.html [YOCTO #12212] https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212 CC: Ola x Nilsson <[email protected]> CC: Peter Kjellerstedt <[email protected]> Signed-off-by: Jose Quaresma <[email protected]> --- v3: fix v2 build issue and only add configuration files to FILES and CONFFILES when they exist and are used. v2: use the same location as before on the class and define the new location just for systemd. .../kernel-module-split.bbclass | 36 ++++++++++--------- .../distro/include/init-manager-systemd.inc | 4 +++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass index 50882c31a7..e7ee6c55be 100644 --- a/meta/classes-recipe/kernel-module-split.bbclass +++ b/meta/classes-recipe/kernel-module-split.bbclass @@ -30,8 +30,11 @@ fi PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross" +modulesloaddir ??= "${sysconfdir}/modules-load.d" +modprobedir ??= "${sysconfdir}/modprobe.d" + do_install:append() { - install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/ + install -d ${D}${modulesloaddir} ${D}${modprobedir} } KERNEL_SPLIT_MODULES ?= "1" @@ -93,8 +96,9 @@ python split_kernel_module_packages () { dvar = d.getVar('PKGD') - # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append + # If autoloading is requested, output ${modulesloaddir}/<name>.conf and append # appropriate modprobe commands to the postinst + autoloadpath = '%s/%s.conf' % (d.getVar('modulesloaddir'), basename) autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split() autoload = d.getVar('module_autoload_%s' % basename) if autoload and autoload == basename: @@ -102,14 +106,16 @@ python split_kernel_module_packages () { 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') + f = open("%s%s" % (dvar, autoloadpath), 'w') if autoload: for m in autoload.split(): f.write('%s\n' % m) else: f.write('%s\n' % basename) f.close() + autoloadpath2append = ' %s' % autoloadpath + d.appendVar('FILES:%s' % pkg, autoloadpath2append) + d.appendVar('CONFFILES:%s' % pkg, autoloadpath2append) postinst = d.getVar('pkg_postinst:%s' % pkg) if not postinst: bb.fatal("pkg_postinst:%s not defined" % pkg) @@ -117,24 +123,19 @@ python split_kernel_module_packages () { d.setVar('pkg_postinst:%s' % pkg, postinst) # Write out any modconf fragment + modconfpath = '%s/%s.conf' % (d.getVar('modprobedir'), basename) modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split() modconf = d.getVar('module_conf_%s' % basename) if modconf and basename in modconflist: - name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) - f = open(name, 'w') + f = open("%s%s" % (dvar, modconfpath), 'w') f.write("%s\n" % modconf) f.close() + modconfpath2append = ' %s' % modconfpath + d.appendVar('FILES:%s' % pkg, modconfpath2append) + d.appendVar('CONFFILES:%s' % pkg, modconfpath2append) 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) - files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) - d.setVar('FILES:%s' % pkg, files) - - conffiles = d.getVar('CONFFILES:%s' % pkg) - conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename) - d.setVar('CONFFILES:%s' % pkg, conffiles) - if "description" in vals: old_desc = d.getVar('DESCRIPTION:' + pkg) or "" d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"]) @@ -167,10 +168,11 @@ python split_kernel_module_packages () { splitmods = d.getVar('KERNEL_SPLIT_MODULES') postinst = d.getVar('pkg_postinst:modules') postrm = d.getVar('pkg_postrm:modules') + modulesloaddir = d.getVar('modulesloaddir') + modprobedir = d.getVar('modprobedir') if splitmods != '1': - etcdir = d.getVar('sysconfdir') - d.appendVar('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ %s/modules/' % (etcdir, etcdir, d.getVar("nonarch_base_libdir"))) + d.appendVar('FILES:' + metapkg, '%s %s %s/modules' % (modulesloaddir, modprobedir, d.getVar("nonarch_base_libdir"))) d.appendVar('pkg_postinst:%s' % metapkg, postinst) d.prependVar('pkg_postrm:%s' % metapkg, postrm); return @@ -189,7 +191,7 @@ python split_kernel_module_packages () { # avoid warnings. removedirs only raises an OSError if an empty # directory cannot be removed. dvar = d.getVar('PKGD') - for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]: + for dir in ["%s%s" % (dvar, modprobedir), "%s%s" % (dvar, modulesloaddir)]: if len(os.listdir(dir)) == 0: os.rmdir(dir) } diff --git a/meta/conf/distro/include/init-manager-systemd.inc b/meta/conf/distro/include/init-manager-systemd.inc index 7867d90028..fc13089764 100644 --- a/meta/conf/distro/include/init-manager-systemd.inc +++ b/meta/conf/distro/include/init-manager-systemd.inc @@ -5,3 +5,7 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd" VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units" VIRTUAL-RUNTIME_login_manager ??= "shadow-base" VIRTUAL-RUNTIME_dev_manager ??= "systemd" + +# use autoload and probeconf distribution specific +modulesloaddir ?= "${libdir}/modules-load.d" +modprobedir ?= "${nonarch_base_libdir}/modprobe.d" -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#183158): https://lists.openembedded.org/g/openembedded-core/message/183158 Mute This Topic: https://lists.openembedded.org/mt/99665587/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
