We'll be using one key command , repo, to download the OS from the Git repository.
be patient and read the full article, it will explain all.

First of all, you can't play with it on your beloved Windows (to be specific, Android 2.2 Source Code development doesn't support Windows) . you'll have to get a Linux (preferably Ubuntu, as they've used Ubuntu) to work with the source of Android 2.2.

Second, Not all the things written in the documentation are correct. I cam across many anomalies in the documentation, sometimes total contradictions too, so I'll be discussing the real details too.

You should have a Mac or Ubuntu machine, as Windows is not yet supported. Now here's the catch, the documentation says they haven't tested 64 bit versions of Ubuntu and prefer to have feedbacks, but the reality is, if you are going to work with Android 2.2 or higher, you wouldn't be able to build your source if you aren't running a 64 bit version. so better get the 64 bit version of Ubuntu and follow the steps ahead. and please, do get a hi end system with at least 3 GB of RAM, good 64-bit processor-motherboard and nice HDD space, as while development and building, Android OS becomes a monster in every aspect.

As soon as you finish setting up your Ubuntu 64, you'll have to setup some more things. use this command to get them:

Notice here, there are a lot of packages being installed, but perhaps you won't be able to install sun-java5-jdk as its not available in Ubuntu repository. You'll have to install it via Sun's website. AND it will also not be supported, as Android 2.2 will require Java6. don't go by the documentation for this. this is why i have written it in strike-through.

Now, install Java6. to ask how this will be done, ask me separately or google for it, as this article isn't about it.

Repo & Git: Repo is a client that fetches the source of Android OS from the git repository. Google guys maintain the code of Android on git, and its updated frequently, so now you'll have to setup repo and fetch the source code.

Configuring Repo:

To download repo, you'll have to follow some easy steps, follow these lines:

now the next step is to fetch the whole Android code. hold your breath, its of about 2.1 GB, and will take a LONG time! run this command:

$ ./repo init -u git://android.git.kernel.org/platform/manifest.git

Notice that the documentation doesn't include a './' before repo in this command, but you'll have to include it in order to run it. this will download the manifest and will set the repo client up, so that when you sync, it downloads the correct thing. It will ask for your name and email, so give it. better if its a Google account, it can be used to submit back the code. The next command will start download:

$ ./repo sync

this command will start syncing your current directory (that is ~/bin) with the Android 2.2 git repository. As this process is going to take time, you can go out for a walk or a game.

Every time you run the syncing, it will sync your base code with the code available in the repository, so possible upgrades will happen. It will be good if you follow a good backup policy.

When you're back, the Android OS might have got downloaded by then, and you can begin experimentation with it.

That's it for now. In my next post I'll explain how to setup Eclipse for Android Source modification and how to build the whole OS.