简体   繁体   中英

Where can I find source code of actual implementation of Android HALs in AOSP project?

I am starting to learn android os internals a bit from aosp project. After reading about android HALs I was interested to look into some real implementation of HAL module which talks to the kernel drivers. What I find under android/hardware/interfaces are some kind of glue code. This glue code must load the actual HAL module which may open some device and communicate with the real hardware.

So where to find the Actual implementation of the HALs that talk to the real hardware?

I am basically looking at the graphics stack and it would be nice if someone can point be to the HAL implementations of hwcomposer and gralloc. Generic or open source ones which are used in android emulators.

I came to know from another forum that, its provided by OEMs. But considering android emulators, I was hoping to find them under aosp somewhere. At least for some generic components.

Considering SOC vendors provide some HALs and there is also open source version of the same HAL (lets say vendor hwcomposer and drm_hwcomposer) where is this configured, which one to use?

Any resource link to understand the code flow of HALs would be also helpful.

So where to find the Actual implementation of the HALs that talk to the real hardware?

HAL implementations have to be provided by the vendor/OEM. This is where you would find the sources.

For most HALs, Android comes with a dummy implementation that typically only provides the bare minimum to avoid crashing the system, which is surprisingly little. I haven't checked all HALs though. You can find these dummy implementations in hardware/interfaces/<hal>/<version>/default . Sometimes they wrap implementations in the legacy HAL interface under hardware/libhardware . Your best chance to find real hardware/kernel access is there. However, these implementations might be outdated and not in use anymore.

Considering SOC vendors provide some HALs and there is also open source version of the same HAL (lets say vendor hwcomposer and drm_hwcomposer) where is this configured, which one to use?

The HAL implementation that is going to be included in a device has to be configured in the device manifest (eg device/<vendor>/<board>/device.mk ) like this:

PRODUCT_PACKAGES += hwcomposer.<vendor>

Any resource link to understand the code flow of HALs would be also helpful.

A good resource is the official documentation at https://source.android.com/devices/architecture/hidl .

Since Android changed almost everything about the HAL interface with Android 8 you can find additional information by searching for articles discussing Treble .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM