Android Deep Exploration (Vol. 1) HAL and Driver Development chapter Sixth

Source: Internet
Author: User

the Linux system maps each driver into a single file. These files are called device files or drive files and are saved 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:

Step 1 : Build a linux driver skeleton (load and unload Linux drivers).

Step 2 : Register and unregister the device files.

Step 3 : Specify driver-related information.

Step 4 : Specify the callback function.

Step 5 : Write the business logic.

Step 6 : Write the Makefile file.

Step 7 : Compile the Linux driver.

Step 8 : Install and uninstall Linux drivers. ( the first 5 steps in step 8 above are about how to write a Linux driver, after 3 The Linux driver to work properly. )

InAndroidin the systemLinuxThe main users of the drive areAPKprogram. Therefore,Linuxwhen the driver is finished , it must be usedAPKprogram to be tested to illustrateLinuxThe driver can be used normally. Since the previous sectionAndroiduse on virtual machinesCthe executable program written by the language tests theLinuxDrive, so it's easy to think about the useANDROIDNDKto testLinuxDrive, due toAndroid NDKalso useC + +to write a program, so you can take advantage of the previous section'sClanguage code, of course, plus someANDROIDNDKunique code. When usingANDROIDNDKTestLinuxThere are two things to do before driving. (becauseLinuxThe drive module does not follow theAndroidthe system starts and loads, so you must performbuild.shscript File InstallationWord CountDrive. Cannot start using default modeAndroidemulator, and to use our own compiledLinuxKernel bootAndroidsimulation. )

Android Deep Exploration (Vol. 1) HAL and Driver Development chapter Sixth

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.