Linux driver Loading Method (note)

Source: Internet
Author: User
How to load the linux Driver (Note)-Linux general technology-Linux programming and kernel information. The following is a detailed description. Driver loading:
1. Static Loading (the system automatically loads the dynamic kernel upon startup, automatically registers the device and creates device contacts, and the application can run directly after the system starts)

2. dynamic Loading (for module loading, the driver is not loaded when the system starts, and manual loading is required. That is to say, after the system starts, our applications cannot directly apply the driver, instead, we must manually use the insmod command to load it)

Among them, dynamic loading can be divided into three types of research;

1. after the driver is loaded, we create the master device number, and use cat/proc/devices to check whether the master device number is repeated, then, use the mknod command to create a device contact based on the device name used in the application.

2. after the driver is loaded, the driver automatically generates a master device number using the register_chrdev () function to register the device in the kernel, we use the cat/proc/devices command and the device name registered in the driver to query the master device number and slave device number. Then, based on the device name used by the application, create with mknod. (The device name registered in the driver is the automatically generated master device number. The device name in the driver does not have to be the same as the created device contact name. They can be associated with the master device number, the device name of the application must be the same as the created device contact name)

3. After the driver is loaded, the driver uses the devfs system, which can automatically generate the master device number and then automatically create the device contact. We only need to run the application directly after loading the driver.

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.