此内容没有您所选择的语言版本。
Chapter 45. General Parameters and Modules
This chapter is provided to illustrate some of the possible parameters available for common hardware device drivers [9], which under Red Hat Enterprise Linux are called kernel modules. In most cases, the default parameters do work. However, there may be times when extra module parameters are necessary for a device to function properly or to override the module's default parameters for the device.
During installation, Red Hat Enterprise Linux uses a limited subset of device drivers to create a stable installation environment. Although the installation program supports installation on many different types of hardware, some drivers (including those for SCSI adapters and network adapters) are not included in the installation kernel. Rather, they must be loaded as modules by the user at boot time.
Once installation is completed, support exists for a large number of devices through kernel modules.
Important
Red Hat provides a large number of unsupported device drivers in groups of packages called
kernel-smp-unsupported-<kernel-version>
and kernel-hugemem-unsupported-<kernel-version>
. Replace <kernel-version> with the version of the kernel installed on the system. These packages are not installed by the Red Hat Enterprise Linux installation program, and the modules provided are not supported by Red Hat, Inc.
45.1. Kernel Module Utilities
A group of commands for managing kernel modules is available if the
module-init-tools
package is installed. Use these commands to determine if a module has been loaded successfully or when trying different modules for a piece of new hardware.
The command
/sbin/lsmod
displays a list of currently loaded modules. For example:
Module Size Used by tun 11585 1 autofs4 21573 1 hidp 16193 2 rfcomm 37849 0 l2cap 23873 10 hidp,rfcomm bluetooth 50085 5 hidp,rfcomm,l2cap sunrpc 153725 1 dm_mirror 29073 0 dm_mod 57433 1 dm_mirror video 17221 0 sbs 16257 0 i2c_ec 5569 1 sbs container 4801 0 button 7249 0 battery 10565 0 asus_acpi 16857 0 ac 5701 0 ipv6 246113 12 lp 13065 0 parport_pc 27493 1 parport 37001 2 lp,parport_pc uhci_hcd 23885 0 floppy 57317 1 sg 34653 0 snd_ens1371 26721 1 gameport 16073 1 snd_ens1371 snd_rawmidi 24897 1 snd_ens1371 snd_ac97_codec 91360 1 snd_ens1371 snd_ac97_bus 2753 1 snd_ac97_codec snd_seq_dummy 4293 0 snd_seq_oss 32705 0 serio_raw 7493 0 snd_seq_midi_event 8001 1 snd_seq_oss snd_seq 51633 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event snd_seq_device 8781 4 snd_rawmidi,snd_seq_dummy,snd_seq_oss,snd_seq snd_pcm_oss 42849 0 snd_mixer_oss 16833 1 snd_pcm_oss snd_pcm 76485 3 snd_ens1371,snd_ac97_codec,snd_pcm_oss snd_timer 23237 2 snd_seq,snd_pcm snd 52933 12 snd_ens1371,snd_rawmidi,snd_ac97_codec,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer soundcore 10145 1 snd i2c_piix4 8909 0 ide_cd 38625 3 snd_page_alloc 10569 1 snd_pcm i2c_core 21697 2 i2c_ec,i2c_piix4 pcnet32 34117 0 cdrom 34913 1 ide_cd mii 5825 1 pcnet32 pcspkr 3521 0 ext3 129737 2 jbd 58473 1 ext3 mptspi 17353 3 scsi_transport_spi 25025 1 mptspi mptscsih 23361 1 mptspi sd_mod 20929 16 scsi_mod 134121 5 sg,mptspi,scsi_transport_spi,mptscsih,sd_mod mptbase 52193 2 mptspi,mptscsih
For each line, the first column is the name of the module, the second column is the size of the module, and the third column is the use count.
The
/sbin/lsmod
output is less verbose and easier to read than the output from viewing /proc/modules
.
To load a kernel module, use the
/sbin/modprobe
command followed by the kernel module name. By default, modprobe
attempts to load the module from the /lib/modules/<kernel-version>/kernel/drivers/
subdirectories. There is a subdirectory for each type of module, such as the net/
subdirectory for network interface drivers. Some kernel modules have module dependencies, meaning that other modules must be loaded first for it to load. The /sbin/modprobe
command checks for these dependencies and loads the module dependencies before loading the specified module.
For example, the command
modprobe e100
loads any module dependencies and then the
e100
module.
To print to the screen all commands as
/sbin/modprobe
executes them, use the -v
option. For example:
modprobe -v e100
Output similar to the following is displayed:
insmod /lib/modules/2.6.9-5.EL/kernel/drivers/net/e100.ko Using /lib/modules/2.6.9-5.EL/kernel/drivers/net/e100.ko Symbol version prefix 'smp_'
The
/sbin/insmod
command also exists to load kernel modules; however, it does not resolve dependencies. Thus, it is recommended that the /sbin/modprobe
command be used.
To unload kernel modules, use the
/sbin/rmmod
command followed by the module name. The rmmod
utility only unloads modules that are not in use and that are not a dependency of other modules in use.
For example, the command
rmmod e100
unloads the
e100
kernel module.
Another useful kernel module utility is
modinfo
. Use the command /sbin/modinfo
to display information about a kernel module. The general syntax is:
modinfo [options] <module>
Options include
-d
, which displays a brief description of the module, and -p
, which lists the parameters the module supports. For a complete list of options, refer to the modinfo
man page (man modinfo
).
[9]
A driver is software which enables Linux to use a particular hardware device. Without a driver, the kernel cannot communicate with attached devices.