[Motorola Droid RAZR] DROIDRAZ:
Hello. I will teaching you how to build CM10 from source. You will need: a computer, lots of patience, and lots of time. I am writing this guide because I want more people to try and develop ROMs for the Droid RAZR and also so things will get fixed faster with more people working on them.

Step 1: Install Ubuntu (10.04 - 11.10 ONLY)​

You will need a 64-bit version of Ubuntu for this. I think most computers should be compatible because I run 64-bit on my HP Mini netbook. I will be posting another thread later on how to do this. DO NOT INSTALL 12.04. It is only experimental.

Step 2: Install Android SDK​

The next step is to install the Android SDK. Go here and install everything except MTP support for Galaxy Nexus. It will install the files to /usr/local/android-sdk.

Step 3: Install Java Developer Kit (JDK)​

Next you will need to install the Java 6 JDK. To install it, open a terminal by pressing: Ctrl+Alt+T. Then enter this:

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

Remember to press enter after every line and if you encounter any errors please PM me.

Step 4: Install Python​

Now, you will need to install Python. On some versions of Ubuntu it is already included, but it doesn't hurt to check. Enter this into a terminal:

$ sudo apt-get install python

Step 5: Install Git​

Now it is time to install Git. It is one of the coolest, yet most confusing things, about Android/Linux. Think of it like this--it's a place where all of the revisions to the code go to be approved and get incorporated so that you have a solid piece of working software. To install enter this:

$ sudo apt-get install git-core

Step 6: Install Required Packages​

It is time to install more "specific" packages to compiling android. If you are running Ubuntu 64-bit 10.04 - 11.10 (if you are running 11.10 skip to next set of packages) install:

$ 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

If you are running 10.10 install these:

$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

If you are running 11.10 install these:

$ sudo apt-get install libx11-dev:i386

Step 7: Configure USB Access​

Note- You may already have this step done by following the link for setting up the Android SDK, but if you have errors come back to this step. If it still does not help you, PM me.

In order for ADB to work properly, you need to have USB access configured. Type these commands:

gksudo gedit /etc/udev/rules.d/99-android.rules

Add these lines to the file:

#Acer
SUBSYSTEM==usb, SYSFS{idVendor}==0502, MODE=0666

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

After that save and close the file. Then enter this:

$ sudo chmod a+r /etc/udev/rules.d/99-android.rules

Now you are done setting up the build environment and we can start downloading the source code.

Step 8: Downloading the source code and configuring repo ​

Create a /bin directory in the home directory using these commands:

$ mkdir ~/bin
$ PATH=~/bin:$PATH

Download the Repo script and ensure it is executable (works):

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

Now make a working directory:

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY

Note- WORKING_DIRECTORY can be anything you want it to be

Now we need to initialize repo into your WORKING_DIRECTORY:

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

Note- If you exit the terminal aafter this you will need to repeat this step

That will initialize Cyanogenmod repo into your WORKING_DIRECTORY. Now we need to put the STS-Dev-Team's local_manifest.xml into our build directory so we can use their source. Enter these commands:

$ curl -L -o .repo/local_manifest.xml -O -L https://raw.github.com/STS-Dev-Team/android_local_STS/jellybean-cm-kexec/local_manifest.xml

Then you have to get prebuilts:

./vendor/cm/get-prebuilts

Last but not least, we need to sync with the repo:

repo sync

Note- This step could take a long time depending on your internet connection. Please plan wisely.

If there is an error syncing prebuilt just enter:

repo sync prebuilt

That should fix it and do another repo sync after to make sure you get all of the source downloaded.

Step 9: Verify GIT Tags​

To verify the tags enter this:

gpg --import

After that copy and past this big 'ol list into the terminal and press Ctrl + D after you're done:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3d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ow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----

To verify an individual tag enter:

$ git tag -v TAG_NAME

Step 10: Building CM10​

The next step is to build it. If you know how to write Java for android you can modify the source code, but if you don't, then just enter this command and it will start building:

. build/envsetup.sh && brunch spyder

Then wait for it to finish building. On my machine it took me 15 hours for a single build, so it might be a while.

If you want to make it faster take the amount of cores you have and add 1 and replace that number with the "#" sign in the following command:

. build/envsetup.sh && brunch spyder -j#

If you are rebuilding, first switch into the root of your WORKING_DIRECTORY and type:

make clobber

Sorry, forgot to include this:

repo sync

Then type:

. build/envsetup && brunch spyder -j#

When it finishes you will have a .zip file in WORKING_DIRECTORY/out/target/product/spyder and you can flash it in recovery(preferably safestrap). Make sure you make a nandroid and do a full wipe. Wipe data, wipe cache partition, wipe dalvik cache, format /system. If you need to modify build.prop open the .zip and open it in a text editor and save it. Then update in the archive.

If you release it please credit the STS-Dev-Team for their source.

Thanks guys for reading this, please hit the thanks button and PM me if you have any questions. Have a good day

Credits: @dhacker29, @Hashcode0f, mattlgroff, and STS-Dev-Team

Sent from my CM10 ROM built using this guide.