Implement the virtual pile kernel module in Linux

Source: Internet
Author: User
In Linux, implement the Linux kernel module-general Linux technology-Linux programming and kernel information. The following is a detailed description. Recently, I encountered a little trouble in Porting a previous online driver loading technology to the AutoYaST installation system of SuSE. AutoYaST uses the Linuxrc compiled by SuSE as its initial guidance part. Unlike most of the conventional initrd guidance sections, Linuxrc is directly written in C language and has little flexibility to expand. As a result, you cannot simply modify the boot script as you have previously ported it to other environments. Although the source code of Linuxrc can be directly modified, it increases the complexity of later maintenance. Alas, it's really a headache.

After carefully analyzing the AutoYaST design, we found that at least the driver can be added, but it only supports the simplest insmod method written in the configuration file. Okay, as long as this barely scalable approach is returned, I can integrate the online loading module of the driver. Because you can only call a certain driver, you must start with the kernel module. It is obviously unrealistic to transform the existing program into a kernel module. Fortunately, the Linux kernel also provides such an interface to call the user-State Program: call_usermodehelper (). You can go to kmod. h. The function is simple. You can call a user-State program and choose whether to block it until it is executed successfully.

In this way, you only need to write a simple virtual-pile kernel module and call the user-State program that we really want to execute in its initialization function. However, when I proposed this solution, some colleagues immediately questioned: If I load other kernel modules during kernel module initialization, will the kernel be locked? "Not Doing Well" at least indicates that he is not sure. To find the answer, I analyzed the code (based on 2.6.17) for the system calling sys_init_module () in the kernel ).
QUOTE:
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.