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 \
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.
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).