HAL is a set of libraries built on Linux drivers. This library is not part of the Linux kernel, but rather belongs to the application layer on top of the Linux kernel layer. Google adds HAL 's main purpose to Android In addition to avoiding direct application access Linux Drivers, there is another important reason, that is to protect "private property."
Google for abdroid to join HAL mainly for the following purposes:
Debug interface for Unified hardware.
Fixed the GPL copyright issue.
For some special requirements.
To write a Linux driver that supports HAL
First step: Writing Linux Drivers
Step two: Write HAL libray
Step three: Writing the Server libary
steps and principles for writing HAL modules
First step: defining structs and macros
Describes the hw_module_t structure of the HAL module
Describes the hw_device_t structure of a HAL device
hw_module_methods_t structure describing the module entry function
Step two: Write the HAL module's open function
Initialize the hw_device_t of a struct
Open the device file
Initializing registers
Step three: Define hw_module_methods_t structure variables
Fourth Step: Define the hal_module_info_sym variable
Fifth step: Write the close function of the HAL module
Sixth step: Write the function that controls the LED
Experience: There are two ways to use Linux drivers in Android. One is to interact directly with Linux drivers in a traditional way. The other is Android-specific, which is through the HAL module. The HAL module essentially interacts with the Linux driver through a Linux shared library, and then the application accesses the Linux shared library.
My blog address: http://home.cnblogs.com/u/jie617530/
Andriod Deep Exploration of-hal and Driver Development Nineth Chapter reading notes and a little experience