Hi all,
It's been a long time since I've tried running Android-x86 in an emulator, here's my experience with running Android-x86 7.1-rc1 on QEMU so far.
TL;DR:
- Perhaps remove '-sdl' option from `qemu-android` script, not all builds of QEMU support it.
- Live system runs very quickly and smoothly.
- Couldn't get shared 'data' directory to work, problem with 9p modules perhaps?
- Filesystem on data.img must be ext4, not ext2, for app updates to work.
- Had to use 'video=...' kernel commandline option to set custom resolution.
For this test, I used Void Linux x86_64 running on a box with a Core i7-4790 CPU @ 3.60GHz, with 8 GB RAM, QEMU version 2.9.0.
I downloaded android-x86-7.1-rc1.iso and android-x86-7.1-rc1.x86_64.rpm
from [1].
I managed to adapt the advice on running Android-x86 in QEMU from [2] somewhat (I think it applies to older versions) after I studied the `qemu-android` script in the RPM package.
= Live system
To boot it, I started out from the `qemu-android` script on [2], which I had to adapt somewhat with help from the `qemu-android` script in the RPM package.
In particular, I needed to remove the '-sdl' option from the QEMU command, because my build of QEMU doesn't support it (it has only the GTK+ GUI).
In the end, I used the following command:
qemu-system-x86_64 -enable-kvm -vga std \
-m 2048 -smp 2 -cpu host \
-soundhw ac97 \
-net nic,model=e1000 -net user \
android-x86_64-7.1-rc1.iso
After QEMU started, I chose the menu option "Live CD - Run Android-x86 without installation".
The live system booted very quickly, and I could install and run apps quickly and smoothly.
= Shared 'data' directory
Next, as an experiment, instead of installing to a disk image, I looked for a way to setup Android-x86 using a shared 'data' directory.
For this, I used the `qemu-android` script from the RPM package (which I extracted using `rpmextract` because Void Linux doesn't use RPM and doesn't come with an 'rpm' or 'alien' package to install it).
I used the following commands:
$ rpmextract android-x86-7.1-rc1.x86_64.rpm
$ mv android-7.1-rc1 ~/.local/opt/
$ OUT=$HOME/.local/opt/android-7.1-rc1
$ mv usr/bin/qemu-android $HOME/.local/bin/
$ mkdir $OUT/data
Again, I had to remove '-sdl' from the QEMU command line to allow it to start.
Finally, I ran:
$ sudo OUT=$OUT $HOME/.local/bin/qemu-android
QEMU started up, but did not boot Android-x86. In the debug shell, I used `mount`, command to check if the shared 'data' directory was mounted, but it wasn't. Also, `lsmod` didn't show any 9p modules loaded. Any help on why this didn't work is much appreciated.
= data.img disk image
Next, I tried using a disk image. To create one, I used the following commands, which I adapted from [2]:
$ rmdir $OUT/data
$ qemu-img create -f qcow2 $OUT/data.img 16G
$ OUT=$OUT qemu-android
I expected Android-x86 to not boot, because the disk image did not have any filesystem on it yet.
In the debug shell, I first had to figure out which block device matched the disk image, then I ran the command:
x86:/ # mkfs.ext2 -j -L DATA /dev/block/vdc
After quitting and restarting QEMU, Android-x86 booted, yay!
However, I could not install or update packages, I kept getting "error 963" from Google Play.
After some searching, I found out that I should format the disk image as ext4, not ext2, to make app install and update work without errors.
To do this, I had to run:
$ rm $OUT/data.img # just to be sure
$ qemu-img create -f qcow2 $OUT/data.img 16G
$ OUT=$OUT qemu-android
Back in the debug shell, I found out that this installation doesn't have a `mkfs.ext4` command, so I had to use the generic `mke2fs` and specify the filesystem type:
x86:/ # mke2fs -t ext4 -j -L DATA /dev/block/vdc
After quitting and restarting QEMU again, I could install and update apps without problems. Yay again!
= Custom screen resolution
Next, I tried changing the resolution of the Android display. I had no luck when trying any of the tips in [3], but after some searching, I found [4] and [5], which motivated to try and use 'video=1920x1080' kernel command line option.
After adding this option to the '-append ...' QEMU option, I was able to run Android-x86 in QEMU fullscreen, without ugly stretching and crisp fonts and graphics.
I hope that some of this long rant can be used to improve what are mostly documentation issues. Thanks to all for making this great project, keep up the good work!
Kind regards,
-Alain
[1]:
http://www.android-x86.org/download
[2]:
http://www.android-x86.org/documents/qemuhowto
[3]:
http://www.android-x86.org/documents/uvesafbhowto
[4]:
https://lists.nongnu.org/archive/html/qemu-devel/2014-03/msg05306.html
[5]:
https://fedoraproject.org/wiki/Display_resolution_of_Fedora_18_virtual_machines