赞
踩
flagstaff@flagstaff-pc:~/aosp_r.lns/.repo/manifests$ git branch -a
* default
remotes/m/android-11.0.0_r37 -> origin/android-11.0.0_r37
remotes/m/android-11.0.0_r38 -> origin/android-11.0.0_r38
flagstaff@flagstaff-pc:~/aosp_r.lns/.repo/manifests$ git remote show origin
....
Local branch configured for 'git pull':
default merges with remote android-11.0.0_r38
flagstaff@flagstaff-pc:~/aosp_r.lns$ source build/envsetup.sh flagstaff@flagstaff-pc:~/aosp_r.lns$ lunch 30 test/flagstaffTest/BoardConfig.mk:4: warning: "flagstaff BoardConfig.mk is included test/flagstaffTest/device.mk:11: warning: "flagstaff device.mk is included." ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=11 TARGET_PRODUCT=aosp_x86_64 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_ARCH=x86_64 TARGET_ARCH_VARIANT=x86_64 TARGET_2ND_ARCH=x86 TARGET_2ND_ARCH_VARIANT=x86_64 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.11.0-43-generic-x86_64-Ubuntu-20.04.2-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=RQ3A.210605.005 OUT_DIR=out PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl ============================================
不论出于什么目的基于AOSP进行功能开发都离不开编译、部署、运行这三步骤,对于这几个步骤Android则有其自己的一套的规则。每个模块则有专属的Android.mk、Android.bp来描述它的编译。在部署的时候会涉及是否打包到system/vendor/etc…,运行时Android则会检测将运行程序的sepolicy。为了将测试代码和AOSP代码隔离,测试代码的目录结构如下。
flagstaff@flagstaff-pc:~/aosp_r.lns/test/flagstaffTest$ tree
.
├── BoardConfig.mk
├── compatibility_matrix
├── device.mk
└── sepolicy
BoardConfig.mk
同AOSP的BoardConfig.mk,用于放置板级配置。其被包含于device.mk
flagstaff@flagstaff-pc:~/aosp_r.lns/test/flagstaffTest$ cat device.mk
#For my Test
//file ~/aosp_r.lns/test/flagstaffTest/device.mk
...
include test/flagstaffTest/BoardConfig.mk
...
device.mk
用于添加设备相关的配置信息,其被具体的产品所包含。测试时使用的lunch 30(x86_64),包含信息如下
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -63,6 +63,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
ifeq (aosp_x86_64,$(TARGET_PRODUCT))
$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
endif
+$(call inherit-product, test/flagstaffTest/device.mk)
compatibility_matrix
该目录用于包含兼容矩阵信息。其中文件的内容则用来描述framework请求vendor需要提供的组件信息,也被称为FCM,其组件图如下:
上图则引用自android的vintf 章节。
在编译时则需要使用位于Android编译系统的关键字添加,其内容位于device.mk中
file:device.mk
...
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE += \
test/flagstaffTest/compatibility_matrix/framework_compatibility_matrix.xml
...
sepolicy
用于添加sepolicy信息,sepolicy在Android4.4就被强制开启了,所以新增加的可执行程序/文件如果没有正确配置sepolicy,那么会被系统拒绝运行及访问。
flagstaff@flagstaff-pc:~/aosp_r.lns/test/flagstaffTest$ cat BoardConfig.mk
BOARD_VENDOR_SEPOLICY_DIRS += \
test/flagstaffTest/sepolicy
...
如果想详细了解作用及使用规则可以按官网的学习路线进行。
google_sepolicy_detail
另外如果有问题,欢迎留言或者email(836190520@qq.com)我,技术升级在于交流~~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。