[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:
1 2 |
sudo apt-get install gcc-aarch64-linux-gnu build-essentials git bison zlib1g-dev \ libglib2.0-dev libpixman-1-dev gperf android-tools-adb vncviewer |
The next step is to cross-compile a Linux 3.10 kernel for Android:
1 2 3 4 |
mkdir -p ~/edev/linaro git clone https://git.linaro.org/people/christoffer.dall/linux-android.git cd linux-android git checkout ranchu-linaro-beta1 |
There’s a bug include the current version of the toolchain in Ubuntu 14.04 (https://bugs.launchpad.net/linaro-linux-baseline/+bug/1258013) 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:
1 2 |
ARCH=arm64 make ranchu_defconfig ARCH=arm64 make CROSS_COMPILE=aarch64-linux-gnu- -j8 |
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:
1 2 3 4 |
mkdir ~/bin PATH=~/bin:$PATH curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo |
Then get AOSP source code (master as below, or l-preview branch):
1 2 3 4 |
cd .. mkdir AOSP repo init -u https://android.googlesource.com/platform/manifest repo sync |
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:
1 2 |
wget http://people.linaro.org/~christoffer.dall/linaro-devices.tar.gz tar -xvf linaro-devices.tar.gz |
Possibly configure git:
1 2 |
git config --global user.email "name@email.com" git config --global user.name "Your Name" |
You need to apply a patch for qemu:
1 2 3 4 |
pushd system/core wget http://people.linaro.org/~alex.bennee/android/android-init-tweaks.diff patch -p1 < android-init-tweaks.diff popd |
And build Android L for ARMv8:
1 2 3 |
source build/envsetup.sh lunch ranchu-userdebug m -j8 |
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:
1 2 3 4 5 6 |
cd .. git clone https://git.linaro.org/people/peter.maydell/qemu-arm.git cd qemu-arm git checkout ranchu-linaro-beta1 ./configure make -j8 |
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:
1 2 3 4 5 6 7 8 9 10 11 |
cd .. ln -s linux-android/arch/arm64/boot/ ranchu-kernel ln -s AOSP/out/target/product/ranchu/ ranchu-build adb start-server ./qemu-arm/aarch64-softmmu/qemu-system-aarch64 -cpu cortex-a57 -machine type=ranchu -m 4096 \ -kernel ./ranchu-kernel/Image -append 'console=ttyAMA0,38400 keep_bootcon' -monitor stdio \ -initrd ranchu-build/ramdisk.img -drive index=2,id=userdata,file=ranchu-build/userdata.img \ -device virtio-blk-device,drive=userdata -device virtio-blk-device,drive=cache \ -drive index=1,id=cache,file=ranchu-build/cache.img -device virtio-blk-device,drive=system \ -drive index=0,id=system,file=ranchu-build/system.img -netdev user,id=mynet \ -device virtio-net-device,netdev=mynet -show-cursor |
That’s the output I get:
1 2 3 |
QEMU 2.0.50 monitor - type 'help' for more information console on port 5554, ADB on port 5555 VNC server running on `127.0.0.1:5900' |
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:
1 |
vncviewer 127.0.0.1:5900 |
Here’s a screenshot of the “About Device” menu in Android L 64-bit ARM running in QEMU.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
To change or remove CONFIG_DEBUG_INFO=Y before compiling the kernel
I needed to go into file “arch/arm64/configs/ranchu_defconfig”
@svarthol
Thanks. I’ve updated the post.
Let me know if you manage to start Android L.
I think your also missing the patch that links /dev/qemu_pipe to /dev/android_pipe in the Android build which is why adb isn’t starting.
@Alex Bennee
Thanks, I just wongly assumed it was part of the patched AOSP tree, but it is a separate patch then. However, when I follow https://android-review.googlesource.com/#/c/104722/, it asks me to login to gerrit (which I did), and then says
“Not Found
The page you requested was not found, or you do not have permission to view this page.”
Many apologies, it looks like the patches aren’t visible in draft form (and I don’t actually want to push them upstream yet). You can find a combined diff here: http://people.linaro.org/~alex.bennee/android/android-init-tweaks.diff
Seems the build is broken. I repo’d just the l-preview branch. I get fatal errors on building chromium.. exact error:
In file included from external/chromium/chrome/browser/autofill/personal_data_manager.h:24:0,
from external/chromium/android/autofill/profile_android.cc:28:
external/chromium/chrome/browser/webdata/web_data_service.h:27:52: fatal error: third_party/skia/include/core/SkBitmap.h: No such file or directory
#include “third_party/skia/include/core/SkBitmap.h”
^
ubuntu 13.10 for environment
@Alex Bennee
Thanks I’ve applied the patch in system/core, and build android again. But no luck, still the same error. I’ve updated the post in case somebody manages to get it working. I think I’ll just wait for the Wiki entry in Linaro.
Hi, is there a version of this for 32 bit ARMv7 SBCs running Linux like my Jetson TK1 with Tegra K1?
Thanks.
@cnxsoft
I encountered the same error, i.e “adb_server_notify: Failed to establish connection to ADB server”. And my solution is to lunch an ADB server at localhost. It’s quiet simple, just type
adb start-server” in the console, and it will lunch an ADB server at localhost. Once QEMU conntects to ADB server, it will boot the Android64 after few minutes. I successfully booted it and the model number showed “AOSP on Linaro arm64 Emulator”. Though the browser failed to lunch for unknown reasons.
@TK
Thanks it works now! I also had to install and run vncviewer. I’ve updated the instructions.
The Android version is a bit funny 4.4.43.43.43… Maybe that’s what Android L is now called because Google have not figured out which version they want to give yet…
Instructions to install Android Aarch64 on Juno development board -> http://www.youtube.com/watch?v=ojg4eZ-l3Po
I have done all like you,but system will stay in “ANDROID” and have log ” No [stack] line found in /proc/self/maps!” when logcat in adb shell.My AOSP is downloaded at 19th August.Is it some error in AOSP?
I faced the following problems following the above instructions
1.
git checkout ranchu-linaro-beta1
make -j8
Here before make, I did ./configure
2. Not vncviewer 127.0.0.1:5009
it is vncviewer 127.0.0.1:5900
3. After started the VNCviewer, it is not booting only the ANDROID display is continuing. Could you help me resolving this ?
@Jyo
Thanks for correcting the omissions in my post, I’ve updated it.
Depending on your machine, it may take a while to boot into Android, so maybe you have to be patient.
Otherwise, you may need to check for any errors in adb.
@cnxsoft
Thanks for the support. I waited for a long time. I tried adb. adb is detecting the device
$ adb devices
List of devices attached
emulator-5554 device
Also I can log into the device
$ adb shell
root@ranchu:/ #
But the vncviewer is still showing the android display only. Could you give suggestions if anything that I can try to resolve it?
@Jyo
Maybe try to use dmesg or logcat in the shell.
It’s also possible the code has changed since, and it does not work. I’m not entirely sure, because I’m not the one who did this, I just tried the instructions provided by Linaro. If you can’t find a reason, you could also contact linaro on IRC. Alex Bennee should know much better than me.
@cnxsoft
Thank you!
I took the logcat and getting the following crashes.
Build fingerprint: ‘Android/ranchu/ranchu:4.4.3.43.43.43/AOSP/jkuma10201420:eng/test-keys’
Revision: ‘0’
ABI: ‘arm’
pid: 28754, tid: 28754, name: zygote >>> zygote <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr ——–
Abort message: 'No [stack] line found in "/proc/self/task/28754/maps"!'
r0 00000000 r1 00007052 r2 00000006 r3 00000000
r4 f736af88 r5 00000006 r6 00000000 r7 0000010c
r8 ffc84684 r9 f726a440 sl f7255ef8 fp f644f1f0
ip 00007052 sp ffc845f0 lr f7211ac9 pc f7235dbc cpsr 60070010
d0 ffffffffffffffff d1 0000000000000000
d2 303a303020303069 d3 202020202030206e
d4 2020202020202020 d5 2020202020202020
d6 2020202020202020 d7 65765b2020202020
d8 000000174876e800 d9 4000000000000000
d10 3fe8000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 0000000000000000 d17 0000000000000fff
d18 0000000000000000 d19 0000000000000000
d20 0000000000000000 d21 0000000000000000
d22 0000000000000000 d23 0000000000000000
d24 0000000000000000 d25 0000000000000000
d26 0000000000000000 d27 0000000000000000
d28 0000000000000000 d29 0000000000000000
d30 0000000000000000 d31 0000000000000000
scr 80000000
backtrace:
#00 pc 0003bdbc /system/lib/libc.so (tgkill+12)
#01 pc 00017ac5 /system/lib/libc.so (pthread_kill+52)
#02 pc 00018747 /system/lib/libc.so (raise+10)
#03 pc 00014985 /system/lib/libc.so (__libc_android_abort+36)
#04 pc 00012d0c /system/lib/libc.so (abort+4)
#05 pc 00015ea1 /system/lib/libc.so (__libc_fatal+16)
#06 pc 00016f7d /system/lib/libc.so (__pthread_attr_getstack_main_thread(void**, unsigned int*)+216)
#07 pc 00277463 /system/lib/libart.so (art::GetThreadStack(long, void**, unsigned int*, unsigned int*)+46)
#08 pc 0025b713 /system/lib/libart.so (art::Thread::InitStackHwm()+46)
#09 pc 0025bae3 /system/lib/libart.so (art::Thread::Init(art::ThreadList*, art::JavaVMExt*)+338)
#10 pc 002606bf /system/lib/libart.so (art::Thread::Attach(char const*, bool, _jobject*, bool)+118)
#11 pc 0024ed55 /system/lib/libart.so (art::Runtime::Init(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, void const*> > > const&, bool)+912)
#12 pc 00250997 /system/lib/libart.so (art::Runtime::Create(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, void const*> > > const&, bool)+58)
#13 pc 001b4f07 /system/lib/libart.so (JNI_CreateJavaVM+478)
#14 pc 0004f4b7 /system/lib/libandroid_runtime.so (android::AndroidRuntime::startVm(_JavaVM**, _JNIEnv**)+2174)
#15 pc 0004fa7b /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector const&)+250)
#16 pc 00001637 /system/bin/app_process32
#17 pc 00012bbd /system/lib/libc.so (__libc_init+44)
#18 pc 00001770 /system/bin/app_process32
What would be the reason for this crash ? It would be helpful if you can give some more inputs.
Thanks!
@Jyo
Same error as @davy . Maybe you’ve hit a bug. Try to contact the Linaro guys to see what’s going on.
@cnxsoft
One more doubt I have which I missed to told you before. when did the below steps,
$git clone https://git.linaro.org/people/peter.maydell/qemu-arm.git
$cd qemu-arm
$git checkout ranchu-linaro-beta1
$./configure
I got the following error.
ERROR: DTC (libfdt) not present. Your options:
(1) Preferred: Install the DTC (libfdt) devel package
(2) Fetch the DTC submodule, using:
git submodule update –init dtc
Then I did two more steps
$sudo apt-get install libfdt
$git submodule update –init dtc
After this the make -j8 was successful.
Is there any issues that can be related to this. I am very new to android.
Thanks.
@Jyo
@cnsoft:
I am seeing the same crash. Do you have a fix for this crash?
@cnxsoft
Thank you!
I took the logcat and getting the following crashes.
Build fingerprint: ‘Android/ranchu/ranchu:4.4.3.43.43.43/AOSP/jkuma10201420:eng/test-keys’
Revision: ‘0’
ABI: ‘arm’
pid: 28754, tid: 28754, name: zygote >>> zygote <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr ——–
Abort message: 'No [stack] line found in "/proc/self/task/28754/maps"!'
r0 00000000 r1 00007052 r2 00000006 r3 00000000
r4 f736af88 r5 00000006 r6 00000000 r7 0000010c
r8 ffc84684 r9 f726a440 sl f7255ef8 fp f644f1f0
ip 00007052 sp ffc845f0 lr f7211ac9 pc f7235dbc cpsr 60070010
d0 ffffffffffffffff d1 0000000000000000
d2 303a303020303069 d3 202020202030206e
d4 2020202020202020 d5 2020202020202020
d6 2020202020202020 d7 65765b2020202020
d8 000000174876e800 d9 4000000000000000
d10 3fe8000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 0000000000000000 d17 0000000000000fff
d18 0000000000000000 d19 0000000000000000
d20 0000000000000000 d21 0000000000000000
d22 0000000000000000 d23 0000000000000000
d24 0000000000000000 d25 0000000000000000
d26 0000000000000000 d27 0000000000000000
d28 0000000000000000 d29 0000000000000000
d30 0000000000000000 d31 0000000000000000
scr 80000000
backtrace:
#00 pc 0003bdbc /system/lib/libc.so (tgkill+12)
#01 pc 00017ac5 /system/lib/libc.so (pthread_kill+52)
#02 pc 00018747 /system/lib/libc.so (raise+10)
#03 pc 00014985 /system/lib/libc.so (__libc_android_abort+36)
#04 pc 00012d0c /system/lib/libc.so (abort+4)
#05 pc 00015ea1 /system/lib/libc.so (__libc_fatal+16)
#06 pc 00016f7d /system/lib/libc.so
terrible things happens to me, it looks while patching for art, at first boot, I am on Android L preview 2
Could not create image space with image file ‘/system/framework/boot.art’. Attempting to fall back to imageless running. Error was: Unable to relocate image ‘/system/framework/boot.art’ from ‘/system/framework/arm64/boot.art’ to ‘/data/dalvik-cache/arm64/system@framework@boot.art’: Failed execv(/system/bin/patchoat –input-image-location=/system/framework/boot.art –output-image-file=/data/dalvik-cache/arm64/system@framework@boot.art –input-oat-location=/system/framework/boot.oat –output-oat-file=/data/dalvik-cache/arm64/system@framework@boot.oat –instruction-set=arm64 –base-offset-delta=-5808128) because non-0 exit status
the tombstone of the process is here:
https://db.tt/WxUmLNrX
it looks that patchoat is dying at init time (from the backtrace), but I am not able to figure out why. All the other stuff are fine, I am feeding proper cache.img partition and everything looks ok
@kalas
same story for me
@kalas
don’t look at tskill, that’s just a consequence and the place where the code finally crash; the problem is in libart, the runtime.create, something wrong passed by patchoat!
/system/lib/libart.so (art::Runtime::Create(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, void const*> > > const&, bool)+58)
gave it a try another way around… and works great: http://restart-thinking.vitorallo.com/2014/11/android-l-preview-under-arm64-aarch64.html
@flyingd
Great! I’ve linked to your updated instructions in an update at the top of my post.
@flyingd
Great! Thanks. It works for me.
happy to help, emulator64-arm64 was taken out from the lollipop release (aosp 5.0 r1/2). qemu is now a new project for google, will soon be migrated but at the moment the new qemu is here: https://qemu-android.googlesource.com/qemu-ranchu
(this explains a lot)
Hi, I was able to start the emulator. But the emulator doesn’t have the soft keys ( return, home etc). Also when I shell into the device there were home directory( /home ) and sdcard ( /sdcard ). Is this an expected behaviour or Did I miss something ? (Followed http://restart-thinking.vitorallo.com/2014/11/android-l-preview-under-arm64-aarch64.html)
@Jyo
I meant to say there were no home directory (/home) or /sdcard found in the filesystem of the emulator. It was a typo above.
@davy
Hey, seems I met the same problem with you. I am using Lollipop AOSP。adb is OK and I can see the “ANDROID” endlessly flashing.
The logcat shows that after art called dex2oat, the booting crashed with no [stack] line found.
Have you ever got any solution or workaround?
MANY Thanks!
pbb
new tutorial here, with other article…
finished to set all together how to compile, navigate the code and debug for the kernel aarch64 http://goo.gl/0w3EPL if can be interesting for the thread or a new post
terrible things happens to me, it looks while patching for art, at first boot, I am on Android L preview 2
Could not create image space with image file ‘/system/framework/boot.art’. Attempting to fall back to imageless running. Error was: Unable to relocate image ‘/system/framework/boot.art’ from ‘/system/framework/arm64/boot.art’ to ‘/data/dalvik-cache/arm64/system@framework@boot.art’: Failed execv(/system/bin/patchoat –input-image-location=/system/framework/boot.art –output-image-file=/data/dalvik-cache/arm64/system@framework@boot.art –input-oat-location=/system/framework/boot.oat –output-oat-file=/data/dalvik-cache/arm64/system@framework@boot.oat –instruction-set=arm64 –base-offset-delta=-5808128) because non-0 exit status
this question? what to do for that , ask help, thks
do any of you find the solution for the android splash screen flashing if so share it. Also see the pastebin
http://paste.ubuntu.com/10758508/
@Alex Bennee
android-init-tweaks.diff is missing in the link below.
How I can get it?
Please help, thanks.
hi alex
link : http://people.linaro.org/~alex.bennee/android/android-init-tweaks.diff is not found
where i can find the patch
@Alex Bennee
The file seems to be gone. I tried to manually patch it and here’s the resultant diff. Going to try to build it now.
45,47d44
< # android_pipe
< symlink /dev/android_pipe /dev/qemu_pipe
<
120c117
write /proc/sys/kernel/randomize_va_space 2
people.linaro.org/~alex.bennee/android/android-init-tweaks.diff return ERROR 404 not found !where can I find the patch
@DickZhuang
Please read the first two lines of the post.
I read it! and i run android 5.0.0_r7 arm64 on qemu,but i try to compiling android kernel 3.10 the kernel Image can not booting android 5.0.0_r7 arm64 on qemu ,but kernel-qemu in AOSP can! can you tell me how to compiling the android kernel 3.10 ,i read and i want to try!
@DickZhuang
Sorry, I’m not sure how to do that. I can see the other link they don’t seem to use android-init-tweaks.diff patch.
OK,thank you all the same! LXC et Android 5 ARM64 use qemu so i try this link!
I am facing “binder: 739:739 transaction failed 29189, size 0-0” issue.. i dont know how to fix..
Can any one please help me how to fix this?