Linux drivers have their own rules like other types of Linux programs, and here's a general procedure for writing basic Linux drivers:
(1) Build Linux- powered skeleton (load and unload Linux drivers);
(2) Registration and cancellation of equipment documents;
(3) Specify the information related to the drive;
(4) Specify the callback function;
(5) Writing business logic;
(6) Preparation of Makefile documents;
(7) Compiling Linux drivers;
(8) Install and uninstall Linux drivers.
For a Linux driver, you can start early development and testing on Ubuntu Linux. The hardware can also be simulated with software on Ubuntu Linux. When the basic development is complete, it is necessary to test the actual hardware on the Development Board or the engineering prototype. It will eventually need to be tested on the final sale of the phone.
To Add the Word_count directory to the Linux kernel source tree, follow these steps:
(1) Create a new Kconfig file, Create a Kconfig file in the Word_count directory , and enter the following:
Config Word_count
TriState "Word_count Driver"
Default Y
Help
This is a word count driver. It can get a word count from/dev/wordcount
(2) Modify the Makefile file
(3) Modify the Kconfig of the upper directory
SOURCE "Drivers/char/word_count/kconfig"
(4) Modify the Makefile file of the upper directory
obj-$ (conpig_word_count) + = word_count/
After modifying the Linux kernel settings and recompiling the kernel, Linux drivers that were previously compiled with the linux kernel may not be installed due to a malformed format, so after recompiling the Linux kernel, The Linux driver module needs to be recompiled . http://www.cnblogs.com/caoyutao/
Android Deep Explore--hal and driver development----The sixth chapter reading notes