When linux is loaded, the drivers required to boot the system either have to already be compiled into the kernel or an initial ram disk (initrd) is required if the drivers are complied as modules. The initrd contains the modules required to boot the system. An example of when a initrd is frequently required is when the OS is located on a SCSI disk. The initrd needs to contain the SCSI driver module so the disk can be accessed.

Modules are located in /lib/modules/`uname -r`. To add a module dynamically into a running kernel, it needs to be compiled, installed into /lib/modules/ `uname -r` and then depmod -a run to map out any dependencies the module may have. If any unresolved dependencies are found, the kernel may have to be recompiled to include the required dependencies. Once a depmod has been successfully run, modprobe or insmod can be run to load the module. The difference between the two is that modprobe will check any dependencies the module may have and load these modules first. insmod loads the module without performing any checks. If there are dependencies, insmod fails with an error message about unresolved dependencies.

A file called /etc/modules.conf contains aliases for the modules, driver options and commands to execute before or after the module is loaded. modprobe and depmod reference this file. Driver parameters are set via an options statement.

Some modules support the setting of parameters via the /proc filesystem, either by changing the value in the file or by using the sysctl command. Possible parameters can be listed by issuing modinfo -p.

/etc/sysctl.conf is the kernel configuration file that can be called by sysctl

Linux module commands

  • lsmod - list loaded modules
  • modprobe/insmod - load modules
  • rmmod - unload modules
  • depmod - build module dependencies
  • modinfo -p - get module parameters

Example of a module alias in /etc/modules.conf

alias eth0 3c59x

This allows ifconfig to use the standard eth0 as the interface name instead of having to know the type of network card device.

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password