[Miscellaneous Android Development] vale amicis:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook

that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling

This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/

So lets start with simple things

Basic FAQ:

This post/guide is divided into 4 parts:

1. Setting up build environment

2. Machine specifications etc.

3. Device Tree and source basics

4. Syncing Source and Building

PART 1: Setting up build environment​

Type sudo su and then your password to get rid of Admin Permissions

#Installing Python

STEP 1: Open terminal (CTRL + ALT + T)

Then execute the following commands in terminal one by one

sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5

Now Python is configured

#Installing JDK

As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!

Step 1: Open Terminal (CTRL + ALT + T)

STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal :)

wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"

STEP 3: Then we need to run the binary and move it to a shared location:

chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/

STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1

STEP 5: Now check if JDK 1.6 is selected on this:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc

Now JDK is configured! To check if it is done

Execute this is Terminal

java -version

Output will be similar to this :)

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)

#Installing GNU Make

cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install

These commands are for Make 1.81 if you want to install Make 1.82 Execute these

cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install

Now GNU make is configures

#Installing Android SDK

STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder

STEP TWO: Now, Execute these commands in terminal ;)

cd ~/Downloads/sdk/tools/
./android sdk

SDK is configured now :victory:

#Installing required packages:

STEP 1: Open Terminal

Now execute these commands:

apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool

Good, Now you have successfully setup linux build environment!​

PART 2: Machine specifications and other misc. stuff​

Basic Computer Specs:

2Ghz Dual Core Processor

2GB Minimum ram

50GB File Space (For only one rom source)

*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!

If you want to use other apps while compilation you should make a 5GB minimum swap partition!

If ram is more than 4GB ram then you don't swap partition!

PART 3: DEVICE TREE AND SOURCE BASICS​

Basic source folders:

/packages - Proprietary rom applications

/framework - Framework (Overall rom UI and stuff)

/device - Device config

/vendor - Vendor Tree and other vendor files

/hardware - Hardware drivers

Q: What is BoardConfig.mk?

A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree :)

Q: Where is build.prop in source?

A. Build.prop is available in the source in the form of system.prop in the device tree!

Q: How to remove ringtones, video editor, CM wallpapers from bulid?

A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build

PART 4: Syncing Source and Building​

# Installing Repo Package

mkdir ~/bin

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

chmod a+x ~/bin/repo

STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)

STEP 3: Now make directory:

mkdir -p ~/rom/android/system

STEP 4: Go into directory and set path for Repo Package

cd ~/rom/android/system
PATH=~/bin:$PATH

STEP 5: NOW ITS TIME FOR SYNCING:

For CM10.1 source execute this:

repo init -u git://github.com/CyanogenMod/android.git -b cm10.1

For syncing CM10 source execute:

repo init -u git://github.com/CyanogenMod/android.git -b jellybean

You have to find for the rest!!

PS: You don't have to execute all the repo init commands written above

Now to sync execute this after the the repo init command

repo sync

Once it finishes without breaking all the folders will appear in rom/android/system folder ;)

now execute this:

mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>

and extract the device config/tree here :)

for me its samsung/totoro (galaxy Y, Don't mind :p)

then do the following:

mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>

Its the same as for the device folder ;)

Now for compiling:

. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng

Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip

HAPPY COMPILING :o​