A detailed description of compiling the driver into the Linux kernel

Source: Internet
Author: User

1. Enter the catalogue Linux-kernel-samsung-dev\drivers\char

2. Create a new target directory of 01.led, copy the drive related files to this directory
Note: You need to ensure that the copied driver files are drivers that work

3. Write Kconfig file in directory 01.led
Menu "XXX"

Config xxx_led
TriState "Xxx_ggg210_led"
Default n
Help
The LED water made by XXX which is used by platform!

Endmenu

4. Write makefile file in directory 01.led
obj-$ (config_xxx_led) + = LED_DEV.O LED_DRV.O

5. Modify the makefile file in the 01.led parent directory Char
Added: obj-$ (config_xxx_led) + = 01.led/

6. Modify the Kconfig file in the 01.led parent directory Char

Added: Source "Drivers/char/01.led/kconfig"

7. After the correct configuration, execute the Make Menuconfig command pop-up menu and follow step one by one below to enter
Location:
Device Drivers
Character devices
xxx
< > xxx_ggg210_led (NEW)

8, use the "Space" key to select "*" Number:
<*> xxx_ggg210_led (NEW) means that the module is compiled into the kernel

9, execute the command: Make-j 2 uimage
("-j 2" means opening 2 threads to speed up compilation)

10. Burn the generated uimage file to the Development Board

11. After the Development Board kernel is started, use the "ls/dev" command to see if there is a device node to confirm that the add succeeded

12, remove the driver module.
Delete the 01.led folder in the drivers directory first, and then delete the statements that were previously added in the corresponding makefile and kconfig.

########################################################################################
The device driver is stored in the subdirectory of the kernel source root directory drivers/, within which the device driver files are organized in order by category, type, etc.
A. Character devices exist in the drivers/char/directory
B. Block devices are stored in the drivers/block/directory
C. The USB device is stored in the drivers/usb/directory.


Attention:

(1) The file organization rules here are not absolutely constant, for example: USB devices are also part of the character device, and can also be stored in the drivers/usb/directory.
(2) under the drivers/char/directory, there are a large number of C source code files and many other directories in this directory. All device drivers that have only one or two source files can be stored directly in that directory, but if the driver contains many source files and other auxiliary files, you can create a new subdirectory.



A detailed description of compiling the driver 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.