For those waiting for the Hardware OpenGL Windows version…

Hi,

Just a few words for those of you waiting for the Hardware OpenGL Windows version. I have some performance problems, apparently due to the TCP connection between the Android guest and the host : with a Linux host the performance seems fairly good but with a Windows host it’s not good.

Then, I’m working on using VirtualBox “HGCM” (Host Guest Communication Module) to replace the TCP connection. I hope this will solve the problem. I’ll let you know.

Dan.

Using ARM emulation on other Android x86 distributions

Hi,

I’ve been asked several times how to use the “ARM binary emulation” feature from Intel (aka “libhoudini”) on other Android x86 distribs.

First important point : I don’t have any source code of the “libhoudini” feature, I just grabbed the binary files from an Intel-Medfield phone running Gingerbread (2.3.7). The important binary files are : system/lib/libhoudini.so, system/lib/arm/*, system/lib/libdvm.so

The “system/lib/libhoudini.so” and “system/lib/arm/*” are new files so there’s no problem integrating them. The libdvm.so is more difficult as it’s part of the “dalvik” package and cannot just replace the existing libdvm.so because it’s compiled for Gingerbread and won’t load on ICS (using this binary lib directly would also mean that you can’t modify dalvik).

So what I did is that I modified dalvik (libdvm) to dynamically load a library named libdvm_houdini.so (which is just a rename of the libdvm.so from the Intel phone) and call the needed functions to load and run ARM code – it was quite tricky ’cause I had to disassemble the lib to know the exact function parameters to be used. An other problem was that the libdvm_houdini.so has some external dependency which is not resolved in ICS (it looks for a jniRegisterSystemMethods() C function which has been replaced by a same-name C++ function in ICS) ; to solve that, I’ve compiled a “libnativehelper_GBfake” library which only implements this function ; final thing : this “libnativehelper_fake” library has to be preloaded before executing dalvik, to do this I’ve the “export LD_PRELOAD /system/lib/libnativehelper_GBfake.so” line to the init.rc (just after export BOOTCLASSPATH). Final thing you have to add the “ro.product.cpu.abi2=armeabi” line to your system.prop to tell Android it can runs ARM code.

So, to summarize, if you want to build your Android x86 distrib with libhoudini support :

  • Apply this patch to dalvik
  • Put the libhoudini.so to /system/lib/ and the arm libraries to /system/lib/arm/
  • Put the libdvm_houdini.so to /system/lib/
  • Put the arm libs to /system/lib/arm/
  • Add the libnativehelper_GBfake project to your source code and put the libnativehelper_GBfake.so in /system/lib/
  • Add the “LD_PRELOAD /system/lib/libnativehelper_GBfake.so” to your init.rc
  • Add the “ro.product.cpu.abi2=armeabi” line to your system.prop
  • Build everything and enjoy :-)

Feel free to tell me if something doesn’t work.

Dan.

Hardware OpenGL for Linux

Hi,

I’m very happy to release this new test release which works with Hardware OpenGL for Linux. It’s based on the emulator hardware opengl support released few weeks ago by Google.

Basically, the input (mouse, keyboard) and output (display) is now handled by a separate executable that you have to run before starting the VM. So you won’t see anything in the “VirtualBox” VM window. The communication between the VM and the “buildroid_renderer” executable is IP (both TCP and UDP), so you might need to tweak your firewall rules to make it work correctly. The VM use the android “eth0″ (management) interface so you have to connect it to a VirtualBox “private network” (vboxnet0 by default in the supplied OVA).

To install it :

  • Import the OVA file as usual
  • Uncompress the “buildroid_renderer_XXXXX.tgz” file in a directory (tar -xvzf buildroid_renderer_XXXX.tgz)

To run it :

  • Run …./buildroid.sh
  • Start your VM, after few seconds you should see the display in the “Buildroid using Hardware OpenGL” window

To work, your Linux system has to use a somehow recent XServer ; my tests showed that pre-1.9.0 XServer wont’ run (for example, on my Ubuntu 10.04 LTS system it doesn’t work, whereas an Ubuntu 11.10 it works perfectly). If your XServer is not compatible, you’ll have a message “eglChooseConfig returned no EGL configuration”. Please report working/not working configurations (including your X.Org X Server version shown at the top of the /var/log/Xorg.0.log file – my Ubuntu 11.10 has a 1.10.4 version whereas the Ubuntu 10.04 has a 1.8.2 one).

I’ve included in the build the “libhoudini” feature to run ARM apps.

You can download the OVA file from here (only vbox86t type for the moment) :

And the buildroid_renderer package is available from here : buildroid_renderer_20120614.tgz buildroid_renderer_20120616.tgz

The mouse capture/uncapture works the same as in the VirtualBox window : you click on the window to capture the mouse, and press the right Ctrl key to uncapture it.

You can change the size of the window with the “-width” and “-height” parameters to buildroid.sh ; for example “./buildroid.sh -width 1366 -height 768″ will set a 1366×768 resolution. The resolution set by the android app “Buildroid VM Configuration” is not used with OpenGL hardware, but other parameters (including the DPI) are still used. You can  use a “full screen” resolution (a resolution fitting your linux desktop) but you’ll still have some “status bar” from your desktop window (I’ll fix that ASAP).

The different versions of Angry Birds work great !

If you don’t have Linux, you can have a preview of the OpenGL performance by watching this video : http://www.youtube.com/watch?v=yXwvepSSaPw

I hope to be able to compile Windows and Mac-OS versions of the buildroid_renderer tool by the end of the week. Stay tuned !

Enjoy,

Dan.

 

Running ARM apps

Hi,

as you know, the main drawbrack of running Android on x86 platforms are the incompatibility with NDK apps compiled only for ARM processors…

Intel recently released their ‘Medfield’ x86 CPU to be used in Android smartphones and the first devices using it are out. Facing this problem, Intel has developed some “binary translation” function to solve it. Here’s some “high level view” of how it works :

I was able to get a Medfield-powered smartphone to look how it works. Running ARM apps is just fine and I could play Angry Birds with good performance. I then looked into the system : the main part of the “binary translation” function is made of the “houdini” library and ARM libraries ; there’s also some modifications to the “libdvm” library (part of Dalvik). Could it be used to run ARM apps on Buildroid ? As the smartphone I got was based on Gingerbread, I first tried to grab the libs and use them on an 2.3.7 android-x86 ISO I’ve rebuilt and it worked just by replacing the libdvm and adding the libhoudini and ARM libs !!  But my goal was to run ARM apps on ICS ; there, it was much more complex because I couldn’t just replaced the ICS libdvm by the one integrated with libhoudini…. but I after many hours I was finally able to hack the thing to make it work !

I tried to run different apps : all the Angry birds games and the Acrobat Reader (which uses ARM libs) work ; other apps like Skype or Chrome don’t seem to work correctly. What’s the performance ? It’s not very good – and very far from the performance I get using the Medfield CPU ; does the Medfield CPU integrates some hardware function to accelerate the “binary translation” ? maybe things to tweak to improve performance ? I’ll look into it. In the mean time, it’s a first solution to run non-CPU intensive ARM apps on x86.

Want to test it ? You can grab the Buildroid OVA from here : buildroid_vbox86t_4.0.4_r1.1-20120610b_gapps_houdini.ova (which also includes gapps) ; this feature is experimental and may make other parts of the system crash… by the way, I’ve also included the USB camera support in this test version (you have to activated USB 2.0 and connect your USB camera to the VM).

Happy testing, feedback welcome !

Dan.

PS: Sorry for those who downloaded the “20120610a” version, there was still a bug in it which prevent many ARM apps to execute, the “20120610b” version corrects this problem (see the link above).

“Buildroid for VirtualBox” 20120530 update

Hi,

I’m pleased to release the 20120530 update of “Buildroid for VirtualBox” with the folllowing small fixes or improvements :

  • The VM should now run on most x86 processors (don’t need any more “NX/PAE” and SSE processor extensions)
  • You can now force the “system bar” (return, home, recent apps buttons) to be present (by default, Android doesn’t have this system bar on phone resolutions lower than 720×1280), using the “Buildroid VM Config” embedded app [Don't use it when you already have the "system bar" for example on tablet resolutions or you'll have SystemUI crashes]
  • Resolutions : the two lowest phone resolutions (240×320, 320×480) have been removed because they don’t seem to be supported correctly in ICS. Two new resolutions have been added : 400×768 and 1366×768. Beginning from this release, the “tablet” versions only support “tablet resolutions”, and same thing for the “phone” version (the reason is there’s only a limited number of possible custom resolutions in VirtualBox).
  • The data partition has been extended to 5GB (instead of 500MB), allowing to install more apps
  • The disk partition has been modified to allow the “encryption function” to work correctly.
  • The “270°” rotation was not handled correctly, resulting in a upside down screen, this has been corrected
  • You can now watch non-HD HTML5 videos in full-screen mode (not full-screen still don’t work) with a good frame rate (the low frame rate was due to a bug in AOSP MPEG4 software decoder)
Known limitations :
  • No Renderscript support (thus, no YouTube app support)
  • No “non full-screen” video and no HD video
  • No Adobe Flash Plugin support as the plugin provided by Adobe uses ARM native code
  • It’s not possible to “factory reset” the virtual device
  • The 180° rotation is not yet handled (is it used ???)

This release is based on the android-4.0.4_r1.1 AOSP branch.

You can download the OVA files from here :

A vbox86t version with gapps included is available here : buildroid_vbox86t_ 4.0.4_r1.1-20120530_gapps.ova

PS: I’m still working on the “OpenGL 2.0″ support, a test version for Linux host should be available by the end of the week.

“Buildroid for VirtualBox” 20120518 update

Hi,

I’ve just released a new version of “Buildroid for VirtualBox” with some changes on the VirtualBox VM configuration (no change in the android code) :

  • There was a mistake in the 20120517 release which prevent the use of non-standard resolution (for example, the different ‘phone or the 1024×600 resolutions)
  • The first network card (eth0) is not set to a ‘null’ type by default to prevent the ‘vboxnet0′ error at startup when this network doesn’t exist. That also mean that if you want an adb connection to the VM, you have to change this network card configuration ot set it to “host-only network” and select (after creation if needed) a virtual network
  • The date/time sent to the VM is now in UTC (and not local time) which is the good configuration for Android

You can download the different versions here :
Android 4.0.3_r1
        vbox86p : buildroid_vbox86p_4.0.3_r1-20120518.ova
        vbox86t : buildroid_vbox86t_4.0.3_r1-20120518.ova
        vbox86tp : buildroid_vbox86tp_4.0.3_r1-20120518.ova

I’ve also generated a “test VM” which includes Google Apps (with ‘Play’) : buildroid_vbox86t_4.0.3_r1-20120518_gapps.ova

Enjoy,

Dan.

“Buildroid for VirtualBox” released

Hi,

I’m glad to announce the release of “Buildroid for VirtualBox”, which is a follow-up of my previous work on “AOSP-VirtualBox” and VirtualBox support in android-x86.

You’ll find all needed information here.

There are many differences with the previous VM I released :

  • You can now change the screen resolution from within the VM (using the “Buildroid VM Configuration” app)
  • A wifi connection is emulated
  • You can choose to disable the physical keyboard and use the virtual one
  • Screen orientation is managed
  • Google Market/Play now works correctly and you’re able to download a lot of applications (including Maps for example)

This is the beginning of a strong effort to have the best possible support running Android in VirtualBox. “Buildroid for VirtualBox” is mainly being aimed at developers who want to have a better solution to test their applications but feel free to use it with any other objective ; and please tell me if you’d like to see some new functions or improvements.

Dan.

 

How to change screen size on VirtualBox/Android

Hi,

One thing I’ve been asked quite often is : how to change the screen size on my VirtualBox VM ?
Mainly to fit the size of the host system and use the VM   in full screen resolution – which is obviously much more friendly.

 

In fact, it’s quite easy, there’s 2 steps :

  • First you have to add a “custom video mode” to your .vbox configuration file : Add the line “<ExtraDataItem name=”CustomVideoMode1″ value=”1280x800x16″/> just after the already present “ExtraDataItem” entries
  • You also have to modify your linux kernel options to replace the existing vga=xxx by a vga=ask
Then, when you boot your Android VM, you’ll be able to choose the new screen resolution in the list.
Two notes on this :
  • Obviously, you have to replace the  ”1280x800x16″ by your resolution – the “16″ value is the color depth ; keep a 16 color depth value and things won’t work.
  • You can have different custom video modes, you just have to add as many CustomVideoModeX values as needed, and increment the X

Happy testing :-)

Dan.

Note: You have to edit your .vbox file while VirtualBox is not running (not only the VM but also the VirtualBox management console).

Google Apps Integration

Many are interested in testing Google Applications on an Android VM (either VirtualBox or VMWare, AOSP or Android-x86 based).

After some tests with 2 Google Apps packages (gapps_ics_4.0.3_v10.zip and gapps-ics-20111125-2.zip) I had the following results :

  • gapps_ics_4.0.3_v10.zip works well but lacks some applications (including Maps/Latitude) which should be downloaded from the Android Market (which is quite difficult until we solved the problem very few applications are available from the x86 vm).
  • gapps-ics-20111125-2.zip includes many applications (including Maps/Latitude) but has some problems with application crashes…

So what I did was just to take the gapps_ics_4.0.3_v10.zip package and add the Maps.apk (which includes the Maps and Latitude apps) from gapps-ics-20111125-2.zip -> I named the file gapps_ics_4.0.3_v10-withMaps.zip

To install it here is the procedure :

  • Download the file
  • Unzip it
  • Find the IP address of your Android VM by executing “netcfg” on the command line
  • Connect with adb using “adb connect x.y.z.t” (replace x.y.z.t with your Android VM IP address, adb is included in the Android SDK)
  • If needed, remount the system partition to R/W with “adb remount”
  • Go in the directory where you unzipped the file and execute “adb push system /system/”
  • Reboot your VM
  • Everything should be OK :-)

Note : When you use the Market, very few applications are available… Some tweaks would be needed in build.prop to solve that. If somebody has some success with it, please tell us.

Dan.