Building for VirtualBox

2,484 views
Skip to first unread message

Alan Ott

unread,
May 18, 2012, 4:29:07 PM5/18/12
to android-...@googlegroups.com
Hello,

I've recently been trying to make a 4.x build for VirtualBox. While I
can build it without problem, I've yet to make a build which will
actually work.

My current problem is that Launcher crashes immediately every time when
I click the applications button. The result is the same when built from
the following tags:
HEAD (a week or so ago)
android-4.0.4_r1.2
android-4.0.3_r1.1.

I feel like there must be something basic I'm doing wrong, but there are
a few things I don't understand as well. The first is the kernel. If I
look at the git log on prebuilt/android-x86/kernel/kernel-vbox, it tells
me the following:

This image was generated using the following repositories
on android.git.kernel.org (and corresponding SHA1s):
kernel/qemu.git
39d5f544b00b564a2a8ea350cc296f9dbdde006a

kernel/qemu.git doesn't exist in the same place that the other kernel
repositories exist [1]. Is kernel/qemu.git on some other server, or is
this just old information? What is the right kernel source tree to use
for this?

Other docs on the web, including docs from Intel[2] say to build from
kernel/goldfish.git. The problem is that goldfish.git doesn't have
specified SHA1 in it. Nevertheless, I built from the tip of
android-goldfish-2.6.29 branch, as the Intel instructions say. This is
the only branch in that repo, and there are no tags. Isn't 2.6.29 really
old for Android 4? I see pictures of people's phones which say kernel
version 3+ on them, and other docs say the same. Could that be my problem?

I'm building on Ubuntu 10.04 64-bit and running the following to
generate the VDI:
make android_disk_vdi

I then create a VM with that as the main disk and boot. I've tried with
and without VM 3D acceleration on. I've tried with the pre-built kernel,
and with one I built myself from goldfish.git.

My build procedure is:
. build/envsetup.sh
lunch (and select vbox_x86-eng (3). Lunch output at footnote [3])
make -j4

Also, I have a buildspec.mk which only differs from
build/buildspec.mk.default by changing the output directory.

What part of this am I missing?

Alan.

[1] In other words, running the following fails:
git clone https://android.googlesource.com/kernel/qemu.git
[2]
http://software.intel.com/en-us/blogs/2012/03/06/hands-on-notesbuild-android-x86-ics-4-virtualbox-from-google-virtualbox-target-and-intel-kernel/
[3]
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=vbox_x86
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86
TARGET_ARCH_VARIANT=x86
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76I
============================================

Bruce Beare

unread,
May 22, 2012, 7:41:59 PM5/22/12
to android-...@googlegroups.com
The correct VB "make" targets are "installer_vdi" or "android_disk_vdi".

These will give read-to-use virtual disks for VirtualBox. You'll need to have VB installed so that
the makefile can convert the .img file to the .vdi file. I'm doing an update and build now to verify that
nothing is broken... and will post if I find any issues.

-Bruce


Alan Ott

unread,
May 22, 2012, 9:52:53 PM5/22/12
to android-...@googlegroups.com, Bruce Beare
Thanks Bruce.

Maybe my email wasn't clear, but that's exactly what I do. After running
make, I then run:
make android_disk_vdi
and then make a VirtualBox machine using the vdi file at:
out/target/product/vbox_x86/android_disk.vdi

I use the VDI given to me by the build system and can boot up, but
launcher crashes immediately when I hit the applications button.

As a follow-up, I also tried getting a hardware-virtualized (KVM) QEMU
session going. While running x86 android works great in the emulator
without KVM, if I modprobe the kvm_amd module and start emulator,
Android init will fail to start with really the only message being:
Timed out waiting for /dev/.coldboot_done

I turned on logging and did some tracing, and it's the strangest thing.
From what I was able to tell from my own logging statements, the thread
which walks sysfs was locking up inside strncmp(). I know it sounds
impossible, but that's what I observed. I changed the code which called
it (inserting my own astrncmp() directly in init/devices.c), and it
would then move past that part and fail somewhere else. I didn't track
down exactly where, but only got as far as noticing that servicemanager
was repeatedly crashing.

Anyway, all that to maybe give some more clues as to what the problem
could be. It seems like virtualization may be a common thread between
these two problems.

I just noticed your second email, which mentions grub. Indeed, my latest
build from HEAD hangs at Grub stage 2. This is a different problem than
I was observing. Nevertheless, I'll grab your patch and build again and
see how far I get.

Thanks for your help,

Alan.

Alan Ott

unread,
May 22, 2012, 10:08:37 PM5/22/12
to android-...@googlegroups.com, Bruce Beare
On 05/22/2012 09:52 PM, Alan Ott wrote:
> On 05/22/2012 07:41 PM, Bruce Beare wrote:
>> The correct VB "make" targets are "installer_vdi" or "android_disk_vdi".
>>
>> These will give read-to-use virtual disks for VirtualBox. You'll need
>> to have VB installed so that
>> the makefile can convert the .img file to the .vdi file. I'm doing an
>> update and build now to verify that
>> nothing is broken... and will post if I find any issues.
>>
> While running x86 android works great in the emulator
> without KVM, if I modprobe the kvm_amd module and start emulator,
> Android init will fail to start with really the only message being:
> Timed out waiting for /dev/.coldboot_done

Hi Bruce,
So I just realized from your other email address that you maybe don't
want to hear about my AMD CPU :)

I have been trying the VirtualBox images on my i7 Mac as well with the
same results on the HEAD (well the head as of last week; it's different
now). On the 4.0.4_r1.2 and 4.0.3_r1.1 branches, I could boot up on the
i7 (but had the launcher issue), but not on the AMD (it would hang at
boot waiting for .coldboot_done).

I'm rebuilding now with the latest HEAD which I verified does include
your grub patch. I'll let you know what I find on both CPUs.

Thanks again for your help.

Alan.

Alan Ott

unread,
May 23, 2012, 2:06:43 AM5/23/12
to android-...@googlegroups.com, Bruce Beare
On 05/22/2012 10:08 PM, Alan Ott wrote:
> On 05/22/2012 09:52 PM, Alan Ott wrote:
>> On 05/22/2012 07:41 PM, Bruce Beare wrote:
>>> The correct VB "make" targets are "installer_vdi" or "android_disk_vdi".
>>>
>>> These will give read-to-use virtual disks for VirtualBox. You'll need
>>> to have VB installed so that
>>> the makefile can convert the .img file to the .vdi file. I'm doing an
>>> update and build now to verify that
>>> nothing is broken... and will post if I find any issues.
>>>
> I'm rebuilding now with the latest HEAD which I verified does include
> your grub patch. I'll let you know what I find on both CPUs.

The grub fix works now, and I also tracked down the crashing launcher.
With debugging turned up, I noticed that Dalvik is capping the heap at
16M, and launcher is needing more than that.

I put this:
dalvik.vm.heapsize=64M

In build/target/board/vbox_x86/system.prop and launcher stopped crashing
(and I also get a cool background).

The question now is.... Why did I have to do that when:
1. It runs in the qemu emulator just fine, and
2. So many other people seemingly don't have to.

Thanks again for your help,

Alan.

Bruce J Beare

unread,
May 23, 2012, 1:47:39 PM5/23/12
to android-...@googlegroups.com
16M isn't really enough heap. The emulator sets a system property to set the heap to 24M. Look at your "config.ini" for a qemu instance in your $HOME/.android directory:
   vm.heapSize=24

For virtualbox, you have to do this in the BoardConfig.mk. I believe that the following is intended for this purpose:
  USE_CUSTOM_RUNTIME_HEAP_MAX := "32M"

Try adjusting that value. If adjusting it doesn't work, try the following in BoardConfig.mk:
  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.heapsize=64m

Please let me know your results.

-Bruce

Alan Ott

unread,
May 23, 2012, 3:20:05 PM5/23/12
to android-...@googlegroups.com, Bruce J Beare
On 05/23/2012 01:47 PM, Bruce J Beare wrote:
> 16M isn't really enough heap. The emulator sets a system property to
> set the heap to 24M. Look at your "config.ini" for a qemu instance in
> your $HOME/.android directory:
> vm.heapSize=24
>

I don't have that file, but I do have
out/target/product/generic_x86/hardware-qemu.ini which does have that
line in it, except it says vm.heapSize=48M. Running the emulator for the
full_x86-eng configuration does indeed show 48M for getprop
dalvik.vm.heapsize .

> For virtualbox, you have to do this in the BoardConfig.mk. I believe
> that the following is intended for this purpose:
> USE_CUSTOM_RUNTIME_HEAP_MAX := "32M"
>

That value is already in build/target/board/vbox_x86/BoardConfig.mk but
it apparently isn't what we want since the Dalivk running under
VirtualBox was for sure was capping at 16 MB, not 32.

> Try adjusting that value. If adjusting it doesn't work, try the
> following in BoardConfig.mk:
> ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.heapsize=64m
>

None of the other BoardConfig.mk files have ADDITIONAL_BUILD_PROPERTIES
. I'm not doubting that it will work. I'm mostly trying to understand
how I'm supposed to have figured that out. Is there a document or
something you can point me to?

> Please let me know your results.

I did :)

To recap, I put this:
dalvik.vm.heapsize=64M

In build/target/board/vbox_x86/system.prop and launcher stopped crashing.

It appears there is more than one way to fix this issue. If we can
determine which one the _right_ way is, I'd be more than happy to
test/send you a patch.

Thanks for your help.

Alan.

Bruce J Beare

unread,
May 24, 2012, 2:46:39 PM5/24/12
to Android Building
Fixed in...
https://android-review.googlesource.com/36990
https://android-review.googlesource.com/36981

Please let me know if you have further issues with this.
-Bruce

Alan Ott

unread,
May 24, 2012, 10:03:26 PM5/24/12
to android-...@googlegroups.com, Bruce J Beare
On 05/24/2012 02:46 PM, Bruce J Beare wrote:
> Fixed in...
> https://android-review.googlesource.com/36990
> https://android-review.googlesource.com/36981

Thanks so much! I'll check it out.


Bruce J Beare

unread,
Oct 22, 2012, 4:09:23 PM10/22/12
to android-...@googlegroups.com
There were some other threads on this. It turns out that a change by Google is to have the virtualbox image utilize two virtual disks. One of them is for boot and system while the other is used for data and cache. You can work around this pretty easily... or you can just use both drives.

If you want to use just one virtual disk for everything, revert the following commit in the build/ project.

commit 277e68b3af2e6521d4bc28a1a2e6b49e2cf1134f
Author: Iliyan Malchev <???>
Date:   Thu Apr 5 16:11:15 2012 -0700

    init.vbox_x86.rc: mount data & cache partitions from /dev/sdb
    
    Change-Id: Ifa14f0be875848297883d2ee66372a355a4174e6
    Signed-off-by: Iliyan Malchev <??>


-Bruce

On Saturday, October 20, 2012 2:39:11 AM UTC-7, Denzil Ferreira wrote:
Hi Bruce,

I've been following this thread because I've also been trying to compile the image for vbox using the latest master. The build compiles fine but then I try to launch it, all I get is a black screen with GRUB written and it goes nowhere.

I've tried going back to 10.04, tried both GCC 4.6 and 4.4 and nothing changed.

Am I missing something?

¬Denzil

Denzil Ferreira

unread,
Oct 27, 2012, 9:01:55 AM10/27/12
to android-...@googlegroups.com
That worked!

On Oct 26, 2012, at 23:28 , Jaikumar Ganesh <jaik...@android.com> wrote:

Denzil,
   Reverting the grub change fixed it for me - https://android-review.googlesource.com/#/c/36730/


On Thursday, October 25, 2012 11:52:53 PM UTC-7, Denzil Ferreira wrote:
Hi Bruce,

It still doesn't work... I'm using the android_disk_vdi generated images. I'm using VirtualBox 4.2 in Ubuntu 12.04 and after I created the virtual machine and run it, all I get is a black screen with GRUB on it.

Are there any recommended configurations? I'm not using SATA if that comes to mind.

Thanks,

Denzil

--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

Bruce J Beare

unread,
Nov 29, 2012, 3:24:05 PM11/29/12
to android-...@googlegroups.com
I've been asking for a while... why do people still use the VB images?

If there are really some valid use cases the require them and can not be
satisfied with the emulator plus HAXM, I may be able to get
some better support for them.

-Bruce

Al Sutton

unread,
Nov 30, 2012, 5:31:27 AM11/30/12
to android-...@googlegroups.com
There were a number of crash reports with OS X 10.8.x. Do you know the status of those?

Al.

-- 
Al Sutton - Funky Android Ltd.

T: @alsutton  

The views expressed in this email are those of the author and not necessarily those of Funky Android Limited, it's associates, or it's subsidiaries. 

Jean-Baptiste Queru

unread,
May 15, 2013, 12:12:12 PM5/15/13
to android-...@googlegroups.com
This is not a configuration that gets used or tested much at Google, so you probably shouldn't expect that things will improve on their own. I might try to make sure that the code still compiles, but that's not even guaranteed.

JBQ


On Wed, May 15, 2013 at 4:19 AM, hz <zulla...@googlemail.com> wrote:
Thank you! Ok, now I get to the splash screen, but the system segfaults. Will have to wait for the next release, I guess.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jean-Baptiste M. "JBQ" Queru
Technical Lead, Android Open Source Project, Google.

Questions sent directly to me that have no reason for being private will likely get ignored or forwarded to a public forum with no further warning.

Daniel Fages

unread,
May 16, 2013, 8:25:10 AM5/16/13
to Android Building

Hi
Maybe you can try AndroVM.
http://androvm.org
Based on virtualbox and thus supports USB passthrough.

Dan.
PS: I'm the guy behind AndroVM

Le 16 mai 2013 13:19, "hz" <zulla...@googlemail.com> a écrit :



This is not a configuration that gets used or tested much at Google, so you probably shouldn't expect that things will improve on their own. I might try to make sure that the code still compiles, but that's not even guaranteed.

Yes, indeed it isn't working right now.

So what do you suggest? My scenario is this: I have here a USB stick for digital DVB-TV and want to try and port a Linux-based TV software to Android. What I need is an emulator that will allow developing on Android while accessing the USB device. The emulator that comes with AOSP does not support USB pass-through, right? Will it some day?

Thanks!

Jean-Baptiste Queru

unread,
May 16, 2013, 8:35:10 AM5/16/13
to android-...@googlegroups.com
At the risk of using a common Open Source cliché, the somewhat painful suggestion is "contribute the fixes and improvements that you'd like". VirtualBox is primarily used outside of Google and is unlikely to be actively maintained by Google. The emulator is developed directly in AOSP and contributions there are likely to get looked at quickly.

JBQ


On Thu, May 16, 2013 at 3:08 AM, hz <zulla...@googlemail.com> wrote:



This is not a configuration that gets used or tested much at Google, so you probably shouldn't expect that things will improve on their own. I might try to make sure that the code still compiles, but that's not even guaranteed.

Yes, indeed it isn't working right now.

So what do you suggest? My scenario is this: I have here a USB stick for digital DVB-TV and want to try and port a Linux-based TV software to Android. What I need is an emulator that will allow developing on Android while accessing the USB device. The emulator that comes with AOSP does not support USB pass-through, right? Will it some day?

Thanks!

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bruce J Beare

unread,
May 17, 2013, 8:08:17 PM5/17/13
to android-...@googlegroups.com
You might wish to check out http://01.org . Look for the Android link at the bottom right.
01.org has a repository for an Intel maintained AOSP port targeted for more "generic" devices
(laptops, core servers and so forth).

-Bruce

Ron M

unread,
May 17, 2013, 8:32:18 PM5/17/13
to android-...@googlegroups.com

Unfortunately he'd have a hard time booting virtualization images as current android-ia version is only supporting EFI.
Other than than all the bootable/ folder, a-ia is good. Even very good.
Android-x86 keeps virtualization working straight off the box, and with a little
effort, so is the AOSP's full_x86-* config with some minor modifications (depending on target VM.)

--
Reply all
Reply to author
Forward
0 new messages