How-to compile a fresh Android!

Search This thread

mylostnick

Senior Member
Oct 10, 2008
130
1
Hi all.
In this thread I'd like to collect all the information I've found scattered in various threads in order to compile Android system and kernel, directly from GIT repo.
Hoping this help who wants to try to compile Froyo from the GIT repo but really doesn't know where to start!!!

All credits for this infos, obviously, doesn't go to me but to all the great persons I've found in this forum, helping me with a lot of informations: Dzo, l1q1d, Kalt_Kaffe, Incubus and many others.

If something of the things written below is not correct... first of all forgive me! I'm only a newbie trying to do something useful for others like me!!! Then please... help me to correct the mistakes!!!
And then, please, forgive my really bad english! Any correction is appreciated!

DISCLAIMER: even if this steps have been personally tested by me everything u'll decide to do u'll do at ur own risk. The flashing procedure may brick your device.

I've implanted all the compiling environment in a virtual machine with the latest Ubuntu (10.04).
NOTE ABOUT VIRTUAL MACHINE: if you are using a virtual machine it's important that you setup it with at least 1,5GB or RAM. With less RAM than this your Android will not compile.

All you need to obtain a fresh Android System is only a lot of time (and patience) and at least 10GB of free disk space.
10GB is the very minimum disk space you need. If you decide to try in a virtual machine I suggest to create a virtual disk at least 20GB.


1) Install needed software
As in the latest Ubuntu version the repositories have the "sun-java6-jdk", with which you cannot compile Android, you have to install the previous Java version from the Jaunty repo. To do this edit, with your favourite text editor and using "sudo", the "etc/apt/sources.list" file adding the following two lines:

Code:
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

and then, from a terminal, run the following commands:

Code:
sudo apt-get update
sudo apt-get install sun-java5-jdk

After this you can delete/comment the two lines added above in the sources.list file.
Then, according to the instruction described here, install the needed software with the following command:

Code:
$ sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind


2) Installing repo and configuring the environment

After the installation of the needed software follow this steps to create the right environment for ur compilation. I assume to work in my "/home/virtual" directory. If d'u like to work in another directory simply replace this path with yours in the commands.

Code:
$ mkdir bin
$ PATH=$PATH:/home/virtual/bin/
$ curl http://android.git.kernel.org/repo > /home/virtual/bin/repo
$ chmod a+x /home/virtual/bin/repo
$ mkdir mydroid 
$ cd mydroid


3) Downloading, syncing and compiling the source

Now that you are in the destination directory (I've called it "mydroid" but obviously you can call it with every name you want) you've to init and syncing your repo with the one on the server.
The "init" step have to be executed only the first time. Then you can start directly from the "sync" command.
The following steps may need a looooooot of time (about 3 hours in my virtual machine) so you can have one (or two maybe!!!) coffee in the further coffee bar in your city!!!
Anyway let's go:

Code:
$ repo init -u git://androidhtc.git.sourceforge.net/gitroot/androidhtc/manifest -b froyo
$ repo sync
$ . build/envsetup.sh
$ lunch full_vogue-userdebug
$ make

With these commands you'll obtain a system with all languages in it.
You'll find the "system" folder under "out/target/product/vogue". Simply tar it and you're in!!!


4) Compiling the kernel

If you only want to compile the kernel you have to follow this steps (from your repo dir - "mydroid" in my case)

Code:
$ cd kernel

Open, with your favourite text editor, the file "Makefile" and change the CROSS_COMPILE line like the following:

Code:
CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

then run the following commands:

Code:
make vogue_defconfig
make

After the compilation you'll find the "zImage" file into "kernel/arch/arm/boot/" and use it like you want (I.E. I compile it with NBHCreator in order to flash it into my Polaris).

That's all, folks!!!
Enjoy!
 

threeeye

Senior Member
Apr 4, 2010
378
22
USA
Initializing project gps ...
fatal: The remote end hung up unexpectedly
error: Cannot fetch gps

way not?
did it finish or did it get stuck and there is more to fetch?