Re: MODULE_ALIAS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

I noticed that the kernel knows sometimes to load modules
automatically.
I presume this has something to do with MODULE_ALIAS.
I was wondering how does this macro work.
and in general, how does the auto-load thing work.
is it using udev ? modprobe ?


Can I assume you are referring to device driver modules automatically
getting loaded upon detection of corrresponding devices?

Each device driver contains a list of certain (bus specific) device
IDs that the driver is willing to handle. At the time of kernel
compilation, depmod collects all this information from all the
drivers, and creates an exhaustive list of Device IDs and the
corresponding driver module.

For e.g. for PCI bus, each PCI driver dictates the devices it wants to
handle by telling their vendor IDs, device IDs etc. This information
from all the drivers is collected in the file
/lib/modules/<kernel>/modules.pcimap

Now when ever a new device is detected by the kernel, a hotplug event
goes to user space and the hotplug script is executed (/sbin/hotplug).
It further invokes the bus specific agent script (pci.agent) with the
ID of the device. This scripts consults the modules.pcimap and loads
the appropriate driver using modprobe.

regards,

Rajat

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux