LKMs - intelligent loading

Posted in How To's by Shafkat Shahzad, M.Sc - Senior Technical Content Manager on December 13th, 2009

Welcome to the tutorial guide. The guide will provide a user with advise and guidance on intelligent loading.

After you have module loading and unloading figured out using insmod and rmmod, you can let the system do more of the work for you by using the higher level program modprobe. See the modprobe man page for details.

The main thing that modprobe does is automatically load the prerequisites of an LKM you request. It does this with the help of a file that you create with depmod and keep on your system.
The following performs an insmod of msdos.o, but before that does an insmod of fat.o, since you have to have fat.o loaded before you can load msdos.o.

modprobe msdos

This major thing that modprobe does is to find the object module containing the LKM given just the name of the LKM.

The modprobe msdos might load /lib/2.4.2-2/fs/msdos.o.

The modprobe eth0 loads the appropriate network device driver to create and drive the eth0 device, assuming you set that up properly in modules.conf.
modprobe is especially important because it is by default the program that the kernel module loader uses to load an LKM on demand. Please note that if you use automatic module loading, you will need to set up modules.conf properly or things will not work.

The depmod scans the LKM object files (typically all the .o files in the appropriate /lib/modules subdirectory) and figures out which LKMs prerequire (refer to symbols in) other LKMs. It generates a dependency file (typically named modules.dep), which you normally keep in /lib/modules for use by modprobe.

modprobe can be used to remove stacks of LKMs.
Via the LKM configuration file (typically /etc/modules.conf), you can fine tune the dependencies and do other fancy things to control LKM selections. And you can specify programs to run when you insert and remove LKMs, for example to initialize a device driver.
If you are maintaining one system and memory is not in short supply, it is probably easier to avoid modprobe and the various files and directories it needs, and just do raw insmods in a startup script.

If you followed the advise and guidance as provide in this tutorial guide then you would have learnt about intelligent loading.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Leave a Comment