Re: systemd: how to enable auto-loading kernel modules

Mike Looijmans

Likely there's a problem with the underscore. Recipes (and packages) with an underscore don't work properly because it's used as a version separator.

Rename "my_module" to "my-module".

Having said that, kernel modules rarely need to be forced to load. The rare exceptions are modules that aren't linked to hardware (e.g. some software pipe, or typical test modules that do their thing during init) or modules that need special parameters to work (uio needs this for example).

Normally you'd have a match in the devicetree (or ACPI or PCI or USB or ...) and the match with your module will automatically trigger loading the module (and its dependencies). If your module is hardware related, this is how it should load. If that doesn't work, your hardware wasn't detected anyway and the module, after loading, likely won't do anything anyway.

On 26-10-2022 08:07, Merlin via wrote:

What should I do to enable auto-loading kernel modules in a systemd-employed system IN ADDITION TO setting KERNEL_MODULE_AUTOLOAD?
I'm trying to automatically load out-of-tree kernel modules in my distro (built using Dunfell) that uses systemd.
Kernel modules and the correponding config files are certainly installed to the rootfs (each under `/lib/modules/` and `/etc/modules-load.d/`); however, auto-loading does not occur at all.
My module recipe is as follows. I've added KERNEL_MODULE_AUTOLOAD to enable auto-loading.
SUMMARY = "Some description"

PV = "1.0+git${SRCPV}"
SRC_URI = "git://url/to/my.git;user=git;protocol=ssh;branch=main"
inherit module
S = "${WORKDIR}/git/src"
RPROVIDES_${PN} += " kernel-module-my_module"
I've learned that in systemd, systemd-modules-load service is responsible for module autoload, but I couldn't find either systemd-modules-load itself and systemd-modules-load.service in the rootfs.
It looks like that modules-load existed in past versions of, so I've tried to enable modules-load by adding `PACKAGECONFIG_pn-systemd += " modules-load"` in conf/local.conf. However, bitbake rejected it saying:
WARNING: systemd-1_244.5-r0 do_configure: QA Issue: systemd: invalid PACKAGECONFIG: modules-load [invalid-packageconfig]
Is there anything I can do further?

(Supposedly I'm having the same problem with this?
Thanks in advance.

Mike Looijmans

Met vriendelijke groet / kind regards,

Mike Looijmans

System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4    
5681 RJ Best T:    +31 (0) 499 33 69 69
The Netherlands E:    mike.looijmans@...
L: LinkedIn

Please consider the environment before printing this e-mail

Join to automatically receive all group messages.