Richard Hu
Richard Hu

Reputation: 891

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?

Upvotes: 1

Views: 2697

Answers (2)

Richard Hu
Richard Hu

Reputation: 891

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.

Upvotes: 1

Nate
Nate

Reputation: 161

The LineageOS wiki has instructions on exporting the compiled emulator images and running them independently in an Android Virtual Device.

They should still work for pure AOSP as well.

Essentially, you can run mka sdk_addon to build a .zip file that contains all the necessary images for running the build in an emulator.

Upvotes: 0

Related Questions