由于 NXP 的代码迁移到 github 网站上,大部分旧的环境搭建文档都已经过时,Android Automotive 12 的文档也是如此,故此本文介绍如何搭建 i.MX8 Android Automotive12 Trusty OS 环境。
2. Ubuntu 16.04 环境配置
① 安装多种软件命令如下所示:
$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo apt-get install lzop
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools
$ sudo apt-get install mtd-utils
$ sudo apt-get install android-tools-fsutils
$ sudo apt-get install device-tree-compiler
$ sudo apt-get install gdisk
$ sudo apt-get install liblz4-tool
$ sudo apt-get install m4
$ sudo apt-get install libz-dev
$ sudo apt-get install bison
$ sudo apt-get install flex
$ sudo apt-get install libssl-dev
$ sudo apt-get install gcc-multilib
② Repo 安装和初始化
$ mkdir ~/bin
$ curl curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
$ chmod a+x ~/bin/repo
③ 更新
repo 的运行过程中会尝试访问官方的 git 源更新自己,使用 tuna 的镜像源进行更新,把下面内容复制到你的 ~/.bashrc 里:
export PATH=~/bin:$PATH
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
④ git 初始化
$ sudo apt-get install git
$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ git config --list
3. 搭建 trusty os 环境
① 创建目录并进入:
$ mkdir imx-trusty-os
$ cd imx-trusty-os
② repo init
修改 imx-trusty-os/.repo/manifests 目录下的 aosp-trusty-automotive-12.0.0_1.1.0.xml 文件,谷歌源更换为 tuna 源,如下所示:
<manifest>
<remote name="aosp"
fetch="https://aosp.tuna.tsinghua.edu.cn"
review="https://android-review.googlesource.com/" />
<default remote="aosp"
sync-j="4" />
修改 imx-trusty-automotive-12.0.0_1.1.0.xml 文件,更换各个资源的下载路径,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<include name="aosp-trusty-automotive-12.0.0_1.1.0.xml"/>
<remote name="aosp-imx"
fetch="https://github.com/nxp-imx-android"
review="" />
<!-- BEGIN trusty core projects -->
<project path="external/lk" name="aosp_trusty_lk_common" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0">
<copyfile src="makefile" dest="makefile" />
</project>
<project path="trusty/kernel" name="aosp_trusty_lk_trusty" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/user/app/avb" name="aosp_trusty_app_avb" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/user/app/gatekeeper" name="aosp_trusty_app_gatekeeper" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/user/app/keymaster" name="aosp_trusty_app_keymaster" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/user/app/storage" name="aosp_trusty_app_storage" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/user/app/confirmationui" name="aosp_trusty_app_confirmationui" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/user/base" name="aosp_trusty_lib" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<!-- END trusty core projects -->
<!-- BEGIN platform projects -->
<project path="system/keymaster" name="aosp_platform_system_keymaster" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="hardware/libhardware" name="aosp_platform_hardware_libhardware" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<!-- <project path="system/teeui" name="aosp_platform_system_teeui" remote="imx-android" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/> -->
<!-- END platform projects -->
<!-- BEGIN trusty nxp projects -->
<project path="trusty/device/nxp/imx8" name="aosp_trusty_device_nxp_imx8m" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<project path="trusty/hardware/nxp" name="aosp_trusty_lk_nxp" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0"/>
<!-- END trusty nxp projects -->
<!-- BEGIN trusty vendor projects -->
<project path="trusty/vendor/google/aosp" name="aosp_trusty_vendor_google_aosp" groups="trusty" remote="aosp-imx" revision="refs/tags/trusty-automotive-12.0.0_1.1.0">
<!-- Install lk_inc.mk into trusty root -->
<copyfile src="lk_inc.mk" dest="lk_inc.mk" />
</project>
<!-- END trusty vendor projects -->
</manifest>
③ 拉取代码:
$ repo sync
④ 编译并拷贝固件:
$ source trusty/vendor/google/aosp/scripts/envsetup.sh
$ make imx8qxp #i.MX 8QuadXPlus MEK
$ cp ${TRUSTY_REPO_ROOT}/build-imx8qxp/lk.bin ${MY_ANDROID}/vendor/nxp/fsl-proprietary/uboot-firmware/
imx8q_car/tee-imx8qx.bin
以上是 i.MX8 Android Automotive12 Trusty OS 环境搭建流程
参考文献
《i.MX_Android_Security_User's_Guide.pdf》
评论