Reading notes the sixth chapter

Source: Internet
Author: User

Sixth chapter
Linux drives work and access: Each driver is mapped to a file called a device file or driver file, which is stored in the/dev directory, which makes interacting with Linux drivers as easy as interacting with normal files.
To write a Linux driver:
1. Build Linux drive skeleton (load and unload Linux drivers): Basic skeleton is a C program file that specifies the Module_init and module_exit macros and specifies the two macros for both functions.
2. Registering and destroying device files: Create and remove device files using the Misc_register and Misc_deregister functions, respectively.
3, specify the information related to the drive.
4, specify the callback function.
5, write the business logic, the core part, realize the function.
6, write Makefile file, write a new Linux driver must have a makefile file.
7, compile the Linux driver, can be directly compiled into the kernel, or can be compiled separately as a module.
8, install and uninstall Linux drivers: If the driver is compiled into the kernel, as long as Linux uses the kernel, the driver will be automatically loaded. If the Linux driver is in a separate module, use the Insmod or modprobe command to load the driver module, and use the Rmmod command to unload the driver module.
Test method:
1. Use Ubuntu Linux test Drive.
2, on the Android simulator through the native C program test drive.
3, using the Android NDK test Drive.
4. Use Java code to directly manipulate the device files to test the driver.
5, using the s3c6410 Development Board test Drive. 6, the driver compiled into the kernel test.

Reading notes the sixth chapter

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.