First, we will need to set up the tools and libraries needed to download Android. This guide assumes you're running Ubuntu 12.04 LTS.

Downloads needed libraries:

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/ /usr/lib/i386-linux-gnu/

Make a directory for repo, add the directory to your path, download repo and then make it executable:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl > ~/bin/repo
$ chmod a+x ~/bin/repo

Make a directory for the build environment, then initialize:

$ mkdir ~/gingerbread_pi
$ cd ~/gingerbread_pi​
$ repo init -u git:// -b gingerbread

Next up is syncing the tree, this may take a while:

$ repo sync -j16

When that's finished, download the device tree for the Raspberry Pi:

$ mkdir -p ~/gingerbread_pi/device/rpi
$ cd ~/gingerbread_pi/device/rpi/
$ git clone 
$ mv device_rpi rpi

The source code needs some other changes to work with the R-Pi. Run this to do that automatically:

$ cd ~/gingerbread_pi/device/rpi/rpi
$ ./
$ cd ~/gingerbread_pi

And finally run...

$ source build/
$ lunch
$ make -j4 build. Select the appropriate target. Your build will be in out/target/product/rpi/root. The 'system' folder needs to be copied into 'root'.

The files that are in the root folder should be copied to the root of your filesystem partition.