"Android Deep Exploration" sixth chapter experience

Source: Internet
Author: User

The sixth chapter is about the first Linux driver: Count the number of words.

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.

1. To write a Linux driver: Step 1th: Build a Linux driver skeleton (load and unload Linux drivers), which are specified with Module_init and module_exit macros, and step 2nd: Register and unregister device files using MISC_ respectively Register and Misc_deresiger functions to create and remove device files; 3rd step: Specify driver-related information through Module_author, Module_license, Module_alias, Module_ Description and other macros can specify driver-related information; 4th: Specify the callback function, a driver does not have to specify all the callback functions, the return function will be registered through the relevant mechanism; Step 5th: Write the business logic; step 6th: Write the Makefile file Step 7th: Compile the Linux driver; step 8th: Install and uninstall Linux drivers. 2. Test Linux drive: Test Linux drivers with Ubuntu Linux, test Linux drivers using the Android NDK, and use Java code to directly manipulate the device files for Linux drivers, Test the Linux driver by running an executable program on the S3C6410 board and compiling the driver into the kernel for testing. 3. Developing Linux drivers in Eclipse: 1th step: Build C Project, 2nd step: Establish C source code file link, 3rd step: set include path; 4th step: Compile Linux driver. 4. Test Linux driver in Eclipse: 1th step: Import test_word_count.c file, 2nd step: Set include path, 3rd step: Set Target, 4th step: Build Project, 5th step: Run test program.

"Android Deep Exploration" sixth chapter experience

Related Article

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.