About e-con Systems™
e-con Systems™, a pioneer in building embedded products has proven expertise in taking Android based products to the market. e-con Systems™ has been working on Android for over 7 years now. e-con has done extensive work on the Android internals and our embedded engineers have an in-depth system level understanding.
- Android HAL [Hardware Abstraction Layer] (in abstract) bridges the gap between hardware and software.
- Android application/framework communicates with the underlying hardware through Java APIs not by system calls.
- But the Linux has the ability to handle only systems calls from application.
- Thus we need a glue layer between the android framework and linux system.
- Android HAL allows the Android application/framework to communicate with the hardware specific device drivers.
- For Android application, HAL provides API’s through which service can place a request to device.
- And HAL uses functions provided by the lower layer Linux system to serive the request from the android framework.
- HAL is a c/c++ layer which is a vendor specific implementation.
- There are two different types of Android HAL architecture:
- First one is the legacy Android HAL which looks similar to library implementation.
- Second one gives the complete abstraction and control over the device vendor.
- Android HAL implementation looks similar to a Linux device driver. (Since LDD is a HAL for Linux)
- Most of the Vendor specific implementations can be done in Android HAL rather than the driver. So that license difference between the driver (Open source license GPL) and the HAL (Apache License) will give more level of abstraction to vendor.
- HAL has structures which specify the HAL type, Module type, version detail, and a set of function callbacks (methods) which are registered to android framework layer.
- For example if a service from android framework needs data from a sensor device, the service will make a call to corresponding function in sensor HAL which in turn will talks directly with Linux device driver.
- The driver will trigger the sensor driver and deliver the data back to the HAL so it can be passed back to Android application.
- The HAL module is compiled into a shared object that is dynamically loaded at runtime when needed.
About Device Driver
- Device driver is a piece of software which will drive hardware.
- Linux has predefined system calls which can be used by the user space application to perform the operation on hardware.
- The part of code which is capable of implementing system call to hardware specific operation is called device driver.
What’s in the Android kernel Patches?
- Android developers found some limitation in the Linux kernel. They patched the linux kernel to make it more powerful for android.
- Main areas where they patches are in security, networking, IPC, Power management.
Android device drivers
- Device drivers written for Android hardware platforms can not get merged into the main kernel tree because they have dependencies on code that only lives in Google’s kernel tree, causing it to fail to build in the kernel.org tree.
- Linux device drivers will also work on android but it will lack some functionality which is specific to android.
Android Specific Device Drivers
Device drivers related to android which are integrated with Linux staging folder are:
- Low Memory Killer: Kills processes as available memory becomes low.
- Ashmem: It provides a means for the kernel to reclaim these shared memory blocks if they are not currently in use.
Some of the device drivers which are specific to android and are not merged with linux are as follows:
- Binder: IPC communication between process in android
- Early suspend: Android power management on top of Linux power management.
- Wakelocks: Applications can hold wakelocks to prevent system from sleeping. Once wakelocks are released cpu and peripherals may sleep.
- Paranoid Networking: Mechanism to restrict network I/O to certain processes based on process group.
- Logger: Android logging mechanism.
- Ram_console: used to save kernel printk messages to buffer in RAM, so that for next boot after kernel panic they can be viewed in the next kernel invocation.
- Adb gadget driver: A protocol that runs over a USB link between a Android hardware and a desktop PC.
- Pmem: Physically contiguous regions of memory shared between userspace and kernel drivers.
- Alarm Timer