Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I auto load kernel module on boot in Yocto? (like "insmod /xxx/oo.ko")

Our system is NXP fsl-image-auto and build with Yocto project. Now we have a 3rd party ko "apex.ko", rootfs Path is /s32v/apex.ko

This module need load on linux boot, so we add "insmod /s32v/apex.ko" line into rcS.d to do this job.

Can this function be done with Yocto?

I tried "KERNEL_MODULE_AUTOLOAD += apex" but it seems can't work. And I tried "module_do_install()", but bitbake has "make: *** No targets specified and no makefile found. Stop. ERROR: oe_runmake failed" error massage.

How can I do this? Thanks...

like image 526
Eric Fan Avatar asked Sep 06 '25 02:09

Eric Fan


1 Answers

The way we use to add a kernel module at startup is by adding KERNEL_MODULE_AUTOLOAD variable:

KERNEL_MODULE_AUTOLOAD += "mymodule"

But you need to add it in your machine.conf, or in a recipe (not an image), as described in the documentation:

You can use the KERNEL_MODULE_AUTOLOAD variable anywhere that it can be recognized by the kernel recipe or by an out-of-tree kernel module recipe (e.g. a machine configuration file, a distribution configuration file, an append file for the recipe, or the recipe itself).

[...]

Including KERNEL_MODULE_AUTOLOAD causes the OpenEmbedded build system to populate the /etc/modules-load.d/modname.conf file with the list of modules to be auto-loaded on boot. The modules appear one-per-line in the file.

like image 189
PierreOlivier Avatar answered Sep 07 '25 22:09

PierreOlivier