2
votes

I am able to compile AOSP + binaries and flash my Nexus 5 device. I then realized that it would probably be more practical to make my changes and run these builds on the emulator first to sanity check what I'm doing (I use my Nexus 5 as my main phone).

I've tried running the emulator by typing "emulator" after the build. I get the following error:

ko:Invalid cache partition image type: yaffs2 (expected ext4)

I created a Nexus 5 AVD in Android studio and confirmed that ANDROID_PRODUCT_OUT is pointing to /out/target/product/hammerhead, then I tried the following from the /out/target/product/hammerhead directory:

emulator -avd Nexus_5_API_21 -kernel ~/android-5.0.1_r1/prebuilts/qemu-kernel/x86/kernel-qemu -system ./system.img -ramdisk ./ramdisk.img -data ./userdata-qemu.img

The emulator appears to start up, but I see nothing.

Another piece of information that might help is that when I run the command "android list" I see the following:

Available Android targets: Available Android Virtual Devices:

The following Android Virtual Devices could not be loaded:
    Name: Nexus_5_API_21
    Path: ~/.android/avd/Nexus_5_API_21.avd
   Error: Unknown target 'android-21' in /home/julio/.android/avd/Nexus_5_API_21.ini

It doesn't seem to like the target android-21, and there doesn't seem to be any targets defined at all.

Anyway, does anyone know how to get this working? I want to avoid having to constantly flash my phone.

Thanks

1
Have you tried to run this .avd with standard images? Maybe your emulator is not up-to-date? - Alex Cohn
I've compiled some of the other images like aosp-x86-eng and mini-emulator_x86-userdebug. Both of which I was able to boot with the emulator by entering "emulator" with no options right after the build completed. - Andi Jay

1 Answers

0
votes

Building for emulator and real devices are different things. In order to build AOSP for an emulator, you do not need to download any additional binaries. You should only select appropriate targets in lunch command. You can choose among the following targets:

  • aosp_arm
  • aosp_x86
  • aosp_x86_64
  • etc.

These targets build images to run on different processors architectures (arm, x86, x86-64, etc.).

You can also select different variants (user, userdebug, eng). The details of these variants of builds are explained here.