- Linux based operating system -- Tested on Ubuntu 12.04, 12.10, 13.04 (64bit)
- Decent hardware (minimum of at least a dual core CPU and 4 GB of RAM)
- Optimally have an SSD (standard mechanical drives work as well but slow down the process drastically)
- Must have required packages for building installed, I will list them further down
Required Packages (based on Initializing a Build Environment)
Based on the version of Linux you run you might need to install slightly different packages. The following is for Ubuntu 12.04 and later:
sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \ pngcrush schedtool
After installing the packages you need to create a symlink:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
It is recommended to build Android using the Oracle JDK 6. However it is no longer available as package in Ubuntu. A good source is http://www.webupd8.org
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
sudo update-java-alternatives -s java-6-oracle
sudo apt-get install oracle-java6-set-default
Make directory for repo binary
mkdir ~/binAdd directory for repo binary to your path
PATH=~/bin:$PATHDownload repo binary and place it in the proper directory
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repoGive the repo binary the proper permissions
chmod a+x ~/bin/repoCreate directory for where the AOKP repo will be stored and synced
mkdir ~/aokpMove to our new AOKP directory
Download the source
Please read the AOSP building instructions before proceeding. Initialize
repo init -u https://github.com/AOKP/platform_manifest.git -b jb-mr1Run the following to sync the source
Download the kernel source
Integrated kernel building is now required to compile AOKP for all supported devices (even Nexus devices!) From the root of your source tree, run the following script to grab the kernel sources required
Advanced users: Since the kernel trees are fairly large, you may want to sync only specific kernel trees for devices you build for, take a look at the file .repo/local_manifests/kernel_manifest.xml. You can edit this file to suite your needs.
After the sync is finished, please read the instructions from the Android site on how to build.
. build/envsetup.shbrunchYou can also build (and see how long it took) for specific devices like this:
. build/envsetup.shtime brunch aokp_mako-userdebug
make clobberevery now and then!
Setting up ccache (Optional)
You can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do "make clean" often, or if you frequently switch between different build products. Put the following in your .bashrc or equivalent.
By default the cache will be stored in ~/.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.
The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code:
. prebuilts/misc/linux-x86/ccache/ccache -M 50G
This setting is stored in the CCACHE_DIR and is persistent.