Posts Tagged ‘cross-compilcation’

How to Build and Run Android L 64-bit ARM in QEMU

August 23rd, 2014 41 comments

[Nov, 2014 Update: The method below does not seem to work anymore, but a 64-bit ARM emulator “emulator64-arm64” has now landed in AOSP, and updated instructions are available here].

Most people can’t afford Juno Cortex A57/A53 development board, and mobile processors based on the latest 64-bit ARM cores are only expected by early 2015. But thanks to a small team at Linaro, you can now build and run Android L 64-bit ARM in the latest version of QEMU that supports Aarch64. Alex Bennée, an engineer working for Linaro, wrote a blog post in Linaro’s Core Dump blog explaining the Android emulator is actually based on QEMU,  the differences compared to mainline QEMU, the work they’ve done on Android L at Linaro, and most importantly, provided the basic steps showing how to build and try Android L 64-bit ARM (ARMv8) in QEMU. I’ve just done that, but unfortunately, albeit the builds complete, I could not manage to start Android L in QEMU yet. [Update: working now]. If you want to give it a try, you’ll need a Linux PC, and patience, as it may take about one day to retrieve the source code, and build everything from source.


I’ve done all this in a computer running Ubuntu 14.04 with an AMD FX8350 processor and 16 GB RAM.

First, you’ll need to install an ARM 64-bit toolchain, some dependencies, and tools:

The next step is to cross-compile a Linux 3.10 kernel for Android:

There’s a bug include the current version of the toolchain in Ubuntu 14.04 ( which prevents the build to complete. You can either remove CONFIG_DEBUG_INFO=Y in arch/arm64/configs/ranchu_defconfig (I did that), or update your toolchain. Let’s complete the build:

Now you need to build the Android Open Source Project (AOSP). If you haven’t done so, you’ll have to install the repo tool:

Then get AOSP source code (master as below, or l-preview branch):

The last step can take a few hours depending on your internet connection to Google servers.
Now download and apply a patch made by Linaro:

Possibly configure git:

You need to apply a patch for qemu:

And build Android L for ARMv8:

The last step will again take a while. It took my machine 2 or 3 hours, and the total time was actually a bit more than than as my PC suffered two thermal shutdowns during the build, and I had to restart the build twice. The last time, I decided to underclock my CPU to 3.4 GHz, and the build went through.

The last step before running Android L is to build QEMU:

Builds should now all be successfully complete. We just need to create some symlinks helping to shorten qemu command line, start the ADB server, and run QEMU:

That’s the output I get:

So it’s quite possible there’s a problem with adb, but Google did not help, and I failed to go further. More detailed instructions will soon be posted in Linaro Wiki, so I may be able to find out where I made a mistake once it’s posted.

Finally, start vncviewer to access Android user’s interface:

Here’s a screenshot of the “About Device” menu in Android L 64-bit ARM running in QEMU.