[Noobs Guide]Compile AOSP-KitKat for Nexus

Search This thread

antonio8297

Senior Member
Mar 25, 2012
902
593
Camposano (NA)
I'm not responsable for all that you do with your PC and your Nexus.

For first you need a 64-bit PC,with minimum 4GB of RAM and a Dual-core PC,and Ubuntu.

Start with PC configuration.

1) You need the following:
-JDK 6 if you wish to build Kit-Kat.
Code:
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update && sudo apt-get install oracle-java6-installer

-Python, which you can download from python.org. Or:
Code:
$ sudo apt-get install python

-Git, which you can find it at git-scm.com. Or:
Code:
$ sudo apt-get install git-core

-Android SDK:
  • Download the SDK here: http://developer.android.com/sdk/index.html
  • Extract the SDK and place it in your home directory.
  • I renamed my SDK to android-sdk to make it easier to navigate to.
  • Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
  • Add these lines at the bottom of the file:
    Code:
    # Android tools
    export PATH=${PATH}:~/android-sdk/tools
    export PATH=${PATH}:~/android-sdk/platform-tools
    export PATH=${PATH}:~/bin
  • Find your .profile file and add this at the bottom of the file:
    Code:
    PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
  • You have now successfully installed the Android SDK.
  • To check for updates issue this into your terminal:
    Code:
    $ android

2) Installing required packages (Ubuntu 13.04+)
Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev lib32z1 \
  lib32ncurses5 lib32bz2-1.0 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \
  lib32z1-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 lzop
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Installing required packages (Ubuntu 12.04)
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
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Installing required packages (Ubuntu 10.04 -- 11.10)
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

On Ubuntu 10.10:
Code:
$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

On Ubuntu 11.10:
Code:
$ sudo apt-get install libx11-dev:i386

3) Configure your USB.
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules

Inside of this blank text file insert:
Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"

4) Save the file and close it and then issue this command:
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

4a) [OPTIONAL] Setting up ccache
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

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.

Code:
export CCACHE_DIR=<path-to-your-cache-directory>

The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code:

Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G

This setting is stored in the CCACHE_DIR and is persistent.

5) Install the repo:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

6) Initialize the repo:
Code:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY

6a) For AOSP:
Code:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.4_r2

6.1) For people who have already done a repo init:
Code:
$ cd WORKING_DIRECTORY
AOSP:
Code:
$ repo init -b android-4.4.4_r2
$ repo sync

7) When prompted, enter your real name and email address.

8) Gather the files:
Code:
$ repo sync

How to add Nexus device config.


1) Navigate to the location you are going clone the device tree to:
Code:
$ cd WORKING_DIRECTORY/device
$ mkdir samsung
$ cd samsung

2) Clone the github device tree from remote to local(I'll add all 3 variants of nexus)
Code:
git clone https://android.googlesource.com/device/samsung/tuna
Code:
git clone https://android.googlesource.com/device/samsung/maguro
Code:
git clone https://android.googlesource.com/device/samsung/toro
Code:
git clone https://android.googlesource.com/device/samsung/toroplus

3) Add Vendor files(we will use shiny that are already on github,for simply setup):
Return to source root folder and do:
Code:
$ mkdir vendor
$cd vendor
now clone vendor files:
Code:
git clone https://github.com/ShinyROM/android_vendor_widevine.git -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_nxp.git -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_invensense -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_broadcom -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_csr -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_ti -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_samsung -b master
Code:
git clone https://github.com/ShinyROM/android_vendor_imgtec -b master
after this return to source root folder
4) Add KitKat changes to the source(more difficult part):
Tuna part:
Code:
$ cd device/samsung/tuna
$ git remote add ShinyROM https://github.com/ShinyROM/android_device_samsung_tuna 
$ git fetch ShinyROM
$ git cherry-pick 4b8c328bbdf85eb9ef9ff91d387e856b0fa41598
$ git cherry-pick 3b73c36a90dc64fea97a444b3f78f9c46f51d3a1 
$ git cherry-pick 20bc682ea8b7f4839fac5a9186caad66654e8744
$ git cherry-pick c3de6cd1a5d9836a26c8ec988961266e1d10eafb
$ git cherry-pick 3ab5ebccee0447c05e502876915a4f80e694774c
$ git cherry-pick 592cca8e9f9e2a6dc97aa04cdeec63b0f43f6cf8
$ git cherry-pick 0370ce5c126c4beb08ac449fdba9520709850104
$ git cherry-pick d218fe0237272173f8f525e73bc4af4eea8a22b2
$ git cherry-pick 9d1cc345633397969161f1864c8fd31bea934ed5

Now choose this for the type of your Nexus:
Maguro doesn't any change.

Toro part(will be added soon).

Toroplus part:
Code:
$ cd device/samsung/toroplus
$ git remote add ShinyROM https://github.com/ShinyROM/android_device_samsung_toroplus
$ git fetch ShinyROM
$ git cherry-pick 4bf9f8b5f3aa9a3d87cfcbeb8c12c59f4d7fbc42

Glitch fix:
return to source tree folder.
Code:
$ cd frameworks/native
$ git remote add GeyerA https://github.com/GeyerA/platform_frameworks_native
$ git fetch GeyerA
$ git cherry-pick a92548738b12f37a0ae9bf2268a15c835cabed9d 
$ git cherry-pick 8c5f62fefb9c8b3e7dc8a5fbbef3e69b9afd23f9
$ git cherry-pick 2ec9852a507e977895f3794615506ca9f0e7e23b
$ git cherry-pick 117c4c56d15774ec31b4db8bbe748709090e1a16
$ git cherry-pick 32d4c4fda4032052b6a2938a89c1c7be9ecb3f75
$ git cherry-pick 55fa4ff4ce705c7a059006f5ae3acd7d8671b968
$ git cherry-pick 571387e4962f2981feb2414c16f210a6cea33810
$ git cherry-pick 5b78c099864ece8a17bee54659fa342a6be2f5a3
$ git cherry-pick 458c63bc4b5f080a4a890ef242838ccba5e557ff 
$ git cherry-pick 340907456b4042de743cdd3924ce5b46ea25f5f5
$ git cherry-pick 99ee6c73d613ee859d321cda65c065aad6fb36df

Prepare for compiling:

1) Navigate back to your home directory for building:
Code:
$ cd ~/WORKING_DIRECTORY

2) Prepare To Compile:
Code:
$ source build/envsetup.sh

Or:
Code:
$ . build/envsetup.sh

3) Get your list of devices:
Code:
$ lunch

4) Now compile ('#' being the number of cores in your processor +1):

Code:
$ make -j#

Or for a flashable zip:
Code:
$ make -j# otapackage


Now you will found the zip in out folder.

Credits to:
baldwindguy77
dastin1015
GeyerA
XDA for learning me this.
 

Carlos_Manuel

Senior Member
Apr 28, 2011
4,092
5,368
27
Kuressaare
Compiling with a 64-bit device less than 4 GB is also possible. So minimum required memory is at least 2 GB, it's better to have 4GB than 2 because with 2 GB RAM chromium may be a little bit pain in as$ when it doesn't want to get built nicely every time. :p

Sent from my Galaxy Nexus using XDA Free mobile app
 
  • Like
Reactions: antonio8297

antonio8297

Senior Member
Mar 25, 2012
902
593
Camposano (NA)
Compiling with a 64-bit device less than 4 GB is also possible. So minimum required memory is at least 2 GB, it's better to have 4GB than 2 because with 2 GB RAM chromium may be a little bit pain in as$ when it doesn't want to get built nicely every time. :p

Sent from my Galaxy Nexus using XDA Free mobile app

yes,but with 4gb today I had some problem.
 
  • Like
Reactions: Carlos_Manuel

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    I'm not responsable for all that you do with your PC and your Nexus.

    For first you need a 64-bit PC,with minimum 4GB of RAM and a Dual-core PC,and Ubuntu.

    Start with PC configuration.

    1) You need the following:
    -JDK 6 if you wish to build Kit-Kat.
    Code:
    $ sudo add-apt-repository ppa:webupd8team/java
    $ sudo apt-get update && sudo apt-get install oracle-java6-installer

    -Python, which you can download from python.org. Or:
    Code:
    $ sudo apt-get install python

    -Git, which you can find it at git-scm.com. Or:
    Code:
    $ sudo apt-get install git-core

    -Android SDK:
    • Download the SDK here: http://developer.android.com/sdk/index.html
    • Extract the SDK and place it in your home directory.
    • I renamed my SDK to android-sdk to make it easier to navigate to.
    • Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
    • Add these lines at the bottom of the file:
      Code:
      # Android tools
      export PATH=${PATH}:~/android-sdk/tools
      export PATH=${PATH}:~/android-sdk/platform-tools
      export PATH=${PATH}:~/bin
    • Find your .profile file and add this at the bottom of the file:
      Code:
      PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
    • You have now successfully installed the Android SDK.
    • To check for updates issue this into your terminal:
      Code:
      $ android

    2) Installing required packages (Ubuntu 13.04+)
    Code:
    $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
      zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev lib32z1 \
      lib32ncurses5 lib32bz2-1.0 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \
      lib32z1-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 lzop
    $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Installing required packages (Ubuntu 12.04)
    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
    $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Installing required packages (Ubuntu 10.04 -- 11.10)
    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

    On Ubuntu 10.10:
    Code:
    $ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

    On Ubuntu 11.10:
    Code:
    $ sudo apt-get install libx11-dev:i386

    3) Configure your USB.
    Code:
    $ gksudo gedit /etc/udev/rules.d/51-android.rules

    Inside of this blank text file insert:
    Code:
    #Acer
    SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
    
    #ASUS
    SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
    
    #Dell
    SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
    
    #Foxconn
    SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
    
    #Garmin-Asus
    SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
    
    #Google
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
    
    #HTC
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
    
    #Huawei
    SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
    
    #K-Touch
    SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
    
    #KT Tech
    SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
    
    #Kyocera
    SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
    
    #Lenevo
    SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
    
    #LG
    SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
    
    #Motorola
    SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
    
    #NEC
    SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
    
    #Nook
    SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
    
    #Nvidia
    SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
    
    #OTGV
    SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
    
    #Pantech
    SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
    
    #Philips
    SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
    
    #PMC-Sierra
    SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
    
    #Qualcomm
    SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
    
    #SK Telesys
    SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
    
    #Samsung
    SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
    
    #Sharp
    SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
    
    #Sony Ericsson
    SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
    
    #Toshiba
    SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
    
    #ZTE
    SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"

    4) Save the file and close it and then issue this command:
    Code:
    $ sudo chmod a+r /etc/udev/rules.d/51-android.rules

    4a) [OPTIONAL] Setting up ccache
    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

    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.

    Code:
    export CCACHE_DIR=<path-to-your-cache-directory>

    The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code:

    Code:
    prebuilts/misc/linux-x86/ccache/ccache -M 50G

    This setting is stored in the CCACHE_DIR and is persistent.

    5) Install the repo:
    Code:
    $ mkdir ~/bin
    $ PATH=~/bin:$PATH
    $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo

    6) Initialize the repo:
    Code:
    $ mkdir WORKING_DIRECTORY
    $ cd WORKING_DIRECTORY

    6a) For AOSP:
    Code:
    $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.4_r2

    6.1) For people who have already done a repo init:
    Code:
    $ cd WORKING_DIRECTORY
    AOSP:
    Code:
    $ repo init -b android-4.4.4_r2
    $ repo sync

    7) When prompted, enter your real name and email address.

    8) Gather the files:
    Code:
    $ repo sync

    How to add Nexus device config.


    1) Navigate to the location you are going clone the device tree to:
    Code:
    $ cd WORKING_DIRECTORY/device
    $ mkdir samsung
    $ cd samsung

    2) Clone the github device tree from remote to local(I'll add all 3 variants of nexus)
    Code:
    git clone https://android.googlesource.com/device/samsung/tuna
    Code:
    git clone https://android.googlesource.com/device/samsung/maguro
    Code:
    git clone https://android.googlesource.com/device/samsung/toro
    Code:
    git clone https://android.googlesource.com/device/samsung/toroplus

    3) Add Vendor files(we will use shiny that are already on github,for simply setup):
    Return to source root folder and do:
    Code:
    $ mkdir vendor
    $cd vendor
    now clone vendor files:
    Code:
    git clone https://github.com/ShinyROM/android_vendor_widevine.git -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_nxp.git -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_invensense -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_broadcom -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_csr -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_ti -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_samsung -b master
    Code:
    git clone https://github.com/ShinyROM/android_vendor_imgtec -b master
    after this return to source root folder
    4) Add KitKat changes to the source(more difficult part):
    Tuna part:
    Code:
    $ cd device/samsung/tuna
    $ git remote add ShinyROM https://github.com/ShinyROM/android_device_samsung_tuna 
    $ git fetch ShinyROM
    $ git cherry-pick 4b8c328bbdf85eb9ef9ff91d387e856b0fa41598
    $ git cherry-pick 3b73c36a90dc64fea97a444b3f78f9c46f51d3a1 
    $ git cherry-pick 20bc682ea8b7f4839fac5a9186caad66654e8744
    $ git cherry-pick c3de6cd1a5d9836a26c8ec988961266e1d10eafb
    $ git cherry-pick 3ab5ebccee0447c05e502876915a4f80e694774c
    $ git cherry-pick 592cca8e9f9e2a6dc97aa04cdeec63b0f43f6cf8
    $ git cherry-pick 0370ce5c126c4beb08ac449fdba9520709850104
    $ git cherry-pick d218fe0237272173f8f525e73bc4af4eea8a22b2
    $ git cherry-pick 9d1cc345633397969161f1864c8fd31bea934ed5

    Now choose this for the type of your Nexus:
    Maguro doesn't any change.

    Toro part(will be added soon).

    Toroplus part:
    Code:
    $ cd device/samsung/toroplus
    $ git remote add ShinyROM https://github.com/ShinyROM/android_device_samsung_toroplus
    $ git fetch ShinyROM
    $ git cherry-pick 4bf9f8b5f3aa9a3d87cfcbeb8c12c59f4d7fbc42

    Glitch fix:
    return to source tree folder.
    Code:
    $ cd frameworks/native
    $ git remote add GeyerA https://github.com/GeyerA/platform_frameworks_native
    $ git fetch GeyerA
    $ git cherry-pick a92548738b12f37a0ae9bf2268a15c835cabed9d 
    $ git cherry-pick 8c5f62fefb9c8b3e7dc8a5fbbef3e69b9afd23f9
    $ git cherry-pick 2ec9852a507e977895f3794615506ca9f0e7e23b
    $ git cherry-pick 117c4c56d15774ec31b4db8bbe748709090e1a16
    $ git cherry-pick 32d4c4fda4032052b6a2938a89c1c7be9ecb3f75
    $ git cherry-pick 55fa4ff4ce705c7a059006f5ae3acd7d8671b968
    $ git cherry-pick 571387e4962f2981feb2414c16f210a6cea33810
    $ git cherry-pick 5b78c099864ece8a17bee54659fa342a6be2f5a3
    $ git cherry-pick 458c63bc4b5f080a4a890ef242838ccba5e557ff 
    $ git cherry-pick 340907456b4042de743cdd3924ce5b46ea25f5f5
    $ git cherry-pick 99ee6c73d613ee859d321cda65c065aad6fb36df

    Prepare for compiling:

    1) Navigate back to your home directory for building:
    Code:
    $ cd ~/WORKING_DIRECTORY

    2) Prepare To Compile:
    Code:
    $ source build/envsetup.sh

    Or:
    Code:
    $ . build/envsetup.sh

    3) Get your list of devices:
    Code:
    $ lunch

    4) Now compile ('#' being the number of cores in your processor +1):

    Code:
    $ make -j#

    Or for a flashable zip:
    Code:
    $ make -j# otapackage


    Now you will found the zip in out folder.

    Credits to:
    baldwindguy77
    dastin1015
    GeyerA
    XDA for learning me this.
    1
    Compiling with a 64-bit device less than 4 GB is also possible. So minimum required memory is at least 2 GB, it's better to have 4GB than 2 because with 2 GB RAM chromium may be a little bit pain in as$ when it doesn't want to get built nicely every time. :p

    Sent from my Galaxy Nexus using XDA Free mobile app
    1
    Compiling with a 64-bit device less than 4 GB is also possible. So minimum required memory is at least 2 GB, it's better to have 4GB than 2 because with 2 GB RAM chromium may be a little bit pain in as$ when it doesn't want to get built nicely every time. :p

    Sent from my Galaxy Nexus using XDA Free mobile app

    yes,but with 4gb today I had some problem.