Linux Kernel learning basics

Source: Internet
Author: User
Linux Kernel learning basics-general Linux technology-Linux programming and kernel information. For more information, see the following section. Hardware requires Kernel support. Some hardware support is not compiled into the kernel, which also requires us to re-compile the kernel. The kernel includes not only the driver of the device, but also other content, for example, support for network protocols and firewall ...... for example, the implementation of iptables requires Kernel support for some functions. If the kernel content related to iptables is not compiled, iptables-related functions cannot be implemented;

1. Kernel Modules mounted in the lsmod column:

Lsmod lists the names and sizes of loaded modules in the current system. You can also view/proc/modules. We can also know the loaded modules of the system;

2. modinfo:

Modinfo can view the module information and determine the purpose of the module by viewing the module information;

3. Mount the new module and the module on which the new module depends.

Modprobe our common function is to mount a module. When a kernel module is mounted, the modules on which this module depends are also mounted. Of course, modprobe also lists all kernel modules, there is also the function of removing modules. Next we will give an example to illustrate our common functions and parameters.

4. rmmod:

5. depmod: List of module dependencies created

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 );

For this tool, we will only introduce it and it is not recommended. Because the module has dependency, you may not know which module the module depends on;

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 compile and install scsi;

Another example is the sata hard disk. in Linux, the device represents/dev/sd *, for example,/dev/sda,/dev/sdb... to drive a sata hard disk, You need to select sata in the kernel, compile it into a module, or build it into the kernel. At the same time, you need to select the ide in the kernel, scsi support.

The hardware driver must be supported by the kernel, whether we install the driver ourselves or the driver that comes with the kernel. If the hardware driver is supported by the kernel module, the driver directory is located in/lib/modules/kernel version/kernel/directory or/lib/modules/kernel version/kernel/drivers directory.

At present, most drivers automatically copy the. o or. ko files to the kernel module directory during compilation and installation. Most of them do not need to be copied by ourselves. If you try to compile and install the audio card driver alsa-drivers, you will understand what I mean.

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.