This chapter is going to be the most exciting moment, in order to be a reader in the beginning to learn the Linux driver development is full of expectations, not only provide HelloWorld program.
Let's start by describing what the Linux driver is all about, similar to the type of windows we've been exposed to before, but there's a big difference between how things work and how it works, and the Linux system maps each driver into a single file. These files become device files or the driver files that are saved in the/dev directory.
The next step is to write the Linux driver: The first step: Build the Linux driver skeleton, the Linux driver needs to provide two functions to handle the driver initialization and exit respectively. The two functions are specified with Module_init and Module_exit macros, and the second step is to register and unregister the device files, and to create and remove device files using the Misc_register and Misc_deregister functions respectively; step three: Specify driver-related information Fourth step: Specifying a callback function, a driver does not necessarily specify all callback functions. Fifth step: Write the business logic; step Sixth: Write the makefile file.
After you have prepared the above steps, you are going to write the first Linux driver: Count the number of words, it introduced in the introduction of the more complex, here are not mentioned, which introduced several protocols: Open source Agreement, GPL agreement, LGPL agreement, BSD protocol, Apache Licence 2.0 protocol , and the MIT Protocol.
Develop and test Linux drivers using eclipse: The first step: Build C project; Step two: Establish C source code file link; step three: Set the include path; Fourth step: Compiling the Linux driver.
Sixth. First Linux driver: Count the number of words