How to Build CHROOT ARM Ubuntu Images for Android!

This is for those of you who want to learn how to build your own CHROOT ARM Ubuntu images for Android from scratch.

Why?  For example, perhaps you might want to include certain programs like SSH, Web server, etc…etc… so the Ubuntu image you ultimately end up using on your Android device will not have stuff you don’t want/need.

Also, this is actually a great way to learn about the whole process of running ARM Ubuntu on your Android device whether it be a smartphone or tablet.

How to Build CHROOT ARM Ubuntu images for Android

*Note – This guide will work on all ARM-architectures of Android including TI-OMAP, Samsung Hummingbird, and Qualcomm, so long as they are ARMv7 architecture. (e.g. Nexus One, HTC Evo 4G, Droid X, Droid 2,Samsung Galaxy S, etc…etc…)

1) First, you will need to a Ubuntu system 9.10 (karmic) or later, I used Ubuntu Lucid Lynx 10.4 on my Intel Core i7 desktop. *Actually running that of VirtualBox on my Windows 7 64-bit.

2) Open up a terminal on your Ubuntu system.

3) Let’s make an ARM Ubuntu image using Rootstock command:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 4G \
--seed linux-image-omap,build-essential,mysql-server,tightvncserver,lxde,mysql-server-core-5.1,mysql-server-5.1,libmysqlclient16,mysql-common,mysql-client-core-5.1

Here, you can set login/password to your liking, image size, and also different programs you want installed beforehand. You can always use apt-get to install more packages after you CHROOT.

You should end up with a file like armel-rootfs-201101311759.tgz with the datestamp of the time you ran the command.

4) Let’s make an empty image file with command, “dd”:

dd if=/dev/zero of=ubuntu.img bs=1MB count=0 seek=4096

Here, you can change the seek parameter to how big of an image file you want to make. I have it set to 4096, which is 4GB. If you want smaller or larger, change this value accordingly. E.g. 8192 for 8GB.

5) Next, we are going to format the image as ext2/ext3 filesystem so it can be compatible with our Android OS:
mke2fs -F ubuntu.img

6) Next, we will mount the empty image file to directory /mnt:
sudo mount -o loop ubuntu.img /mnt

7) Next, we will uncompress (untar) the ARM image we made earlier into the /mnt directory:
sudo tar -C /mnt -zxf armel-rootfs-200904151837.tgz

8) Once all the files are copied over, we simply unmount the image file and we are ready to rock and roll (or copy it over to your Android device)!
sudo umount /mnt

9) If you have trouble installing software using apt-get after you made this image, try installing it under CHROOT on your Ubuntu (not Android) by using QEMU user mode emulation.

References


ARM RootfsFromScratch – This is a great place to start on learning to build ARM Ubuntu images for Android.   Just make sure to use “mke2fs” instead of “mkfs.ext4″ as Android currently doesn’t support ext4 file system type (as far as I know and I’ve tried).



Recent Android News from HighOnAndroid.com

11 Responses to How to Build CHROOT ARM Ubuntu Images for Android!

  1. Andy says:

    Would you be able to do this for puppy linux?

    as an aside, do you install the OS on the memory card or phones onboard memory? How do you remove the installation? Thanks

  2. myhouse says:

    Sorry i’m newbie in linux. Could you please tell more detail step about doing this. I’ve follow the above steps, it always display the file is not exist after run command sudo tar -C /mnt -zxf my-file-name.tgz

    Anyone give me the link to download the compiled ubuntu version for Galaxy Tab P1000 ?
    Thanks

  3. Hi! I try to run in my android but I get the mesagen
    [1] segmentation fault chroot {$mnt} /b…

    May you help me?

    Thanks.

  4. sigmarhophi says:

    Good job on the how to. I would recommend using remix as it is designed for light weight devices such as tablets and netbooks. As a suggestion, to resolve the keyboard issue, use orca and have it display the gnome on screen keyboard. You can set it up while you are chrooted in, and it will auto launch every time you remote in to the environment. This will remove the complication of the VNC app, or extra hardware such as keyboards and mice and make the tablet function more like a native tablet should.

  5. Erez says:

    Great guide!

    I did have a problem when running this, though – the desktop environment failed (inappropriate ioctl) for almost every application.
    What should be in the mount table? Can I use the regular unionfs file?
    Mine contains:
    busybox insmod unionfs
    mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc

    mount -o remount,rw /
    ln -s $mnt/lib /

    for x in \
    bin boot home media mnt \
    opt selinux srv usr var
    do
    ln -s $mnt/$x /
    done

    rmdir /root
    ln -s $mnt/root /
    mount -o remount,ro /

    mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
    mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
    mount -t devpts devpts /dev/pts

  6. IUZGNU says:

    Hi,

    What about Armv6 ? (Galaxy 551). Is there a way to chroot and launch ubuntu 10.10 also ?
    Thank’s

  7. giancarlo says:

    hey would i flash this and run it nativly of through vnc

  8. Paolo says:

    Just in response to an earlier question, there is an arm version of the remix. I’ve been using it on a beagle dev board.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Related News and Resources