Build Environment
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:
After installing the packages you need to create a symlink:
IMPORTANT
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
Obtaining repo
Make directory for repo binary
Add directory for repo binary to your path
Download repo binary and place it in the proper directory
Give the repo binary the proper permissions
Create directory for where the AOKP repo will be stored and synced
Move to our new AOKP directory
Download the source
Please read the AOSP building instructions before proceeding. Initialize
Run 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.
Building
After the sync is finished, please read the instructions from the Android site on how to build.
You can also build (and see how long it took) for specific devices like this:
Remember to
every 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:
This setting is stored in the CCACHE_DIR and is persistent.
- Linux based operating system -- Tested on Ubuntu 12.04, 12.10, 13.04 (64bit)
- Terminal
- 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:
Code:
sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev [URL=libncurses5-dev:i386]libncurses5-dev:i386[/URL] x11proto-core-dev \ [URL=libx11-dev:i386]libx11-dev:i386[/URL] [URL=libreadline6-dev:i386]libreadline6-dev:i386[/URL] [URL=libgl1-mesa-glx:i386]libgl1-mesa-glx:i386[/URL] \ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc [URL=zlib1g-dev:i386]zlib1g-dev:i386[/URL] \ pngcrush schedtool
Code:
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
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt-get update
Code:
sudo apt-get install oracle-java6-installer
Code:
sudo update-java-alternatives -s java-6-oracle
Code:
sudo apt-get install oracle-java6-set-default
Make directory for repo binary
Code:
mkdir ~/bin
Code:
PATH=~/bin:$PATH
Code:
curl [URL=https://dl-ssl.google.com/dl/googlesource/git-repo/repo]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/URL] > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Code:
mkdir ~/aokp
Code:
cd ~/aokp
Please read the AOSP building instructions before proceeding. Initialize
Code:
repo init -u [URL=https://github.com/AOKP/platform_manifest.git]https://github.com/AOKP/platform_manifest.git[/URL] -b jb-mr1
Code:
repo sync
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
Code:
. ./platform_manifest/manual_add_kernel_manifest.sh
Building
After the sync is finished, please read the instructions from the Android site on how to build.
Code:
. build/envsetup.shbrunch
Code:
. build/envsetup.shtime brunch aokp_mako-userdebug
Code:
make clobber
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.
Code:
export USE_CCACHE=1
Code:
export CCACHE_DIR=
Code:
. prebuilts/misc/linux-x86/ccache/ccache -M 50G