0x00 Automotive
AOSP中提供了編譯不同產品的配置,如Phone,Automotive扇住,TV等。當有需要時霍骄,可以分別去編譯他們台囱。下面介紹編譯 編譯Automotive(Car)可能遇到的問題淡溯。
0x01 Lunch Error
AOSP編譯正常的流程為:
cd AOSP_ROOT_DIR
source build/envsetup.sh
lunch index or combo
當我們選擇編譯 Car(aosp_car_emu_x86_64-userdebug
or lunch 12
) 的時候读整,會報這樣的錯誤:
ttdevs@ttdevs-pc:~/AOSP$ lunch 12
build/core/product_config.mk:227: *** Can not locate config makefile for product "aosp_car_emu_x86". Stop.
ttdevs@ttdevs-pc:~/AOSP$
Google了一下,這是一個排版錯誤咱娶,直接將_emu
去掉即可米间,即 lunch aosp_car_x86_64-userdebug
强品,其他平臺類似。
下面簡單分析下這個問題屈糊。
ttdevs@ttdevs-pc:~/AOSP$ source build/envsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/generic/car/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/uml/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/google/muskie/vendorsetup.sh
including device/google/taimen/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including sdk/bash_completion/adb.bash
ttdevs@ttdevs-pc:~/AOSP$
根據上面日志的榛,我們看一下 device/generic/car/vendorsetup.sh
這個文件和其所在的目錄。
ttdevs@ttdevs-pc:~/AOSP/device/generic/car$ tree
.
|-- AndroidProducts.mk
|-- aosp_car_arm.mk
|-- aosp_car_arm64.mk
|-- aosp_car_x86.mk
|-- aosp_car_x86_64.mk
|-- common
| |-- android.hardware.dummy.xml
| |-- car.mk
| |-- car_core_hardware.xml
| |-- config.ini
| |-- manifest.xml
| `-- sepolicy
| |-- file_contexts
| |-- hal_vehicle_hwservice.te
| |-- hwservice.te
| |-- hwservice_contexts
| `-- system_app.te
`-- vendorsetup.sh
2 directories, 16 files
ttdevs@ttdevs-pc:~/AOSP/device/generic/car$
在 vendorsetup.sh
中逻锐,我們看到添加了四個 combo
夫晌,都是帶 emu
的。在 AndroidProducts.mk
中可以看到分別加載了對應的四個 make
文件昧诱,這里以 aosp_car_x86_64.mk
為例:
$(call inherit-product, device/generic/car/common/car.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86_64.mk)
PRODUCT_NAME := aosp_car_x86_64
PRODUCT_DEVICE := generic_x86_64
PRODUCT_BRAND := Android
PRODUCT_MODEL := Car on x86_64 emulator
PRODUCT_NAME
為 aosp_car_x86_64
并不是 aosp_car_emu_x86_64
晓淀。當我們執(zhí)行 lunch aosp_car_emu_x86_64-userdebug
時,系統(tǒng)會去查找 aosp_car_emu_x86_64
這個 PRODUCT盏档,找不到就報錯了(別問我為什么是這個邏輯凶掰,我也說不清楚,RFSC)蜈亩。至此懦窘,我們知道為什么刪除 _emu
就可以了。為了驗證這個邏輯稚配,還可以選擇下面的兩個方案來解決這個問題:
-
/home/ttdevs/AOSP/device/generic/car/aosp_car_x86_64.mk
PRODUCT_NAME 改為:
PRODUCT_NAME := aosp_car_emu_x86_64
-
/home/ttdevs/AOSP/device/generic/car/vendorsetup.sh
添加:
add_lunch_combo aosp_car_x86_64-userdebug
大家可以嘗試一下畅涂,這兩種方法都可以。
0x02 Build Error
當上一個問題解決后药有,我們就可以開始編譯了毅戈。很不幸,很快又會遇到另個問題:
Target buildinfo from: build/target/board/generic_x86_64/system.prop
error: ro.build.fingerprint cannot exceed 91 bytes: Android/aosp_car_x86_64/generic_x86_64:8.1.0/OPM6.171019.030.B1/ttdevs07021613:userdebug/test-keys (98)
[ 9% 7975/83700] Build hyb out/target/product/generic...b <- external/hyphenation-patterns/hu//hyph-hu.pat.txt
21515 unique nodes, 102669 total
ninja: build stopped: subcommand failed.
16:18:07 ninja failed with: exit status 1
簡單搜索之后愤惰,Stackoverflow 給了我們答案苇经,make 參數增加 BUILD_FINGERPRINT="custom_name"
,即:
make -j12 BUILD_FINGERPRINT="custom_name"
經過漫長的等待宦言,我們就可以運行Car模擬器了~~
ulimit -S -n 2048