Advantages and disadvantages of Linux device driver dynamic kernel insertion and direct integration to kernel

Source: Internet
Author: User
Advantages and disadvantages of Linux device driver dynamic kernel insertion and direct integration into the kernel analysis Introduction: The company made a Linux-based Ethernet interface board, which is currently maintained by me, the main CPU of this board uses PowerPC, run the Linux system and add two external DPRAM modules. DPRAM uses the character device driver... advantages and disadvantages of Linux device driver dynamic kernel insertion and direct integration into the kernel analysis Introduction: The company made a Linux-based Ethernet interface board, which is currently maintained by me, the main CPU of this board uses PowerPC, run the Linux system and add two external DPRAM modules. DPRAM is written in the form of a character device driver. it is directly integrated into the kernel source code and compiled with the kernel for installation, after taking over the program related to the board, my colleagues and I discussed why the DPRAM driver integrated into the kernel did not adopt the dynamic loading method of independent compilation with the overall kernel compilation, today I made a simple summary, so I had this BOLG article. Body: There are two main methods to develop a device driver in Linux. The first method is to integrate the driver into the kernel and compile it together with the kernel. The soon-to-be-developed device driver files (C and H files) are directly stored in the relevant directory of the Linux kernel source code (for example, the developed network device driver can be stored in the/net directory ), compile the kernel directly with the kernel. The second is to compile the program separately and insert the kernel dynamically. The soon-to-be-developed device driver files (C and H files) are directly compiled using the gcc tool (or cross-tool chain), and then compiled using the insmod (insert kernel) or (rmmod) when the final product is used, a script file is usually written to enable the system to automatically run the insmod driver when powered on. Now, we have introduced two common development and loading methods for Linux Device Drivers. let's compare these two methods in the form of tables, which is more intuitive and clear. Advantages and disadvantages of this method: integration to kernel 1. directly compile with the kernel. The process is relatively simple and can be configured through Linux menuconfig. 2. no initialization script is required. 3. for a relatively stable developed device driver, you can compile it into a kernel file with the kernel to facilitate installation during mass production. 1. the Linux kernel has been modified to increase the system instability. 2. the kernel must be re-compiled every time the device driver changes, which is inefficient and not suitable for the development and debugging stages. Dynamic insertion to kernel 1. device drivers can be dynamically inserted and detached. once the driver encounters a problem, debugging of the driver is convenient. 2. the kernel configuration file is not changed, which has little impact on system stability. 1. the device driver needs to be compiled separately, and the initialization script for system power-on needs to be written, which requires a large amount of work. 2. in the actual production process, in addition to burning Linux kernel files, the device driver files must be separately burned. The process is complex and not suitable for mass production.
Related Article

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.