There is a wide variety of PC hardware components. To use this hardware properly, you need a “driver” with which the operating system (in Linux, the “kernel”), can access this hardware. There are basically two ways of integrating drivers into your system:
The drivers can be compiled directly into the kernel. Such a kernel (“in one piece”) is referred to as a monolithic kernel. Some drivers are only available in this form.
Drivers can be loaded into the kernel on demand. In this case, the kernel is referred to as a modularized kernel. This has the advantage that only those drivers really needed are loaded and the kernel thus contains nothing unnecessary.
Which drivers to compile into the kernel and which to load as run-time modules is defined in the kernel configuration. Basically, components not required for booting the system should be built as modules. This makes sure the kernel does not become too big to be loaded by the BIOS or a boot loader. Drivers for ext2, the SCSI drivers on a SCSI-based system, and similar drivers should be compiled into the kernel. In contrast, items, such as isofs, msdos, or sound, which are not needed for starting your computer system, should definitely be built as modules.
Kernel modules are located in /lib/modules/<version>. Version stands for the current kernel version.
hwinfo can detect the hardware of your system and select the drivers needed to run this hardware. Get a small introduction to this command with hwinfo --help. If you, for example, need information about your SCSI devices, use the command hwinfo --scsi. All this information is also available in YaST in the hardware information module.
The following commands are available:
insmod loads the requested module after searching for it in a subdirectory of /lib/modules/<version>. It is better, however, to use modprobe rather than insmod.
Unloads the requested module. This is only possible if this module is no longer needed. For example, the isofs module cannot be unloaded while a CD is still mounted.
Creates the file modules.dep in /lib/modules/<version> that defines the dependencies of all the modules. This is necessary to ensure that all dependent modules are loaded with the selected ones. This file will be built after the system is started if it does not exist.
Loads or unloads a given module while taking into account dependencies of this module. This command is extremely powerful and can be used for a lot of things (e.g., probing all modules of a given type until one is successfully loaded). In contrast to insmod, modprobe checks /etc/modprobe.conf and therefore is the preferred method of loading modules. For detailed information about this topic, refer to the corresponding man page.
Shows which modules are currently loaded as well as how many other modules are using them. Modules started by the kernel daemon are tagged with autoclean. This label denotes that these modules will automatically be removed once they reach their idle time limit.
Shows module information.
The loading of modules is affected by the files /etc/modprobe.conf and /etc/modprobe.conf.local and the directory /etc/modprobe.d. See man modprobe.conf. Parameters for modules that access hardware directly must be entered in this file. Such modules may need system-specific options (e.g., CD-ROM driver or network driver). The parameters used here are described in the kernel sources. Install the package kernel-source and read the documentation in the directory /usr/src/linux/Documentation.
The kernel module loader is the most elegant way to use modules. Kmod performs background monitoring and makes sure the required modules are loaded by modprobe as soon as the respective functionality is needed in the kernel.
To use Kmod, activate the option (CONFIG_KMOD) in the kernel configuration. Kmod is not designed to unload modules automatically; in view of today's RAM capacities, the potential memory savings would be marginal. For reasons of performance, monolithic kernels may be more suitable for servers that are used for special tasks and need only a few drivers.