Hi Peter,

Thanks for your message.
Actually I'm interested in how modprobe autoloads modules based on the
modalias files in sysfs. I read this in Greg KH's great book - Linux Kernel
in a Nutshell and I've been wondering how the modules would get loaded if
they had to be loaded in the first place to have the device->module list to
exist.

Quoting from the book
" All kernel driver modules have an internal list of devices that they
         support that is generated automatically by the list of devices the
driver tells the
         kernel it supports. The modprobe looks through this list of devices
by all drivers
         and tries to match it up with the alias it has. If it finds a
match, it will then load
         the module (this procedure is how the automatic driver loading
functionality in
         Linux works). "


Thanks,
-Joel

On Sun, Jan 24, 2010 at 10:37 AM, Peter Teoh <htmldevelo...@gmail.com>
wrote:
> multiple mechanism:
>
> Modprobe uses a "Makefile"-like dependency file, created by depmod,
> to automatically  load  the  relevant  module(s)  from  the set of
> modules available in predefined directory trees.   (look inside the
> file /lib/modules/`uname -r`/modules.dep)
>
> and using udev:
>
> http://wiki.archlinux.org/index.php/Udev   (read autoloading)
>
> inside the kernel, there is a special function "request_module" which
> is used by the kernel functions to load other necessary kernel
> modules.   and quoting from the function:
>
>  * If module auto-loading support is disabled then this function
>  * becomes a no-operation.
>  */
> int __request_module(bool wait, const char *fmt, ...)
> {
>
>
> On Sat, Jan 23, 2010 at 7:04 PM, Joel Fernandes <agnel.j...@gmail.com>
wrote:
>> I have a doubt with the modalias file in sysfs and its role in
>> modprobe's ability to automatically load modules.
>>
>> I understand that this file is generated by the kernel based on the
>> list of devices that the driver tells the kernel it supports?
>> and it is with this list that modprobe figures which module to load
>> for which device.
>>
>> But how does the module tell the kernel about the list of devices it
>> supports, if it hasn't been loaded yet (and which is what we were
>> trying to load in the first place)?
>>
>> Thanks,
>> -Joel
>>
>> --
>> To unsubscribe from this list: send an email with
>> "unsubscribe kernelnewbies" to ecar...@nl.linux.org
>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>
>>
>
>
>
> --
> Regards,
> Peter Teoh
>

Reply via email to