Saturday, March 20, 2010

Building AT91SAM9G20-EK Android

Android for AT91SAM9G20 is using repo just like regular Android and you should start by setting up your system and repo as described in "Get source" (http://source.android.com/download).

This guide assume that you use Linux as a host. The build has been tested on an Ubuntu 9.04.

Instead of using the manifest from android.kernel.org initialise your repo with the following:

repo init -u http://blue-kite.dk/repos/at91sam9g20-manifest.git/
repo sync

This will clone all the source code needed. Most of the source comes directly from android.kernel.org git repository and the AT91SAM9G20 specific stuff must be manually patched before compile.

repo start at91sam9g20 --all
at91sam9g20-android/patches/apply.sh

This will create a branch at91sam9g20 and apply the AT91SAM9G20 specific patches to the checkout. Note that the changes are not commited yet. If you would like to commit the changes use "repo status" see the modified files and go through each changed git repository and do a "git add ." and "git commit".

To build do:

make

this will take a long time.

When the build is finished you now have an Android kernel and a root filesystem.

The Android file system is split in two different parts: root and system. To create tarballs these do:

tar -cvjf root.tar.bz2 -C out/target/product/generic/root .
tar -cvjf system.tar.bz2 -C out/target/product/generic system



To build the linux kernel go to the common directory and execute:

make ARCH=arm at91sam9g20ek_defconfig
make ARCH=arm CROSS_COMPILE=$(pwd)/../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
mkimage -A arm -O linux -C none -T kernel -a 20008000 -e 20008000 -n linux-2.6 -d arch/arm/boot/Image uImage


Now you have a workin uImage containing a Linux kernel with the necessary Android specific patches.

If you havent the u-boot mkimage utility install it on Ubuntu with:

sudo apt-get install uboot-mkimage

No comments:

Post a Comment