Tuesday, August 16, 2011

Dual booting Android-x86 and Ubuntu

During this long weekend I finally tried out Android-x86 (v2.3.5 and "generic_x86" Target) on my Dell-XPSM1210 laptop. Most of the things (Touchpad, Audio-Out, Keyboard, WiFi, Ethernet) worked right out of the box. Others (e.g. Bluetooth, Audio-In, Mouse etc) are yet to be tested.

Clone, Build and Image-Creation.

I cloned (~3GB) and built the sources from Android-x86 Git repository as mentioned on their wiki-page. This complete process took close to 12GB of my hard-disk space. I chose to build the USB bootable image (make usb_img TARGET_PRODUCT=generic_x86 -j3).

Note:
At first attempt gingerbread-x86 manifest either did an incomplete clone or cloned a wrong branch/commit of "platform/external/elfutils" and "platform/external/elfcopy" projects. You know you need to checkout the correct one (or do a "repo sync" again) if you get errors like "libelf.h or libebl.h not found" during compilation.

After successful compilation I followed the instructions on their installation page to copy the resulting USB image (out/target/product/generic_x86/generic_x86_usb.img) to a USB drive.

First Run and Installation on hard-disk.

Once the image is ready, I restarted my machine and boot from USB disk. Grub is pre-installed on USB disk but the Root is wrongly set (at least in my case it was not correct). It was set to "hd0,1" while mine was/is "hd0,0". You may want to take care of this if you don't see Android-x86 grub menu.

I first did a Live image booting and within few seconds I reached home-screen. Everything worked perfectly. Within next few moments I knew, I was going to install it on my hard-disk which I eventually did :) but without installing Android-x86 Grub bootloader.

Dual Booting Android-x86 and Ubuntu.

I modified Ubuntu Grub2 to add Android-x86 menu entry. It was a bit tricky and took quiet a while to understand that root=(hd0,X) is not a valid root-point and you should use root='(hd0,msdosX)' instead, at-least on Ubuntu Grub2 bootloader. Here is what you need to do:

Create/Modify "/etc/grub.d/40_custom" script:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.
# Simply type the menu entries you want to add after this
# comment. Be careful not to change the 'exec tail' line above.

menuentry "Android-x86 2.3.5" {
    set root='(hd0,msdos2)'
    linux /android-2011-08-15/kernel quiet root=/dev/ram0 \
    androidboot_hardware=generic_x86 \
    acpi_sleep=s3_bios,s3_mode \
    video=-16 DPI=160 SRC=/android-2011-08-15
    initrd /android-2011-08-15/initrd.img
}
       
menuentry "Android-x86 2.3.5 (Debug mode)" {
    set root='(hd0,msdos2)'
    linux /android-2011-08-15/kernel root=/dev/ram0 \
    androidboot_hardware=generic_x86 \
    acpi_sleep=s3_bios,s3_mode \
    video=-16 vga=788 SRC=/android-2011-08-15 DEBUG=1
    initrd /android-2011-08-15/initrd.img
}

Once this menu-entry is created, update Grub2 by running "update-grub2" command as sudo/root user. Now you should see the corresponding entries in Grub2 menu (/boot/grub/grub.cfg) and your machine should boot into Android-x86.

Next task is to explore how to use Android Market if it is at all possible.

11 comments:

  1. Hi. I'm an Ubuntu user interested in dual-booting with Android 2.3, but I'm fairly new to compiling from source. Apt refused to install a few of the dependencies, and I have yet to figure out which package contains 'repo'. Which version of Ubuntu did you use to compile, and did you encounter similar issues when preparing your system for the build?

    ReplyDelete
  2. Repo is not a standard Linux tool. You will not find it in Ubuntu repositories. You need to download it using curl. Here http://source.android.com/source/initializing.html and http://code.google.com/p/rowboat/wiki/ConfigureAndBuild are the detailed instructions to set up your build environment.

    ReplyDelete
  3. After much research, I was able to get repo installed. However, it never allowed me to download the source (it complained about connection problems). I was able to find a generic .iso of android-x86 2.3, and now I am successfully dual-booting.

    Setting the root point for Grub2 at (hd0, msdos2) did not work for me— I set it at (hd0,3). I formatted some blank space to ext3 before installing. I can only assume that the default filesystem format for android-x86 is FAT32.

    ReplyDelete
  4. Will generic .iso of android-x86 2.3 work on desktop pc or only on laptops, I can only find generic .iso of android-x86 2.2 (Froyo) but on latest version. Can u send a link

    ReplyDelete
  5. Can you please post "generic iso of android 2.3" which works on desktops.

    ReplyDelete
  6. generic_x86 should work on both desktop and laptop. I'm running it on a dell laptop. I dont have link to images. I downloaded the gingerbread sources for generic_x86 and build the images.

    ReplyDelete
  7. The Live CD iso from Android x86 project has only eeepc, sparta, tegra etc but no generic iso

    ReplyDelete
  8. Hi Pundiramit,
    But does your multi-boot actually work on Ubuntu?
    I am having issues

    ReplyDelete
  9. There is no GENERIC 2.3 Gingerbread on the android x86 project download page.

    ReplyDelete
  10. Hi, I found your blog after searching about this a lot... I have an old Acer Aspire One ZG5, this computer runs Ubuntu 11.10 with Unity 2D, I installed a partition with the file android-x86-3.2-RC2-eeepc.iso downloaded from the android x86 project page. It worked fine but I can't make it dual boot... after I did what you said here, nothing happened, but now I discovered that it's because your version is not the same I use.

    So my question is pretty obvious, can you give me some instructions to dual boot ubuntu 11.10 and android-x86-3.2-RC2???

    BTW, I'm a Veterinarian, not a programmer, so I have no idea what to do (That's why I'm asking), BUT I'm not affraid of breacking something, this is just an old computer I'm using just for that, testing linux distros... so please help... ;)

    Thanks in advance.

    Regards.-

    ReplyDelete
  11. thank you very very much..and much and more!!even i have tried many steps past 13 days!!your steps have been worked for me!!!thank you very very much..

    ReplyDelete