- build android -- aosp document
- create new avd with the system image you build
- The Android Cuttlefish emulator : build aosp and run on cuttlefish (android emulator)
想要build aosp 在 emulator 跑,測試 user build 和 userdebug build 的差異。
然後..
先 clone source..
mkdir aosp && cd aosp repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r75 --depth=1 repo sync -c --no-tags --no-clone-bundle -j3超過 3 就會有 resource limiit error,其實最後還是用1。
中途出現一些 checkout error,把整個source code 刪除,留下 .repo 目錄,再 sync 一次就 OK
然後做 lunch,這個有點問題
source buile/envsetup.sh lunch出現一堆,但是都沒有類似說明的 x86_64,ref:how do I build android emulator from source 的說明。
有些 lunch target 本來就不會show,所以試試看
lunch sdk_phone64_x86_64-trunk_staging-user竟然 OK 了。-- 嘗試 userdebug, eng 也都 OK
把 printconfig列出來確認:
============================================ PLATFORM_VERSION_CODENAME=VanillaIceCream PLATFORM_VERSION=VanillaIceCream PRODUCT_INCLUDE_TAGS=com.android.mainline mainline_module_prebuilt_nightly TARGET_PRODUCT=sdk_phone64_x86_64 TARGET_BUILD_VARIANT=user TARGET_ARCH=x86_64 TARGET_ARCH_VARIANT=x86_64 TARGET_2ND_ARCH_VARIANT=x86_64 HOST_OS=linux HOST_OS_EXTRA=Linux-6.8.0-60-generic-x86_64-Ubuntu-24.04.2-LTS HOST_CROSS_OS=windows BUILD_ID=AP2A.240805.005.S4 OUT_DIR=out ============================================如果依照 ref 的說明
lunch aosp_cf_x86_64_only_phone-aosp_current-userdebug ... build/make/core/release_config.mk:145: error: No release config found for TARGET_RELEASE: aosp_current. Available releases are: ap2a next staging trunk trunk_food trunk_staging.依照error 說明把 aosp_current 改掉
lunch aosp_cf_x86_64_only_phone-trunk-user就可以了 (順便測試 user build 也 OK)
============================================ PLATFORM_VERSION_CODENAME=VanillaIceCream PLATFORM_VERSION=VanillaIceCream PRODUCT_INCLUDE_TAGS=com.android.mainline mainline_module_prebuilt_nightly TARGET_PRODUCT=aosp_cf_x86_64_only_phone TARGET_BUILD_VARIANT=user TARGET_ARCH=x86_64 TARGET_ARCH_VARIANT=silvermont HOST_OS=linux HOST_OS_EXTRA=Linux-6.8.0-60-generic-x86_64-Ubuntu-24.04.2-LTS HOST_CROSS_OS=windows BUILD_ID=AP2A.240805.005.S4 OUT_DIR=out ============================================cf 就是給 cuttlefish (android emulator name) 用的。
有時候 build 到最後會有Error,說 /dev/loop2 沒有,這是因為沒有 disk 權縣,加入 disk group 就可以了。
google 說以後都要用 AOSP-release 了。
加上用 android 14 的tag, cuttlefish ru 一下就 hang 住,拿 prebuild 的又OK。
查 prebuild 是Android-16,所以 follow aosp 說明...
repo init --partial-clone --no-use-superproject -b android-latest-release -u https://android.googlesource.com/platform/manifest repo sync -c -j3依照googlesource 說明
lunch aosp_cf_x86_64_only_phone-aosp_current-userdebug因為現在 lunch 都不會出現target 讓你選了。
然後就可以用 m 來 build.
ubuntu 24.04 會出現 mount error, ref: permission denied in mount (/):
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0或是增加這個檔案到系統,免得每次開機都要重新設:
$ cat /etc/sysctl.d/99-apparmor-unconfined.conf kernel.apparmor_restrict_unprivileged_unconfined=0 kernel.apparmor_restrict_unprivileged_userns=0 $sudo sysctl --system
沒有留言:
張貼留言