Linux Kernel manual configuration Learning

Source: Internet
Author: User

You can manually configure the kernel according to "Linux device driver development details" today, mainly by adding your own options to the kernel, such as adding a self-added driver. The specific process is as follows:

1. First, add your own driver directory under the DRIVERS directory, and temporarily name it mydriver. Run the mkdir mydriver command.

2. Create a kconfig file in the mydriver directory to display the configuration. Run the sudo gedit kconfig command.

Add the following content to kconfig:

#

# Mydriver Configuration

#

Menu "mydriver"

Comment "My driver"

 

Config config_mydriver

Bool "mydriver support"

Config config_mydriver

Tristate "mydriver USR-space interface"

Depends on config_mydriver

 

Endmenu

3. To make the kconfig configuration take effect, you need to modify the ARCH/ARM/kconfig file and add

Source "Drivers/mydriver/kconfig"

4. Create a makefile in the mydriver directory.

# Drivers/mydriver/makefile

#

#

OBJ-$ (config_mydriver) + = mydriver. O mydriver_queue.o mydriver_client.o

OBJ-$ (config_mydriver_user) + = mydriver_ioctl.o

OBJ-$ (config_proc_fs) + = mydriver_proc.o

 

OBJ-$ (config_mydriver_cpu) + = CPU/

4. Create a CPU subdirectory in the mydriver directory and run the mkdir CPU command.

5. Create a makefile in the CPU directory and run the sudo gedit makefile command.

Add content

# Drivers/mydriver/CPU/makefile

#

# Makefile for the mydriver CPU

#

OBJ-$ (config_mydriver_cpu) + = CPU. o

6. To enable the mydriver directory to be compiled, add a script to the MAKEFILE file in the DRIVERS directory.

OBJ-$ (config_mydriver) + = mydriver/

 

After completing the preceding steps, you can see the newly added mydriver directory and its options when using make menuconfig.

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.