Android车机DIY开发之软件篇(十一) NXP AutomotiveOS编译
Google 在汽车上也提供了用于汽车的 Google 汽车服务(GAS,Google Automotive Service),包含有 Google 地图、应用市场、Google 汽车助理等等。Google 汽车服务同样没有开源,而是以软件包的形式提供给制造商。 目前国内汽车搭载的 Android 系统都是在标准的 Android Automotive OS 基础上对架构重新进行了定制及应用的本地化适配。
SystemUI 位置 /frameworks/base/packages/SystemUI
CarSystemUI 位置 packages/apps/Car/SystemUI
CarLuncher 位置packages/apps/Car/Launcher
CarServices 位置packages/services/Car/service
CarAPI 位置packages/Car/car-lib car-support-lib
编译镜像文件位置 device/generic/car/XXX.mk
Android Studio for Platform
1. 下载地址
nxp下载地址
解压automotive-14.0.0_2.1.0.tar.gz 到 ~/.
2.在HOME执行
sudo rm -rf /usr/bin/python
sudo ln -s /usr/bin/python2 /usr/bin/python
git config --global user.name “赵川”
git config --global user.email"zc1508890767@gmail.com"
sudo apt-get install libqt5x11extras5
sudo dpkg -i nekoray-3.26-2023-12-09-debian-x64.deb
设置代理
git config --global http.proxy http://127.0.0.1:2081
git config --global https.proxy https://127.0.0.1:2081
ubuntu浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录,按网页上指示运行
谷歌镜像
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=${PATH}:~/bin
source ~/imx-automotive-14.0.0_2.1.0/imx_android_setup.sh
mkdir ~/bin
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=${PATH}:~/bin
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
source ~/imx-automotive-12.0.0_1.1/imx_android_setup.sh
基于清华大学镜像服务器,修改 android_build/.repo/manifests/ 目录下 .xml 文件,如下所示:
fetch="https://android.googlesource.com/"改为
fetch="https://aosp.tuna.tsinghua.edu.cn"
review="https://android-review.googlesource.com/"/>
<defaultrevision="refs/tags/android-14.0.0.2.1.0"
上面这条命令会执行很长时间~~~~~~
下载A内核交叉编译工具链
[下载网页](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads/12-3-rel1)
AArch32 arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz
AArch64 arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz
AArch32 :
```bash
sudo tar -xvJf arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz -C /opt
export AARCH32_GCC_CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-
```
AArch64:
```bash
sudo tar -xvJf arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz -C /opt
export AARCH64_GCC_CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
```
运行:
```bash
ubuntu浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录,按网页上指示运行
sudo git clone -b main-kernel-build-2024 --single-branch --depth 1 https://
android.googlesource.com/platform/prebuilts/clang/host/linux-x86 /opt/prebuilt-android-clang
或者使用国内镜像
sudo git clone -b main-kernel-build-2024 --single-branch --depth 1 https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/prebuilts/clang/host/linux-x86 /opt/prebuilt-android-clang
cd /opt/prebuilt-android-clang
sudo git fetch origin 3bd47139ac0e3593d4707ac0eeb2d45aa7411b67
sudo git checkout 3bd47139ac0e3593d4707ac0eeb2d45aa7411b67
export CLANG_PATH=/opt/prebuilt-android-clang
export LIBCLANG_PATH=/opt/prebuilt-android-clang/clang-r510928/lib
```
cd 源码根目录
```bash
sudo git clone -b main-kernel-build-2024 --single-branch --depth 1 https://
android.googlesource.com/kernel/prebuilts/build-tools /opt/prebuilt-android-kernel-build-tools
或者使用国内镜像
sudo git clone -b main-kernel-build-2024 --single-branch --depth 1 https://
mirrors.tuna.tsinghua.edu.cn/git/AOSP/kernel/prebuilts/build-tools /opt/prebuilt-android-kernel-build-tools
cd /opt/prebuilt-android-kernel-build-tools
sudo git fetch origin ae85d23af20f61220b114fc3f7bb6f77cc140365
sudo git checkout ae85d23af20f61220b114fc3f7bb6f77cc140365
export PATH=/opt/prebuilt-android-kernel-build-tools/linux-x86/bin:$PATH
```
将以下写入/etc/profile
```bash
export AARCH32_GCC_CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-
export AARCH64_GCC_CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
export CLANG_PATH=/opt/prebuilt-android-clang
export LIBCLANG_PATH=/opt/prebuilt-android-clang/clang-r510928/lib
export PATH=/opt/prebuilt-android-kernel-build-tools/linux-x86/bin:$PATH
```
source /etc/profile
下载Arm Cortex-M4内核交叉编译工具链gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
[下载网页](https://developer.arm.com/downloads/-/gnu-rm)
```bash
sudo tar -jxvf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 -C /opt
export ARMGCC_DIR=/opt/gcc-arm-none-eabi-7-2018-q2-update
```
将以下写入/etc/profile
```bash
export ARMGCC_DIR=/opt/gcc-arm-none-eabi-7-2018-q2-update
```
source /etc/profile
更新CMake version 到 3.13.0
```bash
wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz
tar -xzvf cmake-3.13.2.tar.gz; cd cmake-3.13.2;
sudo ./bootstrap
sudo make
sudo make install
```
## 3.编译
sudo apt-get install libelf-dev
source build/envsetup.sh
开发板选择 lunch mek_8q_car-trunk_staging-userdebug
模拟器选择 lunch 114
emulator -wipe-data
### 全编译
./imx-make.sh -j1 2>&1 | tee build-log.txt
./imx-make.sh -j4 2>&1 | tee build-log.txt
### 单编译U-Boot
```bash
./imx-make.sh bootloader -j4
```
### 单编译kernel
```bash
./imx-make.sh kernel -j4
```
### 单编译boot.img
```bash
./imx-make.sh bootimage -j4
```
### 单编译dtbo.img
```bash
./imx-make.sh dtboimage -j4
```
1. aosp_arm-trunk_staging-eng
2. aosp_arm64-trunk_staging-eng
3. aosp_barbet-trunk_staging-userdebug
4. aosp_bluejay-trunk_staging-userdebug
5. aosp_bluejay_car-trunk_staging-userdebug
6. aosp_bramble-trunk_staging-userdebug
7. aosp_bramble_car-trunk_staging-userdebug
8. aosp_cf_arm64_auto-trunk_staging-userdebug
9. aosp_cf_arm64_phone-trunk_staging-userdebug
10. aosp_cf_riscv64_phone-trunk_staging-userdebug
11. aosp_cf_x86_64_auto-trunk_staging-userdebug
12. aosp_cf_x86_64_auto_mdnd-trunk_staging-userdebug
13. aosp_cf_x86_64_foldable-trunk_staging-userdebug
14. aosp_cf_x86_64_only_phone_hsum-trunk_staging-userdebug
15. aosp_cf_x86_64_pc-trunk_staging-userdebug
16. aosp_cf_x86_64_phone-trunk_staging-userdebug
17. aosp_cf_x86_64_tv-trunk_staging-userdebug
18. aosp_cf_x86_phone-trunk_staging-userdebug
19. aosp_cf_x86_tv-trunk_staging-userdebug
20. aosp_cheetah-trunk_staging-userdebug
21. aosp_cheetah_car-trunk_staging-userdebug
22. aosp_cheetah_hwasan-trunk_staging-userdebug
23. aosp_cloudripper-trunk_staging-userdebug
24. aosp_coral-trunk_staging-userdebug
25. aosp_felix-trunk_staging-userdebug
26. aosp_flame-trunk_staging-userdebug
27. aosp_husky-trunk_staging-userdebug
28. aosp_lynx-trunk_staging-userdebug
29. aosp_oriole-trunk_staging-userdebug
30. aosp_oriole_car-trunk_staging-userdebug
31. aosp_panther-trunk_staging-userdebug
32. aosp_panther_car-trunk_staging-userdebug
33. aosp_panther_hwasan-trunk_staging-userdebug
34. aosp_raven-trunk_staging-userdebug
35. aosp_raven_car-trunk_staging-userdebug
36. aosp_ravenclaw-trunk_staging-userdebug
37. aosp_redfin-trunk_staging-userdebug
38. aosp_redfin_car-trunk_staging-userdebug
39. aosp_redfin_vf-trunk_staging-userdebug
40. aosp_ripcurrent-trunk_staging-userdebug
41. aosp_shiba-trunk_staging-userdebug
42. aosp_slider-trunk_staging-userdebug
43. aosp_sunfish-trunk_staging-userdebug
44. aosp_sunfish_car-trunk_staging-userdebug
45. aosp_tangorpro-trunk_staging-userdebug
46. aosp_tangorpro_car-trunk_staging-userdebug
47. aosp_trout_arm64-trunk_staging-userdebug
48. aosp_trout_x86_64-trunk_staging-userdebug
49. aosp_whitefin-trunk_staging-userdebug
50. aosp_x86-trunk_staging-eng
51. aosp_x86_64-trunk_staging-eng
52. arm_krait-trunk_staging-eng
53. arm_v7_v8-trunk_staging-eng
54. armv8-trunk_staging-eng
55. armv8_cortex_a55-trunk_staging-eng
56. armv8_kryo385-trunk_staging-eng
57. db845c-trunk_staging-userdebug
58. evk_6sl-user
59. evk_6sl-userdebug
60. evk_7ulp-user
61. evk_7ulp-userdebug
62. evk_7ulp_revb-user
63. evk_7ulp_revb-userdebug
64. evk_8mm-trunk_staging-user
65. evk_8mm-trunk_staging-userdebug
66. evk_8mn-trunk_staging-user
67. evk_8mn-trunk_staging-userdebug
68. evk_8mp-trunk_staging-user
69. evk_8mp-trunk_staging-userdebug
70. evk_8mq-trunk_staging-user
71. evk_8mq-trunk_staging-userdebug
72. evk_8ulp-trunk_staging-user
73. evk_8ulp-trunk_staging-userdebug
74. evk_93-trunk_staging-user
75. evk_93-trunk_staging-userdebug
76. evk_95-trunk_staging-user
77. evk_95-trunk_staging-userdebug
78. evk_95_car-trunk_staging-user
79. evk_95_car-trunk_staging-userdebug
80. evk_95_car2-trunk_staging-user
81. evk_95_car2-trunk_staging-userdebug
82. gsi_car_arm64-trunk_staging-userdebug
83. gsi_car_x86_64-trunk_staging-userdebug
84. hikey-trunk_staging-userdebug
85. hikey64_only-trunk_staging-userdebug
86. hikey960-trunk_staging-userdebug
87. hikey960_tv-trunk_staging-userdebug
88. hikey_tv-trunk_staging-userdebug
89. mek_8q-trunk_staging-user
90. mek_8q-trunk_staging-userdebug
91. mek_8q_car-trunk_staging-user
92. mek_8q_car-trunk_staging-userdebug
93. mek_8q_car2-trunk_staging-user
94. mek_8q_car2-trunk_staging-userdebug
95. poplar-trunk_staging-eng
96. poplar-trunk_staging-user
97. poplar-trunk_staging-userdebug
98. qemu_trusty_arm64-trunk_staging-userdebug
99. rb5-trunk_staging-userdebug
100. riscv64-trunk_staging-eng
101. sabreauto_6q-user
102. sabreauto_6q-userdebug
103. sabresd_6dq-user
104. sabresd_6dq-userdebug
105. sabresd_6dq_car-user
106. sabresd_6dq_car-userdebug
107. sabresd_6sx-user
108. sabresd_6sx-userdebug
109. sabresd_7d-user
110. sabresd_7d-userdebug
111. sdk_car_arm64-trunk_staging-userdebug
112. sdk_car_md_x86_64-trunk_staging-userdebug
113. sdk_car_portrait_x86_64-trunk_staging-userdebug
114. sdk_car_x86_64-trunk_staging-userdebug
115. silvermont-trunk_staging-eng
116. uml-trunk_staging-userdebug
117. watch_8ulp-trunk_staging-user
118. watch_8ulp-trunk_staging-userdebug
119. yukawa-trunk_staging-userdebug
120. yukawa_sei510-trunk_staging-userdebug
编译选项
| mek_8q_car-trunk_staginguserdebug | i.MX 8QuadXPlus/8QuadMax MEK Board with the EVSfunction enabled on the Arm Cortex-M4 CPU core|
|--|--|
| mek_8q_car2-trunk_staginguserdebug | i.MX 8QuadMax/8QuadXPlus MEK Board with the EVS function enabled on the Arm Cortex-A CPU cores (Power mode switch demo is running on the Cortex-M4 core in thisconfiguration) |
|--|--|
## 4.下载到nxp开发板
[uuu下载地址](https://github.com/nxp-imx/mfgtools/releases)