The Linux system maps each driver into a single file, which is called a device file or driver file, and is stored in the/dev directory. Since most Linux drivers have their corresponding device files, exchanging data with the Linux driver becomes the exchange of data with the device files.
To write a Linux driver: The first step is to build the Linux driver skeleton (load and unload Linux drivers); second, register and unregister the device files; The third step, specify the information related to the driver; fourth, specify the callback function, fifth step, write the business logic, sixth step, Write the makefile file, seventh step, compile the Linux driver, step eighth, install and uninstall the Linux driver.
. config: This file is located in the top-level directory of the Linux kernel source code and is a hidden file that is used to configure modules in the Linux kernel.
Kconfig: This file is primarily used to define the menu that the make Menuconfig command displays, and in addition to importing Kconfig files located in other directories.
Makefile: Typically appears with the Kconfig file, which specifies how to compile the source code where the Makefile file resides.
To compile the driver into the Linux kernel for testing: The first step is to put the. c file into the Linux kernel source code; The second step is to modify the Kconfig file; The third step is to modify the makefile file; Fourth step, set the. config file, and fifth step, compile the Linux kernel.
To develop a Linux driver using eclipse: The first step is to build C project; The second step is to establish a C source code file link; The third step is to set the include path; fourth step, compile the Linux driver. Steps to test: The first step is to import. c files; The second step is to set the include path; the third step is to set the target; Fourth step, build project, fifth step, run the test program.
Android Deep Explore Sixth chapter summary