简体   繁体   English

在AOSP项目中,哪里可以找到Android HAL的实际实现源代码?

[英]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. 我开始从aosp项目中学习android os内部知识。 After reading about android HALs I was interested to look into some real implementation of HAL module which talks to the kernel drivers. 在阅读了有关android HAL的内容之后,我有兴趣研究了一些与内核驱动程序有关的HAL模块的实际实现。 What I find under android/hardware/interfaces are some kind of glue code. 我在android / hardware / interfaces下找到的是某种粘合代码。 This glue code must load the actual HAL module which may open some device and communicate with the real hardware. 此粘合代码必须加载实际的HAL模块,该模块可能会打开某些设备并与实际硬件通信。

So where to find the Actual implementation of the HALs that talk to the real hardware? 那么在哪里可以找到与真实硬件相关的HAL的实际实现呢?

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. 我基本上是在看图形堆栈,如果有人可以指出hwcomposer和gralloc的HAL实现,那就太好了。 Generic or open source ones which are used in android emulators. 在Android模拟器中使用的通用或开源代码。

I came to know from another forum that, its provided by OEMs. 我从另一个论坛得知,它是由OEM提供的。 But considering android emulators, I was hoping to find them under aosp somewhere. 但是考虑到Android模拟器,我希望在aosp下的某个地方找到它们。 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? 考虑到SOC供应商提供了一些HAL,并且同一HAL的还有开源版本(假设供应商hwcomposer和drm_hwcomposer)在哪里配置了,使用哪个?

Any resource link to understand the code flow of HALs would be also helpful. 任何了解HAL代码流的资源链接也将有所帮助。

So where to find the Actual implementation of the HALs that talk to the real hardware? 那么在哪里可以找到与真实硬件相关的HAL的实际实现呢?

HAL implementations have to be provided by the vendor/OEM. HAL实现必须由供应商/ 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. 对于大多数HAL而言,Android附带了一个虚拟实现,通常仅提供最低限度的标准来避免系统崩溃,这令人惊讶地很少。 I haven't checked all HALs though. 我还没有检查所有HAL。 You can find these dummy implementations in hardware/interfaces/<hal>/<version>/default . 您可以在hardware/interfaces/<hal>/<version>/default找到这些虚拟实现。 Sometimes they wrap implementations in the legacy HAL interface under hardware/libhardware . 有时,它们hardware/libhardware实现包装在旧的HAL接口下的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? 考虑到SOC供应商提供了一些HAL,并且同一HAL的还有开源版本(假设供应商hwcomposer和drm_hwcomposer)在哪里配置了,使用哪个?

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: 必须在设备清单(例如device/<vendor>/<board>/device.mk )中配置将要包含在设备中的HAL实现:

PRODUCT_PACKAGES += hwcomposer.<vendor>

Any resource link to understand the code flow of HALs would be also helpful. 任何了解HAL代码流的资源链接也将有所帮助。

A good resource is the official documentation at https://source.android.com/devices/architecture/hidl . 一个很好的资源是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 . 由于Android几乎更改了与Android 8有关的HAL界面的所有内容,因此可以通过搜索有关Treble文章来找到更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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