How to add a driver module to the kernel statically

Source: Internet
Author: User
Article Title: how to add a driver module to the kernel statically. 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.

Suppose you want to load a flash Driver written by yourself into the project, and you can select this driver when configuring the kernel through menuconfig. What should I do? There are three steps: 1. Add your flashtest. c file to the/driver/mtd/maps/directory.

2. Modify the kconfig document in the/driver/mtd/maps directory:

Config MTD_flashtest

Tristate "ap71 flash"

Third, modify the makefile document in this directory.

Add the following content: obj-$ (CONFIG_MTD_flashtest) + = flashtest. o. When you run make menucofnig, you will find the ap71 flash option. If you select this option. This option is saved in the. config document. When you compile the kernel, it will read. config file. When the ap71 flash option is yes, when the system calls makefile under/driver/mtd/maps/, the flashtest. o is added to the kernel. To achieve your purpose.

After the driver module is loaded, create a node in the dev directory. The command is as follows:

Mknod int_ctl c 98 0

Int_ctl indicates the device name, C indicates the character device, 98 indicates the master device number, and 0 indicates the slave device number.

Cat/proc/interrupts

Cat/proc/devices

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.