Linux is based on modules, and all drivers are modular: Management Module commands: 1. List the sizes and names of all loaded modules in the system: lsmod or CAT/proc/modules
Ty @ tonylinux :~ $ Lsmodmodulesizeusedbyrfcomm402160l2cap262445rfcommbluetooth500204rfcomm, l2capppdev92200radeon1160001 ...... ty @ tonylinux :~ $ CAT/proc/modulesrfcomm402160-Live0xf8dee000l2cap262445rfcomm, live0xf8db200020.th500204rfcomm, L2CAP, Live0xf8dc2000ppdev92200-Live0xf8d88000 .........
2. modinfo: modinfo allows you to view the module information and determine the purpose of the module by checking the module information.
Ty @ tonylinux :~ $ Modinfodomainthfilename:/lib/modules/2.6.15-27-386/kernel/NET/Bluetooth. koauthor: maximkranyansky <maxk@qualcomm.com>, marcelholtmann <marcel@holtmann.org> Description: effecthcorever2.8version: 2.8 license: gplalias: net-pf-31vermagic: 2.6.15-27-effecpreempt486gcc-4.0depends: srcversion: Guest http://www.mscto.com
3. modprobe: mount the new module and the module on which the new module depends modprobe. Our common function is to mount the module. When a kernel module is mounted, the modules that this module depends on are also mounted at the same time; this is different from the insmod Mount module. Of course, modprobe also provides a list of all kernel modules, as well as the function of removing modules. Next we will give an example to illustrate our common functions and parameters;
Modprobe-codprobe-C can view the modules configuration file, such as the module alias;
Modprobe-L is used to list all modules in the kernel, including mounted and unmounted modules. Through modprobe-l, we can view the modules we need and mount them according to our needs;
[Root @ localhostbeinan] # modprobe Module name Note: mount a module;
[Root @ localhostbeinan] # modprobe-R module name Note: remove the loaded module, which has the same function as rmmod;
4. rmmod remove the rmmod Module name of the mounted Module
5. depmod: List of created module dependencies. This module management tool is a list of created module dependencies. Just pay attention to several parameters, the current Linux release uses the 2.6x kernel to automatically resolve the dependency, so this command is fine;
The module also had dependencies before. For example, if we want to drive a USB mobile hard disk, there are currently two types of drivers: udev, which are available in the kernel, but not very stable at present; another method is to use the USB-storage driver, while the USB-storage depends on the SCSI module. Therefore, we need to use the USB-storage module, you also need to install the SCSI command as modules. dep file or ing file to create dependency, modules. the DEP file is located in/lib/modules/2.6.15-27-i386; this is the directory file of my computer.
6. insmod: The insmod tool is similar to modprobe, but it does not have a strong modprobe function. In the mounting module, modprobe does not need to specify the path of the module file or the suffix of the file. O or. ko; what insmod needs is the absolute path of the directory where the module is located, and must contain the module File name suffix (modulefile. O or modulesfile. ko );
[Root @ localhostbeinan] # insmod/lib/modules/2.6.11-1.1369 _ FC4/kernel/Drivers/NET/tg3.ko
Module configuration file modules. conf or modprobe. the automatic mounting module of the conf kernel module is usually located in a configuration file, and the common Linux release version has/etc/modules. conf or/etc/modprobe. conf.
(The module configuration file in Ubuntu is/etc/modules. Its content is:
#/Etc/modules: Kernel Modules to load at boot time.
#
# This file contains the names of kernel modules that shoshould be loaded
# At boot time, one per line. Lines beginning with "#" are ignored.
Lp
)
For example, the file/etc/modprobe. conf is automatically loaded when the fedoracore4.0 kernel module is started; in this file, it is generally written into the module's load command or module alias definition;
For example, in modules. A similar line may be released in conf; the driver for source code compilation is generally. /configure; Make; makeinstall, sometimes the program does not provide. /configure, we can make or makeinstall, or execute make; makeinstall; if you cannot make install, We need to copy it by ourselves. O or. go to the/lib/modules/kernel version/kernel/directory or the corresponding driver directory in the/lib/modules/kernel version/kernel/DRIVERS directory;