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