Jetson nano - KVM Acceleration - Android VM / Emulation Demo

Hello , It was suggested that I post this here.

Maybe it will peak a bit more interest … If anyone here does any android development and would be willing to compile an AOSP image for testing please get in touch and I’ll fill you in on the specific mod’s required to support Mesa DRM/KMS within the image. (looking for android 8.1 or 7.1.2 specifically)

Here is a quick screen recording of me running an Android KVM on the jetson nano.

Stuff to keep in mind :

Performance is poor while recording however, when nothing is running in the back ground I am getting around 60fps.

The Android image I am using is a pre-built Android 9.0 image built with linaro sources that seems like it was kind of thrown together with peaces of code that don’t really play nice together.

For more information on how this was accomplished please take a look at this post.

original post : https://devtalk.nvidia.com/default/topic/1071183/jetson-nano/full-kvm-support-working-on-the-jetson-nano-kernel-virtual-machine-plus-virtio-gpu-passthrough-/

Video Demo : https://www.youtube.com/watch?v=42TRVCIR0nU

The main peaces of the puzzle are as follows:

  1. An Android image with Mesa DRM/KMS support.
  2. Android kernel with the appropriate Virtio-gpu modules enabled.
  3. Modified Jetson nano kernel to add support for KVM
  4. compiled Virgilrender and qemu with virgilrender support.

If anyone is interested in trying out my pre-compiled kernel please let me know.
I’m working on releasing the modified kernel source as well.

Regards,
Chris.

1 Like

Hello. Im interested. please share the procedure and the files with me. thanks.

Some instructions I found here and tried to replicate. Its for a different base board but since it runs on qemu and not directly on hw, it should have worked on the plain vanilla jetson-nano also…

https://github.com/antmicro/kvm-aosp-jetson-nano

However even after I followed the procedure the kernel booting has some issues. Looking forward to some hints from the developers.

I version of Android is 10. I am not sure which verison @mr.chrismitchells used, whether 9 or 10.

soon I will try. but write here which kind of issues you have seen,so that I can compare them with what I will get.

Its found in the Issues: https://github.com/antmicro/kvm-aosp-jetson-nano/issues/11

I’m freezed on this error. Did u find it ? did u find a solution ?

[ 2.532754] init: init first stage started!
[ 2.535936] init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 2.540632] init: [libfs_mgr]ReadDefaultFstab(): failed to find device default fstab
[ 2.546246] init: Failed to fstab for first stage mount
[ 2.549616] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 2.555116] init: [libfs_mgr]ReadDefaultFstab(): failed to find device default fstab
[ 2.560762] init: First stage mount skipped (missing/incompatible/empty fstab in device tree)
[ 2.566906] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[ 2.571227] init: execv(“/system/bin/init”) failed: No such file or directory
[ 2.593768] init: #00 pc 00000000000e90a0 /init
[ 2.599958] reboot: Restarting system with command ‘bootloader’

No. The problem was the startup of services was failing in a loop.
I stopped that line as I want to try proceed with Android 9 instead of 10 (sometime later).

In the meantime I found I could run Anbox on Jetson Nano. See here:
https://forums.developer.nvidia.com/t/anbox-on-jetson-nano/160312/7?u=rreddy78

can u give a look inside your log ? I have the same problem as you,it reboots ciclically. So,you should have the same error that I have. Are u asking all around for a workaround ? I don’t want to resign for sure.

The problem with Android for me is that I don’t have a separate powerful machine to build android. Already I spent up $10 on an AWS VM to build that android 10 image and without success.

But I have focus on running armhf VM with KVM and GPU acceleration and I did succeed. Please see my post here for how to run armhf VM on jetson-nano.

https://forums.developer.nvidia.com/t/run-a-32bit-application-on-the-jetson-nano/127050/19?u=rreddy78

you should be more careful when you wrote the commands that u issue. You skip a lot of steps and when I try to replicate,it fails. And u are missing the post with the problems that I found when I tried to replicate your steps. I have the powerful machine that u need to build android. I can make a remote account for you,so that u can work on mine. Go here and check the reason why Anbox does not work in my case :

Just a thought … If ChromeOS could be ported to the jetson devices it would certainly make things interesting as it has Android app support …

1 Like

I’ve thought the same,but after some research I’ve ended thinking that it’s more complicated to port Chrome OS than Android itself. Chrome needs some specific patches necessary to boot it that only a very experienced programmer can do.

1 Like

Yes. I am looking to see if Chromium OS (not ChromeOS) is runnable on qemu+kvm. I have had some discussions with chromium os developers on this topic:

https://groups.google.com/a/chromium.org/g/chromium-os-discuss/c/eys9ATHiZKc

1 Like

I know,but I have some doubts that chromium OS is good as chrome os for running the android apps. Yesterday I found a website that collects a lof of useful android images :

I think that the image that we need is the arm64,right ? there is also a qemu-kernel inside…I tried to boot it,without having success…give a look here :

1 Like

ChromiumOS does not have the Android Runtime and Play Store support. Its just a start.

For PC’s (x86) there are ways to convert this ChromiumOS to ChromeOS using a recovery image - https://github.com/sebanc/brunch

I think that the road that you have taken is a dead road for many reasons :

  1. chromium os is not easy at all to boot on the jetson nano
  2. chromium os does not support the android stuff,so for what it is useful ? your goal is not to run android on the nano ?
  3. your brunch framework runs on x86_64,it’s not good on the arm platform

yesterday I tried to boot android x86 with qemu-i386. it has been installed without problems,but it is not able to work at all. and even if it worked,it is very slow. I’m also trying some alternative roads,like trying to emulate android for the raspberry PI on the nano with qemu with the parameter raspi3 and kvm…we will lose 64 bit,but maybe it will work. what is working for sure with qemu is windows xp sp3 :P. I’ve read that windows xp supports the android emulator x86. but it will be too slow. it does not worth. It is very slow also the android emulator for arm64. Below I post some promising ideas that could be developed. I mean,try to emulate FydeOS and Lineage 16 with qemu and kvm. These are images which can emulate android on the raspberry. Since we know that we can emulate the raspberry on the nano,maybe with some efforts we can also emulate those images. As u can see,the chromium os is also involved.

or try to boot the old jedroid with qemu and kvm :P

Yes, I know it might be. They are just two parallel experiments I am up to…

I now have a AOSP build setup on my laptop and can try something. I have built the
branch https://github.com/antmicro/kvm-aosp-jetson-nano with some difficulty on by 8GB laptop

My steps are as follows:

  1. See if I get same result as the images I built previously or if something different.
  2. If not working, analyze the manifest.xml file of the ant-micro to see what specific changes they have done and try to do the same for AOSP 9 version and check it.

Android x86 should run fine on any x86 system with virtualisation (not emulation). You can run it using qemu or VirtualBox on Windows or Linux. Emulation is too slow to be of any use.

All other options like running RPi image on nano using qemu wont work because the RPi hw is quite different (VideoCore GPU etc.) and qemu wont be able to virtualize it. At the most emulate it which will be pretty damn slow.

RPi has a large community and they why we see Android and Chromium OS ported to it. Jetson Nano itself will have less support from Nvidia in future

https://forums.developer.nvidia.com/t/jetson-software-roadmap-for-2h-2021-and-2022/177724

write me the commands that you issue for completing the ant micro tutorial. I’ve repeated a lot of times that tutorial but I still get a different error than you.