Sixth. First Linux driver: Count the number of words

Source: Internet
Author: User

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

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.