由於 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》
評論