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 the complex, non-uniform interface of Linux drives .
resolved GP l copyright issue. Because linux kernel based on GPL protocol, and android based on apache Licence 2. 0, agreement. So google played a" crossing "that would have been in linux< Span style= "font-family: the song Body;" > The sensitive code in the drive moves up one level . So these sensitive code out of the GPL linux drive "There is no need for open source.
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.
Steps to write a Linux driver that supports HAL
Step 1 , write Linux Drivers
"Writing Linux drives " is nonsense from the show, but if you want to add HALto the Linux drive and want to protect sensitive data as much as possible. the code for the Linux Drive should be as concise as possible to put the 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. The SYM variable is module_info through the HAL. Service Library is defined in this interface by the ID positioning hallibrary the.
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. Service Library it can be normal. Linux Library , or it can be JNI Library.
Read "Android Deep Exploration (Volume 1) HAL and drive Development" some thoughts 09