Building an Android Donut ROM – Part 1 of 4
Well, I was planning to write my own tutorial about building an Android Donut ROM (which I successfully managed to do btw), but it took me so long and a lot of messing around with it that I, honest to God, cannot remember which changes I had to make. That is why I asked Chris Soyars if I could blatantly copy his tutorial and he agreed
So without further ado, here is Part 1 of ‘Building an Android Donut ROM.
Building Android is pretty straight forward but when I first went about doing it, I felt like I had to figure most of it out on my own.
In the first part of this four-part post, I’ll go over building Android from source, step by step.
These instructions will assume you are running Ubuntu 9.10 x86 (32-bit) (though older versions should work). Detailed instructions after the jump!
Setting up the Environment
First things first, you need to install some packages.
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
Now we need to install a convenient tool provided by Google to actually pull down the source code.
$ cd ~
$ mkdir bin
$ export PATH=$PATH:~/bin
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod +x ~/bin/repo
This downloads the repo client to a bin directory for your user. In order to use this command anywhere, we also add ~/bin to your path. This will not be a permanent change unless you modify your ~/.bashrc file to do the same. Open up ~/.bashrc with your favourite editor and head down to the bottom (where the export PATH command is usually located). Simply append “:/home/username/bin” to the end of this line, not including the quotes.
Downloading the Source
Now we’ve got everything we need to start downloading the source code. For simplicity purposes, we will use Cyanogen’s public GitHub repositories which include his custom vendor tree and provides cool stuff like Apps2SD, bug fixes, optimisations and more. Additionally, we will build the donut branch of Android, as there are still some kinks to work out in the eclair branches.
$ mkdir donut-build
$ cd donut-build
$ repo init -u git://github.com/cyanogen/android.git -b donut
$ repo sync
This is going to take a while to download, as the Andoid source is about 2GB in size.
What is this doing you ask? Android uses git for it’s source code repositories. Git is decentralised, and you are actually checking out a full copy of each repository. To make things easier, Android keeps bits and pieces of the entire platform in different repositories. While you wait for everything to download, take a look at the Android Repositories.
Start the Build
Ok, so everything has been downloaded. You’re ready to build!
Not quite. We are going to build donut for the dream (and also sapphire). Not everything is open with Android, such as various hardware drivers, which are provided by HTC. Head on over to the HTC developer’s site and download the follow files:
- htc-adp1.sfx.tgz – HTC Proprietary Binaries for ADP1. Put this file in vendor/htc/dream-open
- signed-google_ion-ota-14721.zip – Recovery image for Sapphire (click on Google I/O Device). Put this file in your main donut-build directory.
- signed-dream_devphone_userdebug-ota-14721.zip – Recovery image for ADP1 (click on Android Dev Phone 1). Put this file in your main donut-build directory.
Ok, now that you’ve got those files we need to do something with them.
First, let’s extract the proprietary binaries which include things like the radio interface libraries.
$ cd vendor/htc/dream-open
$ tar zxf htc-adp1.sfx.tgz
$ ./htc-adp1.sfx
Now we will extract some dream specific binaries. This includes camera drivers, sensor drivers, gps drivers etc.
$ ./unzip-files.sh
Let’s move into the sapphire directory and do the same thing.
$ cd ../sapphire-open
$ ./unzip-files.sh
$ cd ../../../
You should now be back in your main donut-build directory. Next we will source a hand file which loads up the available build targets, and then pick a build target.
$ source build/envsetup.sh
$ lunch cyanogen_dream_us-eng
Sourcing Cyanogen’s vendor trees gives us all of his cool enhancements as opposed to sourcing one of the AOSP vendor trees.
Now, we are ready to build!
make -j2
Now, sit back and relax while the platform builds! In Part Two we will cover building a kernel and packaging it with a ramdisk to form a boot image.









hey great tutorial only problem is when it comes to make -j2 i get make: *** No targets specified and no makefile found. Stop.
any ideas here?
woops i accidently deleted the make file all fixed now lol :$
Custom Search
Subscribe to the AndroidUnderground feed
Subscribe to the Android Underground
APP STORE
Categories