On 1/29/07, Rajat Jain <rajat.noida.india@xxxxxxxxx> wrote:
> 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.
Thank You naziir
regards, Rajat
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/