Source Code Tinkering

Lets jump right into it. The Android source is opensource and can be downloaded from here. Now the post on the Android website is bit outdated so a number of changes have to be made. I have worked with gingerbread, but getting the earlier versions (eclair, froyo, cupcake) follows the same rules.

I’ve tested out the source on a couple of different platforms and believe me it was a nightmare. For the Gingerbread aka Android 2.3 the following requirements should be met

  • Ubuntu 10.04 – 64bit
  • 3 Gigs RAM
  • 150 Gigs HDD

Preferably this can also be done on a virtual machine but its memory should be flexible. I have given it a try on VirtualBox by Sun Microsystem. I would not recommend this, as people usually run into memory issues when testing and building the code. After you have had your machine up and running it is important you run any necessary updates and include libraries if you would like to. Nothing happens if you do not, but to be on the safe side, from your terminal run

$ sudo apt-get update

Step 1: Create a working directory

Choose a directory of your choice and give it a name and include this directory to your PATH

$ mkdir ~/androidsource
$ PATH ~/androidsource : $PATH

Step 2: Downloading the repo client and giving it privileges. The repo script is written for retrieving the necessary items from the Android tree so that we don’t have to. We also need to give the folder privileges

$ curl > ~/androidsource/repo
$ chmod a+x ~/androidsource/repo

At this  point, you should be having the androidsource folder with the repo script downloaded. Create another directory within the /androidsource directory. This is the working set.

Step 3: Initialize the repo client and sync it.

bin@asym:~$ mkdir gingerbread
bin/gingerbread@asym:~$ repo init -u git:// -b gingerbread
bin/gingerbread@asym:~$ repo sync

Both the above commands are run from the working directory. The complete tree can be downloaded by removing the -b identifier where as particular branches (eclair, froyo, cupcake, gingerbread or honeycomb) can also be pulled. Repository synchronization removes any discrepancies in the original tree.

Sit back, relax and have a couple of cups of coffee cause this takes hell lot of time if you are on a 1Mbps connection or less. In the end you would see your working directory, in this case named gingerbread, being populated with directories. If there are errors at the end or the sync is terminated, there is some thing that you have not followed.

Next part we shall cover how to load this into Eclipse for example.


About this entry