Lab5 - Configure and Build Android on Beagle Board

ObjectiveConfigure and Build Android on Beagle Board
  • Install needed software packages 
  • Android also uses its own repo script as a git front-end
  • Download and Install 2007q3 Toolchain from Code Sourcerys
  • Download resources
  • Building Android
  • Building the kernel
  • Copying the android root file system
  • Formatting an MMC/SD card

  • Boot setup

  1. Ubuntu 10.04 (Lucid Linux) on a virtual machine (VMware Player/Server/Workstation)
  2. SD card  (2 GB Preferred)


(1) Install needed software packages

At the time of this writing, note that Android requires Sun’s Java5 JDK, and doesn’t support the Java6 one.
 $ apt-get update

 $ apt-get dist-upgrade

 Install following packages as below.

$ apt-get install git-core bison sun-java5-jdk flex g++ zlib1g-dev

$ apt-get install  libx11-dev libncurses5-dev gperf uboot-mkimage

Sun JDK version 1.5 or 5 is deleted from Ubuntu 10.4 and 9.10 repositories and the version 6 has been replaced. The easiest way to install Sun JDK 5 version is add its repository from Ubuntu 9.04 to the list of repositories in 9.10 and 10.04. For this purpose, follow the steps as below.

- Open /etc/apt/sources.list with a text editor like gedit:

$ sudo gedit /etc/apt/sources.list


- Add the following lines to the end of the file then save it and close:

## For sun-java5-jdk

deb jaunty-updates main multiverse


- Update the packages lists and install sun-java5-jdk:

$ sudo aptitude update

$ sudo aptitude install sun-java5-jdk


(2) Android also uses its own repo script as a git front-end

$ mkdir -p ~/bin

$ cd ~/bin

$ wget


$ chmod +x repo


(3) We are also going to need a 2007q3 Toolchain from Code Sourcerys

$ cd

$ wget



$ cd /opt

$ sudo tar jxf arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

You could also get this toolchain from our website: 

$ cd

$ wget

$ cd /opt

$ sudo tar --lzma -xf ~/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.lzma


(4) Download resources

Following instructions will create a directory in your home directory, but of course, it can be placed anywhere!

$ mkdir ~/beagledroid

$ cd ~/beagledroid

$ repo init -u git://

$ repo sync

This will take a lot of time, as this downloads and extracts 2.4 GB of data. On a fast workstation with a 500KB/s Internet connection, it took about 90 minutes
. If your network doesn't let you use the git protocol, you can use snapshot available on

$ cd ~

$ tar --lzma -xvf beagledroid-git-20090603.tar.lzma

I used a 2nd option which is much faster than 1st method.

(5) Building Android

$ make

If your workstation has multiple CPUs, you could save a lot of time by running multiple jobs in parallel:

$ make -j 4

On our machine, this took about 4 hours!

(6) Building the kernel

$ export CC_PATH=/opt/arm-2007q3/bin/arm-none-linux-gnueabi-

$ cd ~/beagledroid/kernel

$ ../vendor/embinux/support-tools/


(7) Copying the Android root file system

Android’s root file system is generated in ~/beagledroid/out/target/product/generic

$ cd ~/beagledroid/out/target/product/generic

$ mkdir ~/beagledroid/rootfs

$ cp -a root/* ~/beagledroid/rootfs/

$ cp -a system/* ~/beagledroid/rootfs/system/

$ cd ~/beagledroid/rootfs

$ sudo chown -R root.root .

$ sudo chmod -R a+rwX data system


(8) Formatting an MMC/SD card

First connect your card reader to your workstation, with the MMC/SD card inside. Type the dmesg command to see which device is used by your workstation. Let’s assume that this device is /dev/sdb

Type the mount command to check your currently mounted partitions. If MMC/SD partitions are mounted, unmount them.
In a terminal edit partitions with fdisk:

$ sudo fdisk /dev/sdb

Delete any existing partition with the d command. 

Now, create the boot partition:

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)


Partition number (1-4): 1

First cylinder (1-239, default 1): 1

Last cylinder, +cylinders or +size{K,M,G} (1-239, default 239): +64M


Change its type to FAT32:

Command (m for help): t

Selected partition 1

Hex code (type L to list codes): c

Changed system type of partition 1 to c (W95 FAT32 (LBA))
Using the n command again, create a second partition filling up the rest of your card (just accept default values).
Now, format the partitions in your card:

$ sudo mkfs.vfat -n beagleboot -F 32 /dev/sdb1

$ sudo mkfs.ext3 /dev/sdb2

Remove and insert your card again. Your new partitions should be mounted automatically.
Copying data to the MMC/SD card
Start by copying the X-loader and U-boot on the first partition.

$ cd /media/beagleboot

$ wget

$ cp ~/beagledroid/kernel/arch/arm/boot/uImage .


Now copy the Android root filesystem to the second partition (assuming it is mounted on/media/disk:

$ sudo rsync -a ~/beagledroid/rootfs/ /media/disk/

Finish by unmounting your MMC/SD partitions:

$ sudo umount /media/beagleboot

$ sudo umount /media/disk


(9) Boot setup

The last thing left to do is to specify how the board boots Linux.

Plug the Beagle board on your computer, and also connect it to a DVI-D monitor. Start minicom (corresponding to Hyperterminal in Windows) on /dev/ttyS0, or on /dev/ttyUSB0 if you are using a serial to USB adapter. Power up the board.First, stop Minicom from truncating long lines by typing [Ctrl] [a] followed by z and w.

In the U-boot prompt, make the board boot automatically on the MMC/SD card:

# setenv bootcmd 'mmc init;fatload mmc 0 80000000 uImage;bootm 80000000'

# saveenv

Now set the kernel command line arguments:

# setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 video=omapfb.mode=dvi:1280x720MR-24@50 init=/init rootfstype=ext3 rw rootdelay=1 nohz=off androidboot.console=ttyS2


Type command as below on “beagleboard prompt” as below

# boot

Following snapshot shows Linux kernel prompt resides under Android.


[1]       Build Android on Beagle Board from Free Electron website

[2]       Solution of problem in installing sun-java5-jdk in Ubuntu 10.04

[3]       Android on BeagleBoard information page

[4]       Configure and Build