Bug 1002

Summary: automatically modprobe kernel module
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Gerard van den Bosch <gvandenbosch>
Component: meta-yoctoAssignee: Darren Hart <dvhart>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher, sgw
Version: unspecified   
Target Milestone: 1.1   
Hardware: Other   
OS: arm   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Gerard van den Bosch 2011-04-21 23:18:07 UTC
Hope-for result:
Automatically modprobe a kernel module at startup

Poky version: 4.0

Problem:

The "/etc/modules" file that is not created when generating the rootfs, this is done during first boot by the update-modules script located in recipes-kernel, as far as I can understand from that script it looks in /etc/modutils for configuration of kernel modules to load but that directory is missing too.

On the mailinglist got pointed to kernel.bbclass where modules get autoloaded.
Tried adding my module with the following line in the bbclass file:
module_autoload_libertas-sdio = "libertas-sdio" 

After that I rebuilded the kernel and generated the image but didn't get the modutils file and it didn't autoload either.
Also tried adding the line inside my kernel recipe after "inherit kernel" but I didn't get that to work either.

On the mailinglist it was requested to file a bug, the thread for reference can be found here:
https://lists.yoctoproject.org/pipermail/poky/2011-April/005324.html
Comment 1 Darren Hart 2011-05-04 17:05:53 UTC
Gerard, have you tried a clean build after modifying the kernel.bbclass? If not, it might be worth trying while I dig into the dependency chain to make sure the image is running the necessary bits to reflect the change you made. This has been a bit nebulous for me in the past, so I build from scratch more frequently than I should. Good opportunity to clarify it.
Comment 2 Gerard van den Bosch 2011-05-05 02:00:39 UTC
(In reply to comment #1)
> Gerard, have you tried a clean build after modifying the kernel.bbclass? If
> not, it might be worth trying while I dig into the dependency chain to make
> sure the image is running the necessary bits to reflect the change you made.
> This has been a bit nebulous for me in the past, so I build from scratch more
> frequently than I should. Good opportunity to clarify it.

Didn't try that yet, I will try it now and give an update as soon as possible.
Comment 3 Gerard van den Bosch 2011-05-06 01:14:02 UTC
Ok, I have tried a clean build but it didn't work, I have done the following steps:
- Removed the entire build directory
- Added the line module_autoload_libertas-sdio = "libertas-sdio" to kernel.bbclass between the other module_autload_xxx lines.
- source poky-init-build-env
- bitbake poky-image-myimage

When I boot-up the driver isn't modprobed automatically.

If you have some direction for debugging/searching I could try to get more information or if it currently isn't possible I could compile the module as part of the kernel to let it work (with that I mean * instead of M in the menuconfig) until it is possible.
Comment 4 Gerard van den Bosch 2011-05-06 02:17:09 UTC
I dug some more into it and have been able to resolve my problem by adding module_autoload_libertas_sdio = "libertas-sdio" to my machine configuration file.
I discovered in an other machine file they were doing it so I gave it a try.

Probably ignores the one in kernel.bbclass because I shouldn't put them there but in the machine configuration file.

It modprobes automatically now, thanks for helping me out :)
Comment 5 Darren Hart 2011-05-06 07:24:28 UTC
I noticed in one comment you used:

module_autoload_libertas-sdio = "libertas-sdio"

and in the other you used:

module_autoload_libertas_sdio = "libertas-sdio"

bitbake is rather particular about the use of underscores. Can you confirm that the latter one (with an underscore before sdio) doesn't work in kernel.bbclass?
Comment 6 Gerard van den Bosch 2011-05-08 23:07:50 UTC
(In reply to comment #5)
> I noticed in one comment you used:
> 
> module_autoload_libertas-sdio = "libertas-sdio"
> 
> and in the other you used:
> 
> module_autoload_libertas_sdio = "libertas-sdio"
> 
> bitbake is rather particular about the use of underscores. Can you confirm that
> the latter one (with an underscore before sdio) doesn't work in kernel.bbclass?

I can't confirm if the second one works in kernel.bbclass, I can confirm the first one doesn't.

I used underscores in the machine file because I looked at an example from the "htcuniversal.conf" file and there was the autoload line underscore so I did the same.