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 runtime
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.
![]() | Tip |
---|---|
Even drivers that are needed to boot the system may be built as modules. In this case, the initial RAM disk is used to load these modules during boot. |
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 utilities to load modules into the kernel are available in the
package module-init-tools
.
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, because
modprobe also checks the module for
dependencies.
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 is 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, including probing all modules of a given type
until one is successfully loaded. Unlike
insmod, modprobe
checks /etc/modprobe.conf
, making it the
preferred method of loading modules. For detailed information about this
topic, refer to the corresponding man page.
Shows which modules are currently loaded and 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. Because this information is extracted from the module itself, only the information built in by the driver developers can be displayed. The information may include the author, a description, the license, module parameters, dependencies, and aliases.
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, for example, CD-ROM
driver or network driver, may need system-specific
options. 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.