I put this tutorial together in an attempt to create the most complete and easy to follow guide for building a ROM from source. Including steps for adding apps to your build, changing toolchains and more... The entire guide uses a single Linux terminal window from start to finish in an attempt to keep everything as user friendly as possible. Please feel free to PM me suggestions on where changes need be made.
Windows Users: Setup Ubuntu in Virtualbox Instructions
2. You need to know the location for your device, vendor, and kernel repos. This can be found fairly easily in the forum for your phone. Also take note of your phones codename.
For example the Optimus G is the gee and its repos can be found here https://github.com/TeamPlaceholder
Note*All terminal commands will be in Code boxes*
Install Java JDK
Installing required packages
Set-up ccache This Is Optional
Add these two lines
Install ADB & Fastboot This is optional, as you may already have them working. If not, they're a good thing to have.
Setup Repo
Create working directory
(Replace working-dir with whatever you'd like to call it, ie. aokp)
Choose which custom rom you are going to build and initialize the repo for it
(Replace chosen-manifest appropriately from the list below)
Device Source
Go HERE and follow instructions on obtaining your device specific repos.
Sync the repo
This will take a while as it downloads all the required source
Go HERE and follow instructions for your ROM choice
Go HERE and follow the instructions to tweak source
Locate your device on the list and enter appropriate number
Replace # with the number of cores in your system (Is the number of jobs that will be done at once, more cores means more jobs)
This can be hard, especially if you're new to programming languages and building. Meet Google your new best friend.
Here is a basic overview to get you started, and if no more at least googling in the right direction.
Enjoy.
I used these sites while making this guide
http://source.android.com/source/initializing.html
http://www.webupd8.org/2012/11/oracle-sun-java-6-installer-available.html
http://www.webupd8.org/2012/08/install-adb-and-fastboot-android-tools.html
If you find this guide helpful please press the Thanks button on my posts and rate the thread a 5.
Prerequisites
1. This guide is for Ubuntu 12+ based machine, I run Linux Mint 15. Follow links at end of OP for alternate directionsWindows Users: Setup Ubuntu in Virtualbox Instructions
2. You need to know the location for your device, vendor, and kernel repos. This can be found fairly easily in the forum for your phone. Also take note of your phones codename.
For example the Optimus G is the gee and its repos can be found here https://github.com/TeamPlaceholder
Note*All terminal commands will be in Code boxes*
Part 1 - Setting Up The Build Environment
Install Java JDK
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt-get update
Code:
sudo apt-get install oracle-java6-installer
Installing required packages
Code:
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
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Set-up ccache This Is Optional
Code:
nano ~/.bashrc
Save and exit by pressing ctrl+x, selecting Y then enter.export USE_CCACHE=1
export CCACHE_DIR=<path-to-your-cache-directory>
Install ADB & Fastboot This is optional, as you may already have them working. If not, they're a good thing to have.
Code:
sudo add-apt-repository ppa:nilarimogard/webupd8
Code:
sudo apt-get update
Code:
sudo apt-get install android-tools-adb android-tools-fastboot
Setup Repo
Code:
mkdir ~/bin
Code:
PATH=~/bin:$PATH
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Create working directory
Code:
mkdir [I][B]working-dir[/B][/I]
Code:
cd working-dir
Part 2 - Get Source
ROM SourceChoose which custom rom you are going to build and initialize the repo for it
Code:
repo init -u [I][B]chosen-manifest[/B][/I]
AOKP: https://github.com/AOKP/platform_manifest.git -b Branch
Cyanogenmod: https://github.com/CyanogenMod/android.git -b Branch
CarbonDev: https://github.com/CarbonDev/android.git -b Branch
Liquid Smooth: https://github.com/LiquidSmooth/android.git -b Branch
Replace Branch with appropriate branch from github repo ie cm-10.2 or jb3
If unsure which branch click the link above to locate appropriate branch
Device Source
Go HERE and follow instructions on obtaining your device specific repos.
Sync the repo
Code:
repo sync
Part 3 - Preparing Source
Before you're ready to build your source needs to be configured to include your device. This preparation varies slightly for different custom Roms.Go HERE and follow instructions for your ROM choice
Part 4 - Edit Source
This Is Optional
This is where you can make edits to the source before building to suit your needs. Go HERE and follow the instructions to tweak source
Part 5 - Building ROM
Code:
. build/envsetup.sh
Code:
lunch
Code:
make -j[B][I]# [/I][/B]otapackage
Build Errors
This can be hard, especially if you're new to programming languages and building. Meet Google your new best friend.
Here is a basic overview to get you started, and if no more at least googling in the right direction.
Finished
When it's done you're rom will be in working-dir/out/target/product/codename/Enjoy.
I used these sites while making this guide
http://source.android.com/source/initializing.html
http://www.webupd8.org/2012/11/oracle-sun-java-6-installer-available.html
http://www.webupd8.org/2012/08/install-adb-and-fastboot-android-tools.html
Last edited: