Statically compiled into the Linux kernel

Source: Internet
Author: User

First, ready to guide the development Board of the normal source

Second, under the driver directory of the kernel source kernel folder, create the Led_arm folder
mkdir Drivers/led_arm
C. Copy the driver of "led drive experiment" to the Led_arm directory (see the previous LED driver blog for details)

Copy the led.c below the folder

The Kconfig is the configuration menu that corresponds to the kernel. If you want to add a new driver to the kernel source, you can modify the Kconfig to add to our drive configuration menu, so there is a way to choose our driver.

Each config menu item must have a type definition, bool: Boolean type, TriState: Built-in, module, remove, String: String, Hex: 16, Integer: Integer

For example, config Hello_module
BOOL "Hello Test module"

BOOL type can only be selected or unchecked, tristate type of menu items are compiled into kernel module options, if you choose to compile into a kernel module, you will generate a config_hello_module=m configuration in. config, if you choose built-in, is to compile directly into the kernel effect, a config_hello_module=y configuration is generated in. config.


① Add a Kconfig file

<span style= "FONT-SIZE:14PX;" >config myledtristate "myled" Default Nhelpthis is a LED driver</span>

② Add a Makefile

<span style= "FONT-SIZE:14PX;" >obj-$ (config_ledtest) +=led.o</span>

Iv. Add the driver support options we have written to the kernel configuration menu.
Modify the Kconfig file in the drivers directory

Add a statement on the last line

SOURCE "Drivers/led_arm/kconfig"

v. Modification of drivers/makefile files
Add the following statement
obj-$ (config_ledtest) +=led_arm/
Six, reconfigure the kernel
enter in the source root directory
#make Menuconfig
at the end of the menu, you can see our newly added myled option.


Statically compiled into the Linux kernel

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.