[Samsung Galaxy SL i9003] nicsptl:
Only Intention of This Guide More and More People Learn How to Build CM from Source.

Note ::

New Suggestion are welcome to make this guide more easy and perfect.Post any problem related to build in this thread. I will reply as soons as possible.:fingers-crossed:

What You will Require :-

1) PC Running Ubuntu 12.10x64 Bit System

2) Good Internet Connection Speed.

3) Patience

4) Samsung Galaxy SL :p

I will Distribute Building CM into Several Parts for Comfortable

(1) Setup Linux and Build Environment

(2) Source Sync & Download Pre-builts Files

(3) Setup Device tree

(4) Patching and cherry-picking

(5) Building ROM

(6) Installing ROM

(1) Setup Linux and Build Environment

Setup Linux

You will need Linux distros to build any ROM because windows system is not completely supported yet. you could possibly build ROMs on any Linux platform

but I recommended Ubuntu 12.10 64-bit System.And also this guide is written on base of pure clean Ubuntu 12.10 system.

You can setup dual boot with Windows.You can Google it how to Dual boot windows and Ubuntu.

or

you can use virtual machine like vmware player (http://www.vmware.com/products/player/ ) or Virtual Box (https://www.virtualbox.org/) they all are freeware software. But to use virtual machine you will need Higher Specification for best experience.

You could download Ubuntu 12.10 ISO from here : http://www.ubuntu.com/download

and make it bootable Pen Drive or CD to install it or Direct use in Virtual machine Software to Install it.

When You complete with installing Ubuntu proceed to setup build environment.

Build Environment

To build ROM from any source you will need several tools

Open Terminal,

1) Java Development Kit 6/Java Development Kit 7

If you are first time Installing JDK than procedded to installing step or first delete all previous version using this commands

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
sudo apt-get purge sun-java

Method 1 :: Install Latest JDK 6

Method 2 :: Install All Java tools

2) Install dependencies

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

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

3) Android SDK (Optinal)

Download LINK :: http://developer.android.com/sdk/index.html

After Downloading Extract it at your desire directory as example : home/android/

it will be extracted with name : android-sdk-linux

Now go to that location using Terminal

cd ~/android/android-sdk-linux/tools
./android

than install adb driver and other platform tools. No need to download any API for now eiether you want to make android app.

To access adb command from anywhere in terminal you have to add its path to Bourne Again Shell (bash)

use any editor from below. (nano or gedit) to modify bash.

sudo nano ~/.bashrc

OR

sudo gedit ~/.bashrc

Than at the end of the file add this lines.

export PATH=${PATH}:<sdk>/tools:<sdk>/platform-tools

replace <sdk> with folder address.in My case i extracted it on /home directory

export PATH=${PATH}:/home/nics/android-sdk-linux/platform-tools/

Save the file. Then open a new Terminal. The adb command should now be available.

That's it. ADB (Android Debug Bridge) will have you debug ROM as well as application also.

(2) Source Sync & Download Prebuilts

1)Downloading Repository Binary

The binary for repo will let you talk to git servers and download all that precious source code. That second part after the && allows it to be executable:

mkdir ~/bin && curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo && chmod a+x ~/bin/repo

Use your favorite text editor to open ~/.bashrc

use nano:

sudo nano ~/.bashrc

At bottom add this line.

export PATH=~/bin:$PATH

Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:

source ~/.bashrc

2) Initialize The Repository

First Close current terminal and reopen again New

mkdir ~/cm10.1 ## you can use any name on behalf cm10.1
cd ~/cm10.1

Now to build Jellybena 4.1.2 you need to initialize CM10 repo

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

or

If you want to build Jellybean 4.2.2 initialize CM10.1 repo below.

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

Now begin Download Source

repo sync

(It will take time depending on your internet speed. Downloading Source will download around 8.2 GB approaxmatiely or mare than that)

TIPS :: you can use "repo sync -j3" or "repo sync -j5" command also. It means it will download simantueosly 3 or 5 projects default threads are set to 16. this code are used to decreased it to whatever you want it only require when you have problem of syncin source on low speed.

3) Download Prebuilts

after completing repo sync Download pre-builts

go into :: ~/cm10.1/vendor/cm

cd ~/cm10.1/vendor/cm/

and run this

./get-prebuilts