[yocto] R: Autoload kernel module works only once

Andrea Laini andrea.laini at claypaky.it
Tue Mar 14 00:35:46 PDT 2017


Thanks Khem for your anwer,

The device in question are 2 simple character devices, that just read/write IO registers of the SoC. I don't think they depend on something else, but surely what I've noticed is that first time I power-on the system they're loaded later than successive bootings.

What I've also seen is that very first time the system started, the device number of my module in /dev/mydevice and /sys/class/myclass/mydevice/dev are exactly the same 

	/dev/mydevice					Major = 247, Minor = 0
	/sys/class/myclass/mydevice/dev		Major = 247, Minor = 0

while from the time I reboot the system the one in /sys/class/myclass/mydevice/dev is increment by 1 respect to the other 

	/dev/mydevice					Major = 247, Minor = 0
	/sys/class/myclass/mydevice/dev		Major = 248, Minor = 0


Andrea Laini


-----Messaggio originale-----
Da: yocto-bounces at yoctoproject.org [mailto:yocto-bounces at yoctoproject.org] Per conto di Khem Raj
Inviato: lunedì 13 marzo 2017 21:29
A: yocto at yoctoproject.org
Oggetto: Re: [yocto] Autoload kernel module works only once



On 3/13/17 7:36 AM, Andrea Laini wrote:
> Hi everybody,
> 
>  
> 
> I'm getting some errors after building my Linux distro with the use of 
> KERNEL_MODULE_AUTOLOAD to allow autoloading 2 of my custom out-of-tree 
> device at boot time. We've a Poky 1.7 version.
> 
>  
> 
> So, before building the new image with the Yocto keyword 
> KERNEL_MODULE_AUTOLOAD, I was able to load and open (and, obviously,
> use) my devices simply by calling 'modprobe mydevice' after logging in.
> Restarting the board, everything was still working well.
> 
> Since I've rebuild a new image enabling module autoload at boot time, 
> modules are always loaded, but I'm able to open (and use) them only 
> really first time I switched on the board after downloading new image.
> After the first reboot, LKMs are still loaded (calling 'lsmod' show
> them) but I can't open them, neither from my C program nor 
> reading/writing them from '/dev/mydevice'.

look out for any race conditions for dependencies. Since it will now autoload the modules and its possible that you were depending on some system behavior that was enabled late in boot process, but it worked since you did it after logging in and manually doing modprobe.

> 
>  
> 
> To me it sound a very strange behavior.
> 
>  
> 
> Hope anyone can help,
> 
> Many thanks
> 
>  
> 
> Andrea
> 
>  
> 
> 
>  
> 
> 
> 




More information about the yocto mailing list