[GUIDE] How to build your fav. KK ROM (CM-AOKP-Carbon-Slim) for your N5 from source
Hi, my name's Stefano I'm from Italy, and sorry for my poor english. This is the guide to build your own the KitKat (or whatever branch you want) for your HammerHead. We'll start, obviously, setting up your client (PC), and here we'll use ubuntu x64. Is possible to use almost any linux distribution (also MacOSX) but I prefer to stay on what is much supported and known (for me!). This guide is taken from internet and reading forums/blogs. I didn't invent anything, you can found a lot of guides like this. Just this is updated with last changes. For the setup part I read and paste a lot from here
(thanks to sylentprofet).
Regard the hardware side you'll need at least of:
- a Dual Core processor
- 4 Gb of RAM
- 80 Gb of hard disk for each repository (Better if SSD but don't required)
- The Graphics Card don't care, we don't use to compile
- A good internet connection, you have to download up to 40 Gb of stuff
- A lot of patience, if you aren't go to download a ready ROM, it's better!
- Time, time, time, time and again time!
How to Configure Ubuntu for Properly Compiling Android ROMs
This guide applies to Ubuntu 13.04 Raring Ringtail 64 bit (but also down to 12.04 LTS which is the version that I prefer). Do not use the 32 Bit version. Also, PAY CLOSE ATTENTION
when to use “sudo” and when to not. It can make things funky if you do something as root that you shouldn’t. During normal build you don't have absolutely need to use "sudo", just during the PC setup.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
First, let’s set up the correct JDK.
Many of you probably have some kind of wrong Java installed. Sad cupcake.Let’s get rid of that. Copy and paste this into a Terminal window:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Back to the Terminal. Copypasta the following:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.04 (or less). No more unrecognized Java version errors! Yay! And it’s self updating, so you don’t have to redownload binaries everytime they release a new version.
Next, we actually need to install the package. More copypasta:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the onscreen instructions. You have to Accept the Licensing Agreement or whatever. Hopefully no human centipede clauses. Once that is completed successfully, you will have to restart any open browsers with Java content for it to display correctly.
To make sure the correct version of Java is activated, run the following at the Terminal prompt:
You should see something like the following:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
Since Canonical has decided to end support for the transitional package of ia32-libs. This will not allow 64 bit versions of this distribution (13.10) to access Secondlife. Here is a workaround using ia32-libs from a previous distribution (13.04). This has been tested with the release candidate of 13.10 and all is well and functional.
Install Synaptic from terminal window
sudo apt-get install synaptic
Launch synaptic and goto “settings > Repositories”
click “other software > add”
insert this line in the box:
deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse
click ok and close synaptic
sudo apt-get update
sudo apt-get install ia32-libs
And we wait. Don’t worry, this isn’t the crazy downloading part just yet.
When that is done, do this:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Now it's time to download and setup SDK Tools. First of all download Android SDK Tools for Linux x64
. Extract the folder “sdk”, inside package, into your "Downloads" folder and rename it to "AndroidSDK" e.g..
Then come to your terminal and type:
You can now see the GUI that propose all installable packages. Install Platform tools and Tools for most recent Android (4.4), with the most higher API (19+) version. Flag "accept" and install.
Once is complete, you have you need the binary for repo that will let you talk to git servers and download all that precious source code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Open "~/.bashrc" to add a line:
sudo nano ~/.bashrc
At the very bottom, add the following line:
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Type to restart bash:
Now you have all need to work (or play) with your ubuntu and it's time to give the sources (repositories) from your preferred Team (who share the source code for their rom). The most known host service for sources and projects is GitHub. E.g. https://github.com/CyanogenMod/
The point of start of any repo is its "manifest" (default.xml) where the team list all it's projects (here
an example), only the necessary to the building process.
Until last year was necessary to compile (before begin and looking to platform manifest) an own local manifest where we exclude from download all the devices/kernel/vendor parts unnecessary for our device. This saves up to some Gigabytes of download.
Fortunately now the repositories will download itself the necessary devices/kernel/vendor parts when we'll choose ("lunch") the device to build ("make"). With the exception of AOKP who wanna know, before initialize your local repo, for which device/s you'd like build.
Now I'll write a section for each Team/ROM you want to initialize, that's for me has sense. How take a sense to put each "platform/project" in a different folder (e.g. CarbonDev in a folder and Cyanogenmod in another, both sons of your Home folder).
In the waiting to read next part, better familiarize a little with terms like "breakfast, brunch, lunch, make" into Android