Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android has a large community of developers writing applications ("apps") that extend the functionality of the devices. There are currently more than 250,000 apps available for Android. Developers write primarily in the Java language, controlling the device via Google-developed Java libraries.
Android is linux based and open source. We can download sources and build images for supported boards. In this document, we will try to build kernel and rootfs for beagleboard. Beagleboard is manufactured by Texas Instruments and it is good for doing development. You can check beagleboard from here. I have beagleboard C4 revision and all works below is done on it.
There are many projects use beagleboard. Some of them are aimed to run android on beagleboard such as 0xdroid, Beagledroid, Android on Beagle and Rowboat. The most popular projects which use android is Angstrom and Rowboat. Angstrom is an embedded linux distrubition for variety of embedded devices and off course it is ported for beagleboard too. Angstrom is built from Openembedded, you can check manual how to configure and build it from here. Another project ,Rowboat, provides a stable Google Android base port for AM1808, OMAP35x, AM35x, AM37x, AM389x and DM37x platforms. Our board platfor is OMAP35x and we will use Rowboat to build images for beagleboard.
There are a lot of documentation about compiling android sources for beagleboard however reading all of them takes too time and we tried to create a document to tell just necessary instructions. In document you will see links as references and if you want to go further, sure you can.
We will use Gingerbread-2.3 version but you can see other version build instructions on reference links. Lets start!
Android use git repository with repo tool. Then if you already do not have, you should install git and get repo tool at first as below:
sudo apt-get install git-core
chmod +x repo
sudo mv repo /bin/
We will use just "init" and "sync" commands of repo tool, you can see other commands and options from here.
Now we need sources. You can download from repository over internet or you may download all needed repository as tar package. We will show both.
If you want to download tarball package just use these commands and your build environment gets ready:
wget http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_GingerBread_2_3_DevKit_1_0/ exports/TI_Android_GingerBread_2_3_Sources.tar.gz
tar xzvf TI_Android_GingerBread_2_3_Sources.tar.gz
repo sync --local-only
Secondly, if you want to download from repository, follow these steps:
Create a new directory and init repository as below. Your name and mail address will be asked while initing repository, you can enter anyting.
repo init -u git://gitorious.org/rowboat/manifest.git -m TI-Android-GingerBread-2.3-DevKit-1.0.xml
By commands above, we configured our manifest file as TI-Android-GingerBread-2.3-DevKit-1.0.xml. Our build operations will be up to this file. You can think it as configuration and selected application file. By sync operation, it gets sources. It may take hours depend on your bandwith.
At this point, we have sources, toolchain and ready to build but we should add toolchain binary path to our PATH environment to be reachable when needed. In my system I add as below, you should enter your local path where it is.
if you want to make it permanently you can add command into ~/.bashrc or ~/.profile scripts which run every shell login.
Now time to build. Enter top directory and run commands to get kernel image and rootfs:
make TARGET_PRODUCT=beagleboard -j4 OMAPES=3.x
Our target product is beagleboard. It is recommended to use more than one thread on multi core systems, specify -j number_of_threads for this. Set OMAPES variable to install proper version of SGX driver, our board is use version 3.x.
After successful compilation, we should have kernel image in "kernel/arch/arm/boot/" directory. uImage will be used as kernel. In addition, we should have "out/target/product/beagleboard/root" and "out/target/product/beagleboard/system" directories which are our rootfs images sources. We should create a rootfs directory and copy root and system contents to this directory. Then we will create a tarball.
cp -r root/* android_rootfs
cp -r system android_rootfs
sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2
Now we should have kernel image and rootfs tarball. Next time we will explain how to write kernel and untar rootfs to mmc card partitions. Then we will use mmc card for running android on beagle board. Have a nice coding!