Google for Android to join Hal mainly for the following purposes.
The calling interface for unified hardware. Because Hal has a standard calling interface, HAL can be used to mask Linux to Drive complex, non-uniform interfaces.
GPL;" copyright issue. Because linux kernel based gpl agreement, and apache Licence 2.0, agreement. Therefore google played a" crossing ", will originally be located in Linuxlinux
For some special requirements. For some hardware, you may need to visit some user-space resources, or work that is inconvenient in the kernel space, and special needs. In these cases, the HAL code located in the user space can be used to assist the Linux driver in doing some work.
To write a Linux driver that supports HAL
Step 1, write Linux drivers
"Writing Linux drivers" is nonsense from the show, but if you want to add HAL to the Linux driver and want to protect sensitive data as much as possible. Linux- driven code should be as concise as possible to put business logic into the HAL Library .
Step 2 : Write HAL
The HAL library is an ordinary Linux library (*.so ) file. However, this type of library file has an interface. Implemented by the HAL Module_info SYM variable. The Service Library is positioned hallibrary by the ID defined in this interface .
Step 3 : Write the Service Library
Although this step is not required, the new HAL architecture requires us to do so. The Service Library is also a Linux library . This step is more flexible. The Service Library can be a generic Linux library, or it can be a JNI library.
Android Deep Explore--hal and Driver Development----The Nineth Chapter reading notes