[Guide] Compile your own nightly builds - AOKP, CM10, CM9, CNA, Slim Bean, P.A.C

Status
Not open for further replies.
Search This thread

Kayant

Senior Member
Jul 14, 2011
1,861
4,150
Disclaimer - About 4Gb+ to download the source for ICS & 10GB+ are so for JB
You will need 25GB (or more) free to complete a single build, and up to 80GB (or more) for a full set of builds.

To compile android you will need an linux distro preferably an Ubuntu-based distributions such as Ubuntu, Linux Mint however, you can use almost any Linux environment as long as you have the right packages and configurations. In this tutorial I will be showing how to use two Linux distributions Arch-Linux and any Ubuntu-based distribution.

To build android you will need a 64bit OS.

For Ubuntu you need either 10.04LTS or 11.10,12.04 futher version may require some more changes so please research this for find out

For Arch you just need the packages below because Arch is awesome like that :D



Common Setup


1)SDK

May not be needed - [Untested] Please report if it works for you

  • 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) ADB Ubuntu

Note : Also for Arch if android sdk was downloaded

Configure your USB.
Code:
$ sudo 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"
3) Save the file and close it and then issue this command:
Code:
$ sudo chmod a+r  /etc/udev/rules.d/51-android.rules

ADB Arch if android-sdk hasn't been installed
Code:
[FONT=Trebuchet MS][SIZE=4]$ sudo yaourt -S android-tools [/SIZE][/FONT]

4) Install the repo:
Code:
$  mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ Reboot your pc.

5) Packages Arch

Pacman
Code:
$ sudo pacman -S perl git gnupg flex bison gperf zip unzip lzop sdl wxgtk \
quashfs-tools ncurses libpng zlib libusb libusb-compat readline schedtool \
optipng python2 perl-switch lib32-zlib lib32-ncurses lib32-readline \
gcc-libs-multilib gcc-multilib lib32-gcc-libs binutils-multilib libtool-multilib
[/SIZE][/FONT]

Yaourt
Code:
[FONT=Trebuchet MS][SIZE=4]$ sudo yaourt -S [/SIZE][/FONT][FONT=Trebuchet MS][SIZE=4]pngcrush sun-java6[/SIZE][/FONT]
Packages Ubuntu 10.04 - 11.10
Code:
[FONT=Trebuchet MS]$ sudo apt[/FONT][FONT=Trebuchet MS]-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 \[/FONT][FONT=Trebuchet MS]
libxml2-utils xsltproc schedtool pngcrush[/FONT]

Packages Ubuntu 12.04 - 13.04
Code:
$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip bzr 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 schedtool pngcrush

Sun Java 6

Code:
[FONT=Trebuchet MS][SIZE=4]$ sudo apt-get purge openjdk*
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java6-installer[/SIZE][/FONT]
Additional changes needed

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

On Ubuntu 11.10:

$ sudo apt-get install libx11-dev:i386

On Ubuntu 12.04/13.04:
$
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

6) Download the source

$ mkdir cm(name it whatever you want)
$ cd into the the directory you just created so for me $ cd cm

For CM10
$ repo init -u git://github.com/Quarx2k/android.git -b jellybean

For CM9
$ repo init -u git://github.com/Quarx2k/android.git -b ics
or
$ repo init -u git://github.com/tpruvot/android.git -b ics

For AOKP JB (Black screen bug unsupported do not build!!)
$ repo init -u git://github.com:Kayant/platform_manifest.git -b jb

For AOKP ICS
$ repo init -u git://github.com:Kayant/platform_manifest.git -b ics

For Slim Bean
$ repo init -u git://github.com/Kayant/platform_manifest.git -b SLIM

For CNA

$ repo init -u git://github.com/Kayant/android_manifest.git -b jellybean

For P.A.C
$ repo init -u git://github.com/Kayant/PAC_android.git -b jellybean

Now
$ repo sync
or
If you have a good connection try this

$ repo sync -j16
If it breaks reduce the number or just

$ repo sync

if you still cant just repo sync

$ repo sync -f

Again if you're still getting errors - A tip from my good friend Pottkopp just leave the pc to sync stop watching those videos, chatting, etc u get the idea because this needs a lot of bandwidth .....

Takes about 2 hours or more for me to sync



7) 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.
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.
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:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
When building Ice Cream Sandwich (4.0.x) or older, ccache is in a different location:
prebuilt/linux-x86/ccache/ccache -M 50G
This setting is stored in the CCACHE_DIR and is persistent.

8) Building

All Jellybean roms now use mb526 build for Defy&Defy + thanks to the unified custom kernel

Cyanogenmod -

First you need to download the some stuff or CM won't build -
$ ./vendor/cm/get-prebuilts

If you are getting errors then read this post - here Thanks Skeevy.

Jellybean
$ source build/envsetup.sh && brunch mb526

ICS

$ source build/envsetup.sh && brunch jordan (for defy)
$ source build/envsetup.sh && brunch jordan_plus (for red lense including Defy+)

AOKP JB/ICS -
$ source build/envsetup.sh && lunch
choose aokp_mb526

Slim Bean -

$ source build/envsetup.sh && lunch
choose slim_mb526

CNA -

$ source build/envsetup.sh && lunch
choose cna_mb526

P.A.C
$ ./build-pac.sh mb526 true

Now to Build if the lunch command has been used-
Replace bacon with squish if building CNA

make -j# bacon(# represents double the cores you have on your computer)

So i have two cores so i do make -j4 bacon or you can use mka bacon and the
computer will choose the best one for you

After some hours or minutes if you have a beast of a computer your build should be complete... Well done ^_^

Use the signed zip to update the defy in recovery, don't use the ota package !

File is will be located in ~/out/target/product/mb526
E.g for defy aokp it will be out/target/product/mb526/then aokp_mb526-date.zip.



P.s if you get any errors search this thread first and google then post if you can't find your answer.

Credit and Thanks

Walter79 for his guide and help
Quarx2k, Epsylon3 Maniac103 and the many other moto devs for their work on the motorola devices
Dastin1015 for his guide as am using some of his instructions in this tutorial

Credit and thanks to Google for the guide I used the Ccache setup section from source.andriod.com
 
Last edited:

Kayant

Senior Member
Jul 14, 2011
1,861
4,150
Thanks :) ...... Tell me if i a have missed anything...... Am not great at explaining stuff :p
 

yodawg

Senior Member
May 11, 2012
101
36
Munich
Is it the same procedure for a Defy+ (MB526) build?

!! Reboot for these changes to take effect.

A reboot isn't needed.

ok now go to to vendor/cm/proprietary and delete rom manager has you don't need it since our awesome Epyslon3 has a special modded one that is integrated in the build

How about Quarx builds? Is there also a manager included? Do I need a ROM manager at all for the ROM to work?
 

Kayant

Senior Member
Jul 14, 2011
1,861
4,150
Is it the same procedure for a Defy+ (MB526) build?

A reboot isn't needed.

How about Quarx builds? Is there also a manager included? Do I need a ROM manager at all for the ROM to work?

It doesn't hurt to do it does it :p..... anyway all tutorials i have read said you should reboot so yh.....

Rom manager i think is needed by CM for it to build not really too sure but Epyslon3 told me himself that it's not needed i have builted about 10 or so times i can see that is true :D ..... For defy+ builds you need to edit your mainfest in the .repo folder in the folder you're using scroll down and edit it with gedit change it to ics-plus you will see a note on how to do it....
 

yodawg

Senior Member
May 11, 2012
101
36
Munich
Now theres also a jelly bean branch, which doesnt differ that much from ics for now. What do i have to do to update my repo to jellybean without redownloading the whole thing? A simple "repo init -u git://github.com/Quarx2k/android.git -b jb" and "repo sync" in that ics directory? or does it mess up everything?
 

Kayant

Senior Member
Jul 14, 2011
1,861
4,150
Now theres also a jelly bean branch, which doesnt differ that much from ics for now. What do i have to do to update my repo to jellybean without redownloading the whole thing? A simple "repo init -u git://github.com/Quarx2k/android.git -b jb" and "repo sync" in that ics directory? or does it mess up everything?

Of course you have to re-download everything it's a different source from ICS but it's about the same size 6GB but i don't know if there is a point in trying at the moment since neither quarx2k or Epyslon3 have actually build it yet but you can try however, you need to update the device tree for JB quarx2k has started working on it......
and don't do it in the same folder expect if you delete .repo folder first but you might still get errors so you might aswell make a different folder also it should be repo init -u git://github.com/Quarx2k/android.git -b jellybean. Good luck :D
use this as an additional guideline - http://forum.xda-developers.com/showthread.php?p=28529222
 
  • Like
Reactions: yodawg

57op

Senior Member
Jun 9, 2011
445
296
Awesome How-To ;) Maybe you should add packages needed in order to compile without error the rom.

However, I tried to build cm from source a month ago with my old pc. It took about 18 hours and it failed though. LOL
 
Last edited:

Kayant

Senior Member
Jul 14, 2011
1,861
4,150
esome How-To ;) Maybe you should add packages needed in order to compile without error the rom.

However, I tried to build cm from source a month ago with my old pc. It took about 18 hours and it failed though. LOL

What packages???
Edit - I think I see what u mean I will update this thread in a couple of days
 
Last edited:

bharaththeunique

Senior Member
Sep 3, 2011
613
184
Surat, Gujarat
Awesome guide.....fr starters like me....this is gonna be my challenge fr next hols.....I will try aosp gb.....must be the lightest one....!!!!....thnx

Sent from my MB526 using xda app-developers app
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 68
    Disclaimer - About 4Gb+ to download the source for ICS & 10GB+ are so for JB
    You will need 25GB (or more) free to complete a single build, and up to 80GB (or more) for a full set of builds.

    To compile android you will need an linux distro preferably an Ubuntu-based distributions such as Ubuntu, Linux Mint however, you can use almost any Linux environment as long as you have the right packages and configurations. In this tutorial I will be showing how to use two Linux distributions Arch-Linux and any Ubuntu-based distribution.

    To build android you will need a 64bit OS.

    For Ubuntu you need either 10.04LTS or 11.10,12.04 futher version may require some more changes so please research this for find out

    For Arch you just need the packages below because Arch is awesome like that :D



    Common Setup


    1)SDK

    May not be needed - [Untested] Please report if it works for you

    • 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) ADB Ubuntu

    Note : Also for Arch if android sdk was downloaded

    Configure your USB.
    Code:
    $ sudo 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"
    3) Save the file and close it and then issue this command:
    Code:
    $ sudo chmod a+r  /etc/udev/rules.d/51-android.rules

    ADB Arch if android-sdk hasn't been installed
    Code:
    [FONT=Trebuchet MS][SIZE=4]$ sudo yaourt -S android-tools [/SIZE][/FONT]

    4) Install the repo:
    Code:
    $  mkdir ~/bin
    $ PATH=~/bin:$PATH
    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo
    $ Reboot your pc.

    5) Packages Arch

    Pacman
    Code:
    $ sudo pacman -S perl git gnupg flex bison gperf zip unzip lzop sdl wxgtk \
    quashfs-tools ncurses libpng zlib libusb libusb-compat readline schedtool \
    optipng python2 perl-switch lib32-zlib lib32-ncurses lib32-readline \
    gcc-libs-multilib gcc-multilib lib32-gcc-libs binutils-multilib libtool-multilib
    [/SIZE][/FONT]

    Yaourt
    Code:
    [FONT=Trebuchet MS][SIZE=4]$ sudo yaourt -S [/SIZE][/FONT][FONT=Trebuchet MS][SIZE=4]pngcrush sun-java6[/SIZE][/FONT]
    Packages Ubuntu 10.04 - 11.10
    Code:
    [FONT=Trebuchet MS]$ sudo apt[/FONT][FONT=Trebuchet MS]-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 \[/FONT][FONT=Trebuchet MS]
    libxml2-utils xsltproc schedtool pngcrush[/FONT]

    Packages Ubuntu 12.04 - 13.04
    Code:
    $ sudo apt-get install git gnupg flex bison gperf build-essential \
    zip bzr 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 schedtool pngcrush

    Sun Java 6

    Code:
    [FONT=Trebuchet MS][SIZE=4]$ sudo apt-get purge openjdk*
    $ sudo add-apt-repository ppa:webupd8team/java
    $ sudo apt-get update
    $ sudo apt-get install oracle-java6-installer[/SIZE][/FONT]
    Additional changes needed

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

    On Ubuntu 11.10:

    $ sudo apt-get install libx11-dev:i386

    On Ubuntu 12.04/13.04:
    $
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    6) Download the source

    $ mkdir cm(name it whatever you want)
    $ cd into the the directory you just created so for me $ cd cm

    For CM10
    $ repo init -u git://github.com/Quarx2k/android.git -b jellybean

    For CM9
    $ repo init -u git://github.com/Quarx2k/android.git -b ics
    or
    $ repo init -u git://github.com/tpruvot/android.git -b ics

    For AOKP JB (Black screen bug unsupported do not build!!)
    $ repo init -u git://github.com:Kayant/platform_manifest.git -b jb

    For AOKP ICS
    $ repo init -u git://github.com:Kayant/platform_manifest.git -b ics

    For Slim Bean
    $ repo init -u git://github.com/Kayant/platform_manifest.git -b SLIM

    For CNA

    $ repo init -u git://github.com/Kayant/android_manifest.git -b jellybean

    For P.A.C
    $ repo init -u git://github.com/Kayant/PAC_android.git -b jellybean

    Now
    $ repo sync
    or
    If you have a good connection try this

    $ repo sync -j16
    If it breaks reduce the number or just

    $ repo sync

    if you still cant just repo sync

    $ repo sync -f

    Again if you're still getting errors - A tip from my good friend Pottkopp just leave the pc to sync stop watching those videos, chatting, etc u get the idea because this needs a lot of bandwidth .....

    Takes about 2 hours or more for me to sync



    7) 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.
    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.
    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:
    prebuilts/misc/linux-x86/ccache/ccache -M 50G
    When building Ice Cream Sandwich (4.0.x) or older, ccache is in a different location:
    prebuilt/linux-x86/ccache/ccache -M 50G
    This setting is stored in the CCACHE_DIR and is persistent.

    8) Building

    All Jellybean roms now use mb526 build for Defy&Defy + thanks to the unified custom kernel

    Cyanogenmod -

    First you need to download the some stuff or CM won't build -
    $ ./vendor/cm/get-prebuilts

    If you are getting errors then read this post - here Thanks Skeevy.

    Jellybean
    $ source build/envsetup.sh && brunch mb526

    ICS

    $ source build/envsetup.sh && brunch jordan (for defy)
    $ source build/envsetup.sh && brunch jordan_plus (for red lense including Defy+)

    AOKP JB/ICS -
    $ source build/envsetup.sh && lunch
    choose aokp_mb526

    Slim Bean -

    $ source build/envsetup.sh && lunch
    choose slim_mb526

    CNA -

    $ source build/envsetup.sh && lunch
    choose cna_mb526

    P.A.C
    $ ./build-pac.sh mb526 true

    Now to Build if the lunch command has been used-
    Replace bacon with squish if building CNA

    make -j# bacon(# represents double the cores you have on your computer)

    So i have two cores so i do make -j4 bacon or you can use mka bacon and the
    computer will choose the best one for you

    After some hours or minutes if you have a beast of a computer your build should be complete... Well done ^_^

    Use the signed zip to update the defy in recovery, don't use the ota package !

    File is will be located in ~/out/target/product/mb526
    E.g for defy aokp it will be out/target/product/mb526/then aokp_mb526-date.zip.



    P.s if you get any errors search this thread first and google then post if you can't find your answer.

    Credit and Thanks

    Walter79 for his guide and help
    Quarx2k, Epsylon3 Maniac103 and the many other moto devs for their work on the motorola devices
    Dastin1015 for his guide as am using some of his instructions in this tutorial

    Credit and thanks to Google for the guide I used the Ccache setup section from source.andriod.com
    3
    Ok so just to be clear. You think that quarx won't rename his mr1-staging branch but keeps on using it for the new CM? I'm asking because I'm planning on building Quarx' Cyanogen for 4.2 but I don't want to re-download everything just because he renamed the whole thing ;)

    Well I don't know am just speculating but if you do want to build then repo init again but with mr1-staging instead of jellybean and build.
    It will probably take some time to sync since it's a new update to 4.2.

    Thanks, this worked. I have compiled and flashed successfully.

    Great to see it work :) Will add it to the OP until quarx removes it.
    3
    OK people try this

    1. repo sync for the latest changes

    2. cd into the build folder in your working directory.

    3. cd into the build folder

    4. $ git log

    5. now look for the commit that says compiler options copy the some of the numbers after the commit. For example commit 916d756c3086e58b9d3d2cb183572229ba32d80d. I would copy 916d756.

    6. git revert <number>. So for me I would git revert 916d756.

    7. Don't apply the linaro script and try building again

    If you get any errors report back as there is one more place we need to revert changes.
    3
    Hi,

    I'm trying my first build for mb525 with Quarx2k and Epsylon's repos.
    I'm using Ubuntu 12.04 64bits with gcc 4.4 (downgraded)

    but but I'm stucki with some errors

    in quarx2k I got these:
    Code:
    target thumb C: hostap <= external/hostapd/hostapd/driver_wilink.c
    external/hostapd/hostapd/regulatory.c:56:26: fatal error: APExternalIf.h: No such file or directory
    compilation terminated.
    make: *** [out/target/product/mb525/obj/EXECUTABLES/hostap_intermediates/hostapd/regulatory.o] Error 1
    make: *** Waiting for unfinished jobs....
    external/hostapd/hostapd/driver_wilink.c:68:26: fatal error: APExternalIf.h: No such file or directory
    compilation terminated.
    make: *** [out/target/product/mb525/obj/EXECUTABLES/hostap_intermediates/hostapd/driver_wilink.o] Error 1

    delete external/hostpad

    and in epsylon's I got these:
    Code:
    target thumb C: libtiOsLibAP <= hardware/ti/wlan/wl1271_softAP/CUDK/os/linux/src/ipc_wpa.c
    hardware/ti/wlan/wl1271_softAP/CUDK/os/linux/src/ipc_wpa.c:38:22: fatal error: wpa_ctrl.h: No such file or directory
    compilation terminated.
    make: *** [out/target/product/mb525/obj/STATIC_LIBRARIES/libtiOsLibAP_intermediates/ipc_wpa.o] Error 1
    make: *** Waiting for unfinished jobs....
    hardware/ti/wlan/wl1271_softAP/CUDK/configurationutility/src/wpa_core.c:43:25: fatal error: config_ssid.h: No such file or directory
    compilation terminated.
    make: *** [out/target/product/mb525/obj/EXECUTABLES/tiap_cu_intermediates/src/wpa_core.o] Error 1

    Could someone help me ?
    What can I do to fix these errors ?

    Thanks in advance

    Delete softAP.

    Both softAP and hostpad is not ready for JB yet.

    best of luck in compiling now. :)
    3
    Made a private group here @ http://forum.xda-developers.com/group.php?groupid=797

    Sent invites to the following
    aleeyt
    brajesh.sharma87
    Epsylon3
    josuearisty
    Kayant
    m11kkaa
    maniac103
    Quarx
    TweetyPeety
    walter79

    I'm sure I missed someone so let me know and I'll send out more invites.