[TUTORIAL ] Beginning development-the easy way

Search This thread

nerotNS

Senior Member
Nov 8, 2011
1,077
419
Ok so this is a guide that me and my friend made for compiling ROMs for our LG-P350 Now, this is pretty much universal and can be used for general development

This is the stuff you will need :

Ubuntu-can be found on the Ubuntu website http://www.ubuntu.com/start-download?distro=desktop&bits=64&release=lts (this is a direct link to the Ubuntu 12.04 64-bit version)
Python (included)
GNU Make
Java Development Kit (JDK) 6
Git

Before you can do anything you need to install Ubuntu. You can go with newer versions but i still think that 10.10 is best and this guide is adapted to it. You can install it like dual boot or use Wubi (Windows Ubuntu Installer). However if you choose Wubi there is a good chance that you won't have enough storage, so that's not recommended.Those who want to dual-boot check out this post http://xdaforums.com/showpost.php?p=34669858&postcount=26

NOTE: You can do this in a virtual machine (for example VM Ware and Virtual box) but it will be a lot slower unless you have a VERY strong CPU and a LOT of RAM.

Generally Python is not needed since it's already in Ubuntu. However if you want to install it separately here's how:

First of all open the terminal. Now copy/paste these codes (one by one) and execute them:

Code:
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

make test

sudo make install ([B]NOTE[/B]: [I]You will be asked for your password, enter it and press enter[/I]) 

sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5

Now you need Sun JDK 6. Same procedure as with Python:

Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

sudo apt-get update

sudo apt-get install sun-java6-jdk

For those who get package error try these:

Code:
sudo add-apt-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java6-jdk

Now that JDK is installed it's time for GNU Make:

First of all download GNU Make from link given. Download version 3.82
Now extract the downloaded file to your Home directory.
Go to Home directory and change the name of GNU Make To make
Now open the Terminal and type the following codes

Link: http://ftp.gnu.org/gnu/make/

Code:
cd make

./configure

sudo make install

Now make is installed.

Next, we are going to install the dependencies:

FOR UBUNTU 10.10

Codes to type in terminal :

Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \ x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \ libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \ libxml2-utils xsltproc

export USE_CCACHE=1

If that method didn't work then try this:
You use the same commands BUT the first one is:
sudo apt-get install git-core gnupg flex bison gperf build-essential

Now it should download some stuff. When its done you need to do the same for the rest in the right order.
NOTE: Since I don't remember the right order i will just put the commands how they should be written if you get error read what's missing and put that in first.

Here are the rest of the lines:

Code:
sudo apt-get install zip curl
sudo apt-get install zlib1g-dev
sudo apt-get install libc6-dev
sudo apt-get install lib32ncurses5-dev
sudo apt-get install ia32-libs
sudo apt-get install x11proto-core-dev
sudo apt-get install libx11-dev
sudo apt-get install lib32readline5-dev
sudo apt-get install lib32z-dev
sudo apt-get install libgl1-mesa-dev g++-multilib
sudo apt-get install mingw32
sudo apt-get install tofrodos python-markdown
sudo apt-get install libxml2-utils
sudo apt-get install xsltproc


FOR UBUNTU 12.04

Code:
sudo apt-get install git-core 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 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386

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


Now for the Android SDK, ADB and ADB path:

1. SDK (Software-Development-Kit) :

Go to this link and download the Android SDK for Linux:

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


After downloading it, extract it to the Home folder. You can probably extract where you want and change all the steps below to to fit your set up, but I like putting it in Home folder.
When you have extracted it in the Home folder change the name of the folder of android-sdk-linux to sdk.

Then open the Terminal and run these codes:

Code:
cd ~/sdk/tools/
./android sdk

When you run this, a window will pop up. For this you only need "Android SDK Tools" and "Android SDK Platform-tools". Just check these two and install them.

2. ADB (Android-Debug-Bridge):

Run this command to see if your ADB works. You have to have your android device connected in debugging mode.

Run these codes in the Terminal :

Code:
cd ~/sdk/platform-tools ./adb devices

When you entered the codes above, you should see something similar to this:
List of devices attached 0123456789ABCDEF device


NOTE: If you see output like given bellow we need to give the device permissions. Don't worry I had this too when I set my computer up for the first time.

List of devices attached ???????????? no permissions

Here is how we fix it:


Open the Terminal and type this:

Code:
gksudo gedit /etc/udev/rules.d/51-android.rules

After you've entered it, a window will pop up that will be blank. Now add the following commands and save it.

Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
Now save this File And follow the given codes

After you've entered those codes type these codes in too.

Code:
sudo service udev restart 
sudo adb kill-server 
sudo adb start-server

After you've entered those codes, restart Ubuntu.

Now to see if the problem is solved type these codes in:

Code:
cd ~/sdk/platform-tools ./adb devices

If everything is ok a output similar to this will be shown:
List of devices attached 0123456789ABCDEF device

Now to add the ADB path to system, so you don't have to cd to the SDK folder every time you want to use ADB:

So, first open up .bashrc with these codes:

Code:
sudo gedit ~/.bashrc

A window will pop up and there will be some text there. Scroll down to the bottom and add these lines:

Code:
export PATH=${PATH}:~/sdk/tools
export PATH=${PATH}:~/sdk/platform-tools

After you've done that, save it and reboot Ubuntu.

If everything is ok, you will get some output when you type the following codes in the terminal.

Code:
./adb devices
OR

Code:
adb shell

If you see:

Code:
adb not found[CODE]

Then it means you've done something wrong and ADB is not configured.

Next is GIT:

Open the browser and download git from given link 
[URL]http://git-core.googlecode.com/files/git-1.7.9.6.tar.gz[/URL]


Extract GIT-1.7.9.6.tar.gz to your home directory 
Rename the folder you extracted to from GIT-1.7.9.6.tar.gz to git

After you've done that, enter the following codes in the Terminal

[CODE]sudo aptitude build-dep git-core
sudo apt-get install zlib1g-dev
cd git
./configure
make
sudo make install

NOTE: If it doesn't work then install from this link:

http://kibyegon.wordpress.com/2010/0...u-lucid-10-04/

If the commands from above are not working then try this:

Code:
sudo apt-get install git-core
sudo apt-get install git
git
If it worked it should show this:

Code:
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[--help] COMMAND [ARGS]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG

See 'git help COMMAND' for more information on a specific command.



Now we will download the Repo and get the source code:

Codes to type in the Terminal :


Code:
mkdir ~/bin

PATH=~/bin:$PATH

sudo apt-get install curl

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

chmod a+x ~/bin/repo

mkdir source

cd source
Ok so up to this part its mostly universal. However after this you need to sync up sources for your device. This will probably take a long time depending on your internet speed since the source is very big (also it will take up a lot of drive space: 14-30GB). After that you should build.

How to build

First you will need to get proprietary drivers from your device.
Connect your device via USB and enter the following commands (from the root of your source repository):


Code:
cd device/xxx/xxx where x is the path to your device
./extract-files.sh
cd ../../..

NOTE: Some developers can include these files in the source itself or can make them available for download from their Github page. Check that out with your developer for more info.

And start the build:

Code:
. build/envsetup.sh xxx
NOTE:Here x also varies since its unique for every device model

Now Android is building. You may need to wait a long time (depending on your hardware-mainly CPU and RAM for example I have a quad core 2.92Ghz CPU and 6GB of HyperX DDR3 ram and it took me about 10min for CM7 and about 20-30 min for CM9).Once it's done you should get this message:

Code:
Package complete:xxx.zip

That is your flashable .zip file you install from recovery.

Credits: Many thanks go to Keyur Maru who helped me learn how to develop and for making the base of this guide.

Reference: http://source.android.com/source/downloading.html
 
Last edited:

pranks1989

Senior Member
Nov 24, 2011
383
132
34
Hyderabad
Wow 10min is real fast!! I recently tried CM9 directly from one of the Dev's forked repo and after about 4hours of build I got some build error! I need to get a better computer soon if I plan to get my hands real dirty! And if I may I have few suggestions - please mention that it will take a while to download the full repo from google sources else beginners may end up thinking something is wrong(which I did since it took me one full day to sync everything) and that it needs atleast 20-30GB disk space too..(Coz not everyone has Ubuntu as the only OS, I have three in my lapi!!)

A very good guide on the whole for a beginner!!! :)
 
  • Like
Reactions: nerotNS

Kayant

Senior Member
Jul 14, 2011
1,861
4,150
Wow 10min is real fast!! I recently tried CM9 directly from one of the Dev's forked repo and after about 4hours of build I got some build error! I need to get a better computer soon if I plan to get my hands real dirty! And if I may I have few suggestions - please mention that it will take a while to download the full repo from google sources else beginners may end up thinking something is wrong(which I did since it took me one full day to sync everything) and that it needs atleast 20-30GB disk space too..(Coz not everyone has Ubuntu as the only OS, I have three in my lapi!!)

A very good guide on the whole for a beginner!!! :)

Very true a great in depth and very informative tutorial for noobs like i was :p this would have helped me a lot.... Great work :D

btw pranks1989 i can help you with compiling for defy.... I used to compile roms from eppy's and quarx2k github and never got a error once it else onece eppy pinted out the mistake i was doing.... just send me a pm of your errors and i will try help ;)
 

serendipityguy

Senior Member
Oct 9, 2010
1,219
500
Sunny, CA
Great start for me!

You have been thanked!

Great start for me!

What would the procedure be if you want to create a rom that you can flash via Odin or Heimdall on a Mac client?
 

goan0900

Senior Member
Mar 29, 2011
251
139
Kaltensundheim
Thanks for this great guide. I will try it today.

I already compiled a Rom, it took me 40 min. AMD 8 Core 3,1 MHz and 16 GB DDR3

But when i try a different device i always get errors, i hope your Guide will get me in to it.
 

nerotNS

Senior Member
Nov 8, 2011
1,077
419
You have been thanked!

Great start for me!

What would the procedure be if you want to create a rom that you can flash via Odin or Heimdall on a Mac client?

I don't know but it's surely different for odin(I'm not sure that you can).And I don't know on mac either since I use ubuntu and windows. You can look up info on this on the official Android dev website.

Sent from my Optimus Me using xda premium
 
Last edited:
  • Like
Reactions: ph.miki

TheBadFish

Senior Member
Jun 27, 2008
60
19
South West
Good Beginners Guide. Thank you.

But 90% of it can also be found here:
http://source.android.com/source/initializing.html
This is what i used to build android for the pandaboard a few weeks ago.

And then I have a few questions.

1.
Why do you compile git when you can also download it from apt-sources? Imho this is just confusing for beginners.

2.
Where do you use git in your tutorial?

3.
Didn't you forget lunch and make at the very end of your tutorial?
". build/envsetup.sh" only sets up the environment, imho
(see also here: http://source.android.com/source/building.html)
 
  • Like
Reactions: nerotNS

Gigadroid

Senior Member
Dec 31, 2011
266
447
Osnabrück
First you will need to get proprietary drivers from your device.
Connect your device via USB and enter the following commands (from the root of your source repository):


Code:
cd device/xxx/xxx where x is the path to your device
./extract-files.sh
cd ../../..

How do I find out what the path is from my device?
 

sztupy

Inactive Recognized Developer
Dec 21, 2008
1,061
877
Edinburgh
sztupy.hu
I would add the option to install Ubuntu in a VM. Both VMWare player and VirtualBox are free and well supported. This way one can actually create some pre-packaged images with which one can start development right away. In fact I've already made two of them a year ago (one for Froyo and one for Gingerbread):

http://xdaforums.com/showthread.php?t=881845
http://xdaforums.com/showthread.php?t=1022407

One might also make on for ICS (for that Ubuntu 12.04 is also good, and since VMWare Player is free one could use that instead of VirtualBox, as VMWP has more user-friendly features)
 

nerotNS

Senior Member
Nov 8, 2011
1,077
419
I would add the option to install Ubuntu in a VM. Both VMWare player and VirtualBox are free and well supported. This way one can actually create some pre-packaged images with which one can start development right away. In fact I've already made two of them a year ago (one for Froyo and one for Gingerbread):

http://xdaforums.com/showthread.php?t=881845
http://xdaforums.com/showthread.php?t=1022407

One might also make on for ICS (for that Ubuntu 12.04 is also good, and since VMWare Player is free one could use that instead of VirtualBox, as VMWP has more user-friendly features)

True however unless you have a LOT of ram and a hexa-core CPU compilation under a vm is significantly slower and that's why I didn't add it.But the procedure is the same anyway.

Sent from my Optimus Me using xda premium
 
Last edited:

nerotNS

Senior Member
Nov 8, 2011
1,077
419
Good Beginners Guide. Thank you.

But 90% of it can also be found here:
http://source.android.com/source/initializing.html
This is what i used to build android for the pandaboard a few weeks ago.

And then I have a few questions.

1.
Why do you compile git when you can also download it from apt-sources? Imho this is just confusing for beginners.

2.
Where do you use git in your tutorial?

3.
Didn't you forget lunch and make at the very end of your tutorial?
". build/envsetup.sh" only sets up the environment, imho
(see also here: http://source.android.com/source/building.html)

1.Idk I found this thing simple as well

2.I will review it later since I'm on my phone now and its 00:13 here :p

3.I don't think it's necessary since I use the same procedure for my rom compilation. I will add it tough just in case someone gets an error.Thanks for the tip.

Sent from my Optimus Me using xda premium
 
Last edited:

lilott8

Member
Apr 17, 2009
25
1
just following

Just posting here to follow. I will have to try this tonight. This looks awesome!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 62
    Ok so this is a guide that me and my friend made for compiling ROMs for our LG-P350 Now, this is pretty much universal and can be used for general development

    This is the stuff you will need :

    Ubuntu-can be found on the Ubuntu website http://www.ubuntu.com/start-download?distro=desktop&bits=64&release=lts (this is a direct link to the Ubuntu 12.04 64-bit version)
    Python (included)
    GNU Make
    Java Development Kit (JDK) 6
    Git

    Before you can do anything you need to install Ubuntu. You can go with newer versions but i still think that 10.10 is best and this guide is adapted to it. You can install it like dual boot or use Wubi (Windows Ubuntu Installer). However if you choose Wubi there is a good chance that you won't have enough storage, so that's not recommended.Those who want to dual-boot check out this post http://xdaforums.com/showpost.php?p=34669858&postcount=26

    NOTE: You can do this in a virtual machine (for example VM Ware and Virtual box) but it will be a lot slower unless you have a VERY strong CPU and a LOT of RAM.

    Generally Python is not needed since it's already in Ubuntu. However if you want to install it separately here's how:

    First of all open the terminal. Now copy/paste these codes (one by one) and execute them:

    Code:
    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
    
    make test
    
    sudo make install ([B]NOTE[/B]: [I]You will be asked for your password, enter it and press enter[/I]) 
    
    sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5

    Now you need Sun JDK 6. Same procedure as with Python:

    Code:
    sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
    
    sudo apt-get update
    
    sudo apt-get install sun-java6-jdk

    For those who get package error try these:

    Code:
    sudo add-apt-repository ppa:sun-java-community-team/sun-java6
    sudo apt-get update
    sudo apt-get install sun-java6-jdk
    sudo update-java-alternatives -s java6-jdk

    Now that JDK is installed it's time for GNU Make:

    First of all download GNU Make from link given. Download version 3.82
    Now extract the downloaded file to your Home directory.
    Go to Home directory and change the name of GNU Make To make
    Now open the Terminal and type the following codes

    Link: http://ftp.gnu.org/gnu/make/

    Code:
    cd make
    
    ./configure
    
    sudo make install

    Now make is installed.

    Next, we are going to install the dependencies:

    FOR UBUNTU 10.10

    Codes to type in terminal :

    Code:
    sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \ x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \ libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \ libxml2-utils xsltproc
    
    export USE_CCACHE=1

    If that method didn't work then try this:
    You use the same commands BUT the first one is:
    sudo apt-get install git-core gnupg flex bison gperf build-essential

    Now it should download some stuff. When its done you need to do the same for the rest in the right order.
    NOTE: Since I don't remember the right order i will just put the commands how they should be written if you get error read what's missing and put that in first.

    Here are the rest of the lines:

    Code:
    sudo apt-get install zip curl
    sudo apt-get install zlib1g-dev
    sudo apt-get install libc6-dev
    sudo apt-get install lib32ncurses5-dev
    sudo apt-get install ia32-libs
    sudo apt-get install x11proto-core-dev
    sudo apt-get install libx11-dev
    sudo apt-get install lib32readline5-dev
    sudo apt-get install lib32z-dev
    sudo apt-get install libgl1-mesa-dev g++-multilib
    sudo apt-get install mingw32
    sudo apt-get install tofrodos python-markdown
    sudo apt-get install libxml2-utils
    sudo apt-get install xsltproc


    FOR UBUNTU 12.04

    Code:
    sudo apt-get install git-core 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 openjdk-6-jdk tofrodos \
      python-markdown libxml2-utils xsltproc zlib1g-dev:i386
    
      sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so


    Now for the Android SDK, ADB and ADB path:

    1. SDK (Software-Development-Kit) :

    Go to this link and download the Android SDK for Linux:

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


    After downloading it, extract it to the Home folder. You can probably extract where you want and change all the steps below to to fit your set up, but I like putting it in Home folder.
    When you have extracted it in the Home folder change the name of the folder of android-sdk-linux to sdk.

    Then open the Terminal and run these codes:

    Code:
    cd ~/sdk/tools/
    ./android sdk

    When you run this, a window will pop up. For this you only need "Android SDK Tools" and "Android SDK Platform-tools". Just check these two and install them.

    2. ADB (Android-Debug-Bridge):

    Run this command to see if your ADB works. You have to have your android device connected in debugging mode.

    Run these codes in the Terminal :

    Code:
    cd ~/sdk/platform-tools ./adb devices

    When you entered the codes above, you should see something similar to this:
    List of devices attached 0123456789ABCDEF device


    NOTE: If you see output like given bellow we need to give the device permissions. Don't worry I had this too when I set my computer up for the first time.

    List of devices attached ???????????? no permissions

    Here is how we fix it:


    Open the Terminal and type this:

    Code:
    gksudo gedit /etc/udev/rules.d/51-android.rules

    After you've entered it, a window will pop up that will be blank. Now add the following commands and save it.

    Code:
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
    Now save this File And follow the given codes

    After you've entered those codes type these codes in too.

    Code:
    sudo service udev restart 
    sudo adb kill-server 
    sudo adb start-server

    After you've entered those codes, restart Ubuntu.

    Now to see if the problem is solved type these codes in:

    Code:
    cd ~/sdk/platform-tools ./adb devices

    If everything is ok a output similar to this will be shown:
    List of devices attached 0123456789ABCDEF device

    Now to add the ADB path to system, so you don't have to cd to the SDK folder every time you want to use ADB:

    So, first open up .bashrc with these codes:

    Code:
    sudo gedit ~/.bashrc

    A window will pop up and there will be some text there. Scroll down to the bottom and add these lines:

    Code:
    export PATH=${PATH}:~/sdk/tools
    export PATH=${PATH}:~/sdk/platform-tools

    After you've done that, save it and reboot Ubuntu.

    If everything is ok, you will get some output when you type the following codes in the terminal.

    Code:
    ./adb devices
    OR

    Code:
    adb shell

    If you see:

    Code:
    adb not found[CODE]
    
    Then it means you've done something wrong and ADB is not configured.
    
    Next is GIT:
    
    Open the browser and download git from given link 
    [URL]http://git-core.googlecode.com/files/git-1.7.9.6.tar.gz[/URL]
    
    
    Extract GIT-1.7.9.6.tar.gz to your home directory 
    Rename the folder you extracted to from GIT-1.7.9.6.tar.gz to git
    
    After you've done that, enter the following codes in the Terminal
    
    [CODE]sudo aptitude build-dep git-core
    sudo apt-get install zlib1g-dev
    cd git
    ./configure
    make
    sudo make install

    NOTE: If it doesn't work then install from this link:

    http://kibyegon.wordpress.com/2010/0...u-lucid-10-04/

    If the commands from above are not working then try this:

    Code:
    sudo apt-get install git-core
    sudo apt-get install git
    git
    If it worked it should show this:

    Code:
    usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
    [-p|--paginate|--no-pager] [--no-replace-objects]
    [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
    [--help] COMMAND [ARGS]
    The most commonly used git commands are:
    add Add file contents to the index
    bisect Find by binary search the change that introduced a bug
    branch List, create, or delete branches
    checkout Checkout a branch or paths to the working tree
    clone Clone a repository into a new directory
    commit Record changes to the repository
    diff Show changes between commits, commit and working tree, etc
    fetch Download objects and refs from another repository
    grep Print lines matching a pattern
    init Create an empty git repository or reinitialize an existing one
    log Show commit logs
    merge Join two or more development histories together
    mv Move or rename a file, a directory, or a symlink
    pull Fetch from and merge with another repository or a local branch
    push Update remote refs along with associated objects
    rebase Forward-port local commits to the updated upstream head
    reset Reset current HEAD to the specified state
    rm Remove files from the working tree and from the index
    show Show various types of objects
    status Show the working tree status
    tag Create, list, delete or verify a tag object signed with GPG

    See 'git help COMMAND' for more information on a specific command.



    Now we will download the Repo and get the source code:

    Codes to type in the Terminal :


    Code:
    mkdir ~/bin
    
    PATH=~/bin:$PATH
    
    sudo apt-get install curl
    
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    
    chmod a+x ~/bin/repo
    
    mkdir source
    
    cd source
    Ok so up to this part its mostly universal. However after this you need to sync up sources for your device. This will probably take a long time depending on your internet speed since the source is very big (also it will take up a lot of drive space: 14-30GB). After that you should build.

    How to build

    First you will need to get proprietary drivers from your device.
    Connect your device via USB and enter the following commands (from the root of your source repository):


    Code:
    cd device/xxx/xxx where x is the path to your device
    ./extract-files.sh
    cd ../../..

    NOTE: Some developers can include these files in the source itself or can make them available for download from their Github page. Check that out with your developer for more info.

    And start the build:

    Code:
    . build/envsetup.sh xxx
    NOTE:Here x also varies since its unique for every device model

    Now Android is building. You may need to wait a long time (depending on your hardware-mainly CPU and RAM for example I have a quad core 2.92Ghz CPU and 6GB of HyperX DDR3 ram and it took me about 10min for CM7 and about 20-30 min for CM9).Once it's done you should get this message:

    Code:
    Package complete:xxx.zip

    That is your flashable .zip file you install from recovery.

    Credits: Many thanks go to Keyur Maru who helped me learn how to develop and for making the base of this guide.

    Reference: http://source.android.com/source/downloading.html
    4
    Dual-Boot Ubuntu

    Ok I will also add this here. For all of those who want to dual boot Ubuntu with Windows 7 and want to keep all their files here is how:

    NOTE:You will need Administrator right to do this.
    NOTE 2:I recommend making a at least 150GB partition for Ubuntu to make sure you have plenty of space for multiple source codes.
    First we are gonna shrink a partition in Windows 7. To do this right click on My Computer and click Manage.
    Once there, under the Storage menu open the Disk Managment:

    KTucj.jpg


    After you've done that you should right click on the partition you want to shrink and then left click Shrink volume like in the image bellow:

    pEul0.png



    Now in the shrink menu you should set the amount of space you want to shrink the volume by:

    fIjeA.jpg


    After that you will have unallocated space.Then right click on it and click New Simple Volume.Then follow the on-screen instructions. If you want to use all the unallocated space then type in the max value.Make sure you check the quick format option.
    NOTE VERY INPORTIANT : Do NOT convert the disk to dynamic if a pop up asks you. If you do so it will make Windows 7 unbootable.The only way you could fix it would be a clean install of Windows 7 which we don't want.
    That's how we shrink partitions. Next is Ubuntu itself.

    Insert your Ubuntu CD in your CD drive. Then depending on your motherboard change the boot order to make the PC boot from the disk.
    Once it starts up you can proceed with the Ubuntu installation process. Select your language and then click install Ubuntu. Un-check the download updates while installing (to make things faster) and then click next. When you get to the installation type select something else.That will show you the disk partitioning tool. Here using the partition tool make partitions for Ubuntu by re-sizing the partiotion we made. Now select it and click add. There you can make your partitions. Once that is complete click install now and that's it. Now I'd post images for this too but something is wrong with my image uploading service -.- I'll see to add them later.
    2
    Very good tutorial for beginner :)

    Thanks we tried our best since this is supposed to boost our dev base for our LG
    1
    Very good tutorial for beginner :)
    1
    Hello,

    First, a big thank you. Although not a noob when it comes to compiling software, this tutorial is excellent!

    My question is that the manufacturer of the device I have, has released the sources for android 4.1.2. But the file is really small, about 113MB (see -> http://www.huaweidevice.com/worldwi...=toDownloadFile&flay=software&softid=NDcxMDU=)

    Now as I have never worked with Android before, I do not understand what is in this file - it has the following 3 archives:

    bluez.tar.bz2
    kernel.tar.bz2
    webkit.tar.bz2

    My goal is to build the stock android for my device, nothing fancy. Any idea how can I use the sources provided?

    Again, thanks for the help!