2.1 General steps 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) write business logic;
6) Writing makefile files;
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.
2.2 To add the Word_count directory to the Linux kernel source tree
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/
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.
2.3 Linux Driver testing methods
1) Testing Linux drivers with Ubuntu Linux
2) test Linux drivers on the Android emulator via the original (Native) C program
3) Testing Linux drivers with the Android NDK
4) Use Java code to directly manipulate device files to test Linux drivers
5) test the Linux driver with the board:
Test Linux drivers on the board using an executable program
Used on the Development Board. Android NDK Test Linux Driver
Test Linux drivers on the development Board using Java code
6) Compile the driver into the Linux kernel for testing
1th step: Put the source file file into the Linux kernel source code
2nd Step: Modify the Kconfig file
3rd Step: Modify the Makefile file
4th step: Set the. config file
5th step: Compiling the Linux kernel
Sixth reading notes