FORUMS
Remove All Ads from XDA

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

1,861 posts
Thanks Meter: 4,152
 
By Kayant, Senior Member on 11th April 2012, 01:44 AM
Thread Closed Email Thread
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



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:
$ sudo yaourt -S android-tools 
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

Yaourt
Code:
$ sudo yaourt -S pngcrush sun-java6
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 schedtool pngcrush


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:
$ sudo apt-get purge openjdk*
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java6-installer
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
The Following 69 Users Say Thank You to Kayant For This Useful Post: [ View ] Gift Kayant Ad-Free
 
 
11th April 2012, 07:37 AM |#2  
Zenkai86's Avatar
Member
Flag Lyngby
Thanks Meter: 11
 
More
Gonna try this a little later

Sent from my MB526 using xda premium
11th April 2012, 08:59 AM |#3  
CallMeVentus's Avatar
Senior Member
Flag Singapore
Thanks Meter: 2,876
 
Donate to Me
More
Awesome guide , been looking for one

Defy-ing all limits.
11th April 2012, 09:43 AM |#4  
OP Senior Member
Thanks Meter: 4,152
 
More
Thanks ...... Tell me if i a have missed anything...... Am not great at explaining stuff
14th May 2012, 12:44 PM |#5  
Senior Member
Flag Munich
Thanks Meter: 36
 
Donate to Me
More
Is it the same procedure for a Defy+ (MB526) build?

Quote:

!! Reboot for these changes to take effect.

A reboot isn't needed.

Quote:

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?
14th May 2012, 06:50 PM |#6  
OP Senior Member
Thanks Meter: 4,152
 
More
Quote:
Originally Posted by yodawg

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 ..... 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 ..... 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....
The Following 2 Users Say Thank You to Kayant For This Useful Post: [ View ] Gift Kayant Ad-Free
11th July 2012, 08:56 PM |#7  
Senior Member
Flag Munich
Thanks Meter: 36
 
Donate to Me
More
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?
11th July 2012, 09:18 PM |#8  
OP Senior Member
Thanks Meter: 4,152
 
More
Quote:
Originally Posted by yodawg

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
use this as an additional guideline - http://forum.xda-developers.com/show...php?p=28529222
The Following User Says Thank You to Kayant For This Useful Post: [ View ] Gift Kayant Ad-Free
17th July 2012, 02:52 AM |#9  
brajesh.sharma87's Avatar
Senior Member
Flag Kolkata
Thanks Meter: 2,829
 
More
@Kayant: do u think a core2duo 2.0 ghz with 4 gb RAM can build? If yes, How much time will it take approximately.
17th July 2012, 05:43 AM |#10  
hackergnome's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 872
 
Donate to Me
More
Quote:
Originally Posted by brajesh.sharma87

@Kayant: do u think a core2duo 2.0 ghz with 4 gb RAM can build? If yes, How much time will it take approximately.

For me c2d 2ghz and 3gig ram took 5 hrs...(RAM at 1200mhz)
No background process...All resources to compiler...

Sent from my MB525 using xda premium
The Following 2 Users Say Thank You to hackergnome For This Useful Post: [ View ] Gift hackergnome Ad-Free
17th July 2012, 06:03 AM |#11  
Junior Member
Flag Chengdu
Thanks Meter: 1
 
Donate to Me
More
I want to mod a rom based on cm9, but I did not decide to use whose code
Thread Closed Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes