Search code examples
androidandroid-emulatorandroid-sourceandroid-build

How to run an Android 10 system image built by myself on emulators?


I follow the Android doc to build an AOSP (Android 10).

source build/envsetup.sh
lunch aosp_x86-eng
m -j32

Once building successfully, I use the emulator command to test if the built image can run. On my server running CentOS 8 Stream, the emulator can launch successfully and everything looks good.

However, when I try to move the built system image to my MacBook, the emulator only shows a blank screen even after 5 minutes.

I used to build an Android 7 system image (see here). All I need to do is to move the system.img and ramdisk.img to my MacBook's SDK folder. But this does not work for Android 10.

What should I move (e.g., system.img, ramdisk.img, vendor.img, userdata.img...) to make the built AOSP running on my Mac's emulators?


Solution

  • After understanding more about AOSP build outputs (especially all the .imgs under out/target/product/generic_x86), here is what I did to load the self-built system image on Mac's emulators:

    1. Copy system-qemu.img to <android_sdk>/system-images/android-29/google_apis/x86 on the MacBook. Then rename system-qemu.img to system.img (You can delete the original system.img or just give it another name).
    2. Copy VerifiedBootParams.textproto to <android_sdk>/system-images/android-29/google_apis/x86 on the MacBook. Also remember to delete or rename the original one before copying. I guess it has something to do with vbmeta.img, which is used to verify system.img. Without this file, your emulators cannot launch because of verification failure. Refer here for more details.