Usage of Ubuntu driver module commands

Source: Internet
Author: User
Article title: use of driver module commands in Ubuntu. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux is based on modules, and all drivers are modular:

Management Module command:

1. list the sizes and names of all loaded modules in the system:

Lsmod or cat/proc/modules
Linux :~ $ "> Ty @ tonylinux :~ $ Lsmod
Module Size Used
Rfcomm 40216 0
L2cap 26244 5 rfcomm
Bluetooth 50020 4 rfcomm, l2cap
Ppdev 9220 0
Radeon 116000 1
........

Ty @ tonylinux :~ $ Cat/proc/modules
Rfcomm 40216 0-Live 0xf8dee000
L2cap 26244 5 rfcomm, Live 0xf8db2000
Bluetooth 50020 4 rfcomm, l2cap, Live 0xf8dc2000
Ppdev 9220 0-Live 0xf8d88000
.........
2. modinfo:

Modinfo can view the module information and determine the purpose of the module by viewing the module information.
Ty @ tonylinux :~ $ Modinfo bluetooth
Filename:/lib/modules/2.6.15-27-386/kernel/net/bluetooth. ko
Author: Maxim kranyansky , Marcel Holtmann
Description: Bluetooth Core ver 2.8
Version: 2.8
License: GPL
Alias: net-pf-31
Vermagic: 2.6.15-27-386 preempt 486 gcc-4.0
Depends:
Srcversion: 7EE5558C84FD3DB2B68971C
 
3. mount the new module and the module on which the new module depends.

The common function of modprobe is to mount a module. when a kernel module is mounted, the modules on which this module depends are also mounted. 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-c

Odprobe-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 @ localhost beinan] # modprobe module name Note: Mount a module;

Root @ localhost beinan] # modprobe-r module name Note: remove loaded modules, which have the same functions as rmmod;

4. rmmod remove mounted modules

Rmmod module name

5. depmod: List of module dependencies created

This module management tool is used to create a list of module dependencies. just pay attention to a few parameters. Currently, the Linux release uses the kernel version 2.6x to automatically resolve dependencies, this command is fine. The module also has 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, however, it is not 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 mounting module

The insmod tool is a bit similar to modprobe, but it does not have a strong modprobe function. in the Mount 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 @ localhost beinan] # insmod/lib/modules/2.6.11-1.1369 _ FC4/kernel/drivers/net/tg3.ko

Module configuration file modules. conf or modprobe. conf

The automatic mounting module of the kernel module is usually located in a configuration file. the common Linux releases all have/etc/modules. conf or/etc/modprobe. conf. For example, the file automatically loaded by the Fedora Core 4.0 kernel module upon startup is/etc/modprobe. conf; in this file, it is generally written to 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 install, sometimes the program does not provide. /configure, we can make or make install, or execute make; make install; 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;

I 'd like to try it myself. I can't say it clearly. I will know how to solve the problem. The driver's REAME and INSTALL will prevail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.