How to build AOSP FOr the D-INC (same principle for all devices)

First off, i want to say that this is information taken from various sources, the most predominant being start [CVPCS Android Wiki] and Get Android Source Code | Android Open Source . The only thing i contributed to this guide was that i condensed it a bit and customized it specifically for the incredible, although the only thing that differs from the incredible to other devices it the vendor setup.

WARNING: This is NOT FOR NOOBS. If you havent had much experience with working with the Android System, you should not even think about using this guide.

This is a guide for building AOSP on Ubuntu Lucid Lynx (10.04). If you have Mac, i cant help you much. If you have Windows, i strongly reccommend that if you havent already done so, download Ubuntu onto a CDROM and run wubi.exe to trial ubuntu.


Ok, so now that all that stuff is over, heres your guide:

First, we want to install java5. Java6, the newest java is NOT supported due to @Override incompatibilities

Code: 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

You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.

Code: sudo apt-get install valgrind

Set the system to use the right version of java by default:

Code: sudo update-java-alternatives -s java-1.5.0-sun

Now to install the repo

Code: cd ~/
mkdir bin
echo $PATH

Download thereposcript and make sure it is executable:

Code: curl >~/bin/repo chmod
a+x ~/bin/repo

Create an empty directory to hold your working files:

Code: mkdir mydroid
cd mydroid

Run “repo init” to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:

Code: repo init -u git:// -b froyo

When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account .
A successful initialization will end with a message such as repo initialized in /mydroid

Now to download all the files you need.

To pull down files to your working directory from the repositories as specified in the default manifest, run

Code: repo sync

NOTE: The repo sync does tend to take a little long, after all it is 2.1 gigs of files

Now to verify the git tags. Doing this wont affect the build, but it doesnt hurt.

In your command prompt, type:

Code: gpg –import

and paste this LONG key into the empty space:

Version: GnuPG v1.4.2.2 (GNU/Linux)

8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu 5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEa UA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDya TrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJn uyvoizl9/I1S5
b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGh lIEFuZHJv
aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cm lidXRpb25AYW5k
gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tg CdFfQYiHpYngkI
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71 MnrF6fj+Udtb5+
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDg pqt7Y7s
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior 6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmU tkBszwo
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KL M=

And press ctrl d to exit the gpg mode and verify the git tags.

Now to setup the vendor overlay:

cd ~/mydroid/system/device
cd htc
mkdir inc
cd inc
git clone inc

Code: cd ~/android/system/device/htc/inc

NOTE: ADB Must be in your path. You also have to edit the so that it reads ./adb pull and not adb pull (add nix boxes)

Now to build the build:

Code: cd ~/mydroid/system
. build/
lunch generic_inc-userdebug
make -j`grep ‘processor’ /proc/cpuinfo | wc -l` otapackage


Ok, lets say you get an error. most likely its librpc. What you have to do is

Code: make clean
make librpc

Also, you may have to edit some files, add in some proprietaries, so whatch those errors carefully! (also, you may get an error about recovrty not being made…all you have to do is replace the word “mahimahi” in the file to “inc”)

If the build fails because of java, enter this:

export $PATH

Adding SU:
This is a bit of a workaround for now, but this is how i did it:
1) Drag and drop superuser.apk from an existing rom and prop it into system/app of your AOSP rom
2) DRag and drop the su binary from an existing rom and drop it into your AOSP rom (in system/bin)

Disabling Recovery:
go to the root of the rom (in the part where it says “system, Boot.img, META-Inf, recovery-prerec”) and delete meta-inf, recovery-prerec. Add in the Meta-INF from HERE (, and viola, an AOSP rom with root is born!

This entry was posted in Android. Bookmark the permalink.

2 Responses to How to build AOSP FOr the D-INC (same principle for all devices)

  1. kchupe says:

    Nice tut! I’ll have to try it after I figure out kernel compilation. -Kevin

  2. That guy says:

    Thank you for this tutorial. I personally am not going to take on the task of building, but I’ve always wanted to know what the steps were out of curiosity. Some of us learn differently, and it’s great to know that I can look at the steps and learn by reverse-engineering.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s