How Linux Kernel Module Loading works…

Kernel module loading

The kernel bus drivers probe for devices. For every detected device, the kernel creates an internal device structure and the driver core sends an event to udev. Devices identify themselves by an id, which tells what kind of device it is. Usually these id’s consist of vendor and product id and other susbsytem specific values. Every bus has its own scheme for these id’s. The kernel takes this information, composes a MODALIAS string from it and and sends that string along with the event. For an USB mouse it looks like this: MODALIAS=usb:v046DpC03Ed2000dc00dsc00dp00ic03isc01ip02.

Every device driver carries a list of known id’s for devices it can handle. The list is contained in the kernel module file itself. The program depmod reads the id lists and creates the file modules.alias in the kernel’s /lib/modules directory for all currently available modules. With this infrastructure, module loading is as easy as calling modprobe for every event that carries a MODALIAS key. If modprobe $MODALIAS is called, it matches the device alias composed for the device with the aliases provided by the module. If a matching entry is found, that module will be loaded.
Reference URL:
1) http://wiki.archlinux.org/index.php/ModaliasPrimer
2) http://vrfy.org/log/recent-state-of-udev.html

READ  XML file which can be used for rss feed for website

Leave a Reply

Your email address will not be published. Required fields are marked *