1
votes

I try to add a kernel module to a yocto image and load it on boot.

I create a recipe to build and install a kernel module. Here's a part of the Makefile content:

modules_install: test_driver.ko
    install -d $(MODULES_DIR)
    install -m 0755 $< $(MODULES_DIR)

In my build/conf/local.conf, I add the package (subsystem being the name of my module recipe):

IMAGE_INSTALL_append = " subsystem"

After building the image, I can find the .ko file inside the MODULES_DIR directory (being /lib/modules/(shell uname -r)/kernel/drivers/test).

I want to do now is to load this module on boot. I found some clues about KERNEL_MODULE_AUTOLOAD and MACHINE_ESSENTIAL_*/MACHINE_EXTRA_*. So I try KERNEL_MODULE_AUTOLOAD += "subsystem" or even KERNEL_MODULE_AUTOLOAD += "test_driver" in build/conf/local.conf or in my module recipe, but I couldn't have the driver loaded on boot.

I'm working against the fsl-image-machine-test image (sumo version).

1
If I'm not mistaken you have to set those settings in the machine config file and not the local.conf. @see: yoctoproject.org/docs/latest/mega-manual/…vermaete
@vermaete indeed ! By using it in my module recipe, it work now (I had also mispelling the KERNEL_MODULE_AUTOLOAD in my file)bacara

1 Answers

0
votes

The KERNEL_MODULE_AUTOLOAD need to be outside of the local.conf file. I put it now in my module recipe.

It needs to load the name of the module not the recipe, in my case :

KERNEL_MODULE_AUTOLOAD += "test_driver".