[Samsung Galaxy Nexus] exb0:
I know there's another thread about this, but that was kind of outdated, so I decided to do another one. Here we goo~

Requirements :-

Ubuntu 11.10 64bit (this is what I'm using, I won't make a guide for others)

Decent Internet connection

At least 50GB of hard disc space

4GBs of ram

Dual Core processor

and patience.

First off, we need to download and install some stuff.. Type in each line one by one.

sudo -i
add-apt-repository ppa:ferramroberto/java
apt-get update
apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin
apt-get install python
apt get install git-core

Now that your Java is downloaded, we need to get some extra files.

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

Note that liv32readline5-dev might not be available anymore, if that's the case, remove that from the code, run it and run an extra line after you've done the one on top

apt-get install lib32readline-gplv2-dev

then this

ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

Now we get to setup directories for your source and repo !

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

If you noticed, everytime you start your ubuntu you need to type in "PATH=~/bin:$PATH" again before you can repo. To fix this :

sudo gedit ~/.bashrc

then add in

export = PATH=~/bin:$PATH"

Now we make a directory for your source, you can use any name you want, in this case I'm using CMSOURCE (this IS case sensitive, btw.)

mkdir CMSOURCE
cd CMSOURCE

Now we can initialize repo

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

If you want Jelly Bean

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

then

repo sync

or

repo sync -j1

or

repo sync -j16

I suggest only to try the -j1 and -j16 ONLY IF there is problem by using the normal repo sync. Honestly I don't know what this does but from my experience, j1 is slower but apparently more stable. j16 is faster but chances of corrupting is higher. but I've only ran this once so I'm not really sure. Don't take my word on this.

This WILL take awhile, go watch a movie, feed your pet, skydive, drink coffee, drink beer or something.

After that's done, you need to get some files for your Cyanogen build, eg Rom Manager. Without these files it wont compile correctly.

cd CMSOURCE/vendor/cm
./get-prebuilts

Now we've got to get some files from the phone, but I'm using the one from google, rather than extracting from the phone.

http://code.google.com/android/nexus/drivers.html

Go there, click Maguro , download the files, extract it anywhere, and run it inside a terminal. (just drag the file into the terminal, press enter and choose run. follow the instructions on screen. you need all of them. )

ALRIGHTY! If you've done all these steps without any problem, it's time to compile!

cd
cd CMSOURCE
source build/envsetup.sh
brunch

and choose your device

This takes about 3 and a half hours on my friends alienware m15x.

On my desktop it takes about 1 and a half hour. Just over night it to be safe.

Before re-compiling, clean your work folder first.

make clobber

To update your sources,

repo sync

I'm new at this compiling thing, so if anything is wrong please tell. :) I just wrote this to help if someone is running into problems like I did.

optional/old/useless

we need to add a line to specify where our kernel is before we can build, so do this.

sudo -i
nautilus

go to

CMSOURCE/device/samsung/maguro

Open BoardConfig.mk

add

TARGET_KERNEL_CONFIG := cyanogenmod_maguro_defconfig
TARGET_PREBUILT_KERNEL := device/samsung/tuna/kernel

save, close.

Cherry Picking

WILL UPDATE.