背景信息
本文只是基于作者自身的理解,对Android官方文档进行了中文翻译、其中会有部分内容不能达到信达雅的要求,请大家见谅和包含
原文请参考:https://source.android.com/devices/architecture/vndk/
Vendor Native Development Kit (VNDK)
The Vendor Native Development Kit (VNDK) is a set of libraries exclusively for vendors to implement their HALs. The VNDK ships in system.img and is dynamically linked to vendor code at runtime.
VNDK是一系列专为硬件厂商(第三方方案商)设计、用来实现硬件抽象层的库文件、VNDK被存放在system.img这个包中、在运行时被动态链接到三方代码。
为什么会选择VNDK
Android 8.0 and higher enables framework-only updates in which the system partition can be upgraded to the latest version while vendor partitions are left unchanged. This implies that binaries built at different times must be able to work with each other; VNDK covers API/ABI changes across Android releases.
Android8.0以及以上版本可以使得单独升级框架层(framework)成为可能、在这种升级方式中,系统分区被升级更新到最新版本、同时三方分区保持不变。这就意味着:不同时间编译生成的二进制文件可以正常工作;VNDK覆盖了API/ABI跨Android版本的变更。
Framework-only updates include the following challenges:
只升级Framework的方式需要面对如下挑战:
Dependency between framework modules and vendor modules. Before Android 8.0, modules from both sides could link with modules from the other side. However, dependencies from vendor modules imposed undesired restrictions to framework modules development.
框架层的模块和厂商模块之间的相互依赖:在Android8.0以前,框架和厂商两侧的模块可以相互链接、但是,来自厂商侧模块的依赖对框架层的模块开发强加了一些我们并不想要的限制
Extensions to AOSP libraries. Android 8.0 and higher requires all Android devices to pass CTS when the system partition is replaced with a standard Generic System Image (GSI). However, as vendors extend AOSP libraries to boost performance or to add extra functionalities for their HIDL implementations, flashing the system partition with a standard GSI might break a vendor's HIDL implementation. (For guidelines on preventing such breakages, seeVNDK extensions.)
AOSP库文件的扩展:Android8.0以及更高版本要求所有Android设备都必须要在替换Google提供的GSI之后仍然能够通过CTS测试,但是,由于厂商为了提升性能而会做出一些基于AOSP库的扩展、或者为厂商自己的HIDL增加了一些额外的功能、因而使用GSI来烧录系统分区会破坏厂商的HDIL实现。
To address these challenges, Android 8.0 introduces several techniques such as VNDK (described in this section), HIDL, hwbinder, device tree overlay, and sepolicy overlay.
VNDK资源
This section includes the following VNDK resources:
VNDK concepts (below) describes framework shared libraries, same-process HALs (SP-HALs), and VNDK terminology.
下面这些VNDK的概念描述了框架共享库、同进程的HAL和VNDK的术语
VNDK extensions classifies vendor-specific changes into categories. For example, libraries with extended functionalities on which vendor modules rely must be copied into the vendor partition, but ABI-incompatible changes are prohibited.
VNDK扩展将厂商特定的变更新划分成了几个类别。例如,厂商模块所以依赖的扩展库将被copy到vendor分区,但是ABI不兼容的变更是被禁止的
VNDK Build System Support describes the build system configurations and module definition syntaxes that are related to VNDK.
VNDK编译系统支持描述描述了VNDK编译系统配置和模块定义语法
The VNDK Definition Tool helps migrate your source tree to Android 8.0 and higher.
Linker Namespace provides fine-grained control over shared library linkages.
链接器命名空间提供了动态链接库的更加详细的控制逻辑
Directories, Rules, and sepolicy defines the directory structure for devices running Android 8.0 and higher, VNDK rules, and associated sepolicy.
The VNDK Design presentation illustrates fundamental VDNK concepts used in Android 8.0 and higher.