Almost every driver can be built as a module. If the kernel was built with module support and kerneld enabled, then most modules will not need any special entries in the /etc/modules file. kerneld will load them when they are needed and unload them when they are not being used. Some modules need to be loaded and initialized by the kernel before kerneld is started by init. There is a line in the provided /etc/modules file, after the general comments, that has been commented out. This is the ``auto'' line. Removing the comment (# character) from the ``auto'' line, will tell the kernel to load those modules automatically, without the aid of kerneld.
Some device drivers, like the low level drivers for specific SCSI cards, must be installed explicitly. When a CD is mounted, the system (and kerneld) know that the modules that support the SCSI device must be loaded. The kernel has no knowledge of what card the machine has installed. This information is provided to the kernel in the /etc/modules file. An Adaptec 1542 SCSI controller needs a line added to the modules file (anywhere after the ``auto'' line) that declares this driver. In this example the /etc/modules file might look like:
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a `#', and everything on the line after them are ignored.
#
auto
aha1542
This file will cause all the necessary modules that support the controller to be loaded by kerneld, while the aha1542 driver is loaded at boot time and left loaded until reboot.
The device driver that accesses the root file system must be built into the kernel or the system will be unable to boot. If the device driver is a module, the kernel has no driver to read the root file system, as this is where it expects to find the module for that driver. This Catch 22 is, for instance, why the Debian installation kernel has the MS-DOS FAT driver built into the kernel, rather than available in the modules installation section. Because the rescue disk is an MS-DOS format disk the kernel must have the FAT file system drivers already installed before it can read the root file system from the floppy (minix is also built in because the root.bin image file is a minix file system).
Any devices the kernel will need before the root file system has been mounted, in order to get to the point of having a mounted root file system, must be built into the kernel. All other devices can be built as modules. The Debian installation kernel is built in this fashion, making it possible to fit the installation into complex hardware configurations where blanket support causes failures. With the recent growth in the size of the kernel image this configuration allows the kernel to stay below the size limitations of some boot loaders and still maintain the highest level of functionality.
Many of the configuration problems associated with device drivers involve finding the correct set of options to pass when installing the driver.
Without modules each test would require rebooting the system in order to get the newest test options to take effect. With the module utilities supplied with a Debian system, a module can be unloaded with the rmmod command. The module's options can be edited in /etc/conf.modules to reflect the new test values, and the module reinstalled with insmod, all without rebooting the system!
With the use of kerneld, modules can be loaded and unloaded as needed. When no access has been made to the VFAT file systems for awhile, kerneld will unload the module and free up the memory it used. If, by chance, there is the need to read that VFAT file system in the future, the request to the kernel will trigger the loading of the required module by kerneld. In this way the kernel only takes up as much memory as it actually needs to continue with operations while maintaining the capability of accessing a wide variety of devices and systems.