[Samsung Galaxy Nexus] elia222:
Since I sold my Galaxy Nexus and I won't continue to build crDroid rom for it, I made this step by step guide to build 4.4 KitKat crDroid rom running on this device from Cristiano Matos and cm's github.

This guide is meant for Ubuntu 13.10 64 bit. 32 Bit won't work.

If you want to use another ubuntu version, some things might be a little different. Just search on xda and you will find all the instructions that you need to complete the setup.

DISCLAMER

Although the procedures in this guide were tested on my pc/phone and produced a working build for my Galaxy Nexus, I take no responsibility for any consequences derived from their use.

1) SET UP THE BUILD ENVIRONMENT

Remove openJDK and install Java 6 jdk. Open a terminal and type:

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

This will uninstall openJDK.

sudo add-apt-repository ppa:webupd8team/java

Adds a PPA to your system, needed to download java.

sudo apt-get update && sudo apt-get install oracle-java6-installer

Download and installs java!

To make sure the correct version of Java is activated, run the following at the Terminal prompt:

java -version

You should see something like that:

java version "1.6.0_45"

Java(TM) SE Runtime Environment (build 1.6.0_45-b06)

Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

Now type:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-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

This will install the needed packages.

When done, do this:

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

Now, install the repo binary:

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

Edit .bashrc:

sudo nano ~/.bashrc

At the bottom of the file, add the following line:

export PATH=~/bin:$PATH

Save it (In nano type Ctrl-O and then Enter, then Ctrl-X to exit back to a prompt).

Restart bash:

source ~/.bashrc

2) DOWNLOAD THE SOURCES:

mkdir ~/cyanogenmod
cd ~/cyanogenmod

This creates a folder named "cyanogenmod" and opens it.

Initialize the repo:

repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

Open cyanogenmod folder, press ctrl+H to show hidden files, open .repo, open local_manifests and edit roomservice.xml (If it isn't present create it) to be like this one:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote fetch="http://github.com/" name="gh" revision="master" />
<remote fetch="https://github.com/TheMuppets/" name="TheMuppets" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="gh" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_imgtec" path="vendor/imgtec" remote="gh" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_broadcom" path="vendor/broadcom" remote="gh" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_invensense" path="vendor/invensense" remote="gh" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_widevine" path="vendor/widevine" remote="gh" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_nxp" path="vendor/nxp" remote="gh" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_maguro" path="device/samsung/maguro" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_toroplus" path="device/samsung/toroplus" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_toro" path="device/samsung/toro" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_samsung_tuna" path="kernel/samsung/tuna" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_tuna" path="device/samsung/tuna" remote="github" revision="cm-11.0" />
<remove-project name="CyanogenMod/android_packages_apps_Dialer" />
<project name="cristianomatos/android_packages_apps_Dialer" path="packages/apps/Dialer" remote="github" revision="cm-11" />
<remove-project name="CyanogenMod/android_packages_apps_InCallUI" />
<project name="cristianomatos/android_packages_apps_InCallUI" path="packages/apps/InCallUI" remote="github" revision="cm-11" />
<remove-project name="CyanogenMod/android_packages_services_Telephony" />
<project name="cristianomatos/android_packages_services_Telephony" path="packages/services/Telephony" remote="github" revision="cm-11" />
<remove-project name="CyanogenMod/android_frameworks_base" />
<project name="cristianomatos/android_frameworks_base" path="frameworks/base" remote="github" revision="cm-11" />
<remove-project name="CyanogenMod/android_packages_apps_Settings" />
<project name="cristianomatos/android_packages_apps_Settings" path="packages/apps/Settings" remote="github" revision="cm-11" />
</manifest>

Download time!

repo sync

It will download about 10gb of data, so be patient!

Download the prebuilts:

~/cyanogenmod/vendor/cm/get-prebuilts

3) BUILD THE ROM:

. build/envsetup.sh && brunch name_of_device

Where "name_of_device" is maguro, toro or toroplus, depending for which ersion you want to build.

It will take some time (on my pc with 3GHz dual core and 4gb of ram about 2h30min)

If everything goes right the flashable zip of the rom will be in cyanogenmod/out/target/product/name_of_device/cm-11-XXXXXXXXX-UNOFFICIAL-name_of_device.zip :D

4) Install the rom on your phone!

-------------------------------------------------------------------------------------------------------------

Some other tips:

When you want to download latest crdroid/cm changes open a new terminal and type:

cd cyanogenmod
repo sync

When you want to delete the build products (because something has gone wrong or you want to make a new build):

make clean

Then:

. build/envsetup.sh && brunch name_of_device

To start building again.