[HTC Sensation] blahbl4hblah:
First of all, BIG BIG thanks to SparksCo for his guide for compiling CM7, I used his guide as a base for this

Credits:

CyanogenMod for giving their source to everyone

SparksCo for teaching me what I know

Vorbeth for releasing the original source for Sensation

Elelinux for his hardwork on adding things to the device tree

I'm making this guide for those who don't want to wait for a new CyanogenMod or AOKP build and want to build it themselves.

Working on both ubuntu 11.10 and 12.04

NOTE: DEPENDING ON YOUR COMPUTER'S HARDWARE, COMPILING TIME WILL BE DIFFERENT

If you have a MAC OSX, I do not have a guide for that as I don't have one.

Be aware for which part is for AOKP and CyanogenMod

I have put "AOKP" and "CyanogenMod" Labels to help

EVERYTHING THAT IS IN A BOX, OPEN TERMINAL AND ENTER THE COMMAND IN THAT SECTION

Guide Requirements:

- Computer

- Common Sense

- Some Linux Experience

- Ubuntu 64-bit Installed

- At least 4GB of ram with a dual core processor.

Required Software to Install:

For 32-bit and 64-bit System

sudo apt-get install git-core gnupg flex bison python rar original-awk gawk p7zip-full gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool xsltproc

For 64-bit System

sudo apt-get install g++-multilib lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib

Other Required Software:

sudo apt-get install libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils

Link libx11

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

You must have a 1.6.x to compile on the ics branch of cyanogenmod.

MUST Install Java 1.6 (NOT Java 1.7):

1a. Download Java JDK for Linux 64-bit from Java site

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Be sure to download (## will change if there's an update):

jdk-6u##-linux-x64.bin

1b. Move the downloaded Java JDK into your home directory

1c. Be sure to completely remove ALL OTHER JAVA

Don't worry if some things are asked to be installed just accept!

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

1d. Copy Java JDK into /opt/java/64

sudo mkdir -p /opt/java/64/
sudo cp jdk-6u##-linux-x64.bin /opt/java/64
sudo su -
cd /opt/java/64
chmod +x jdk-6u##-linux-x64.bin
./jdk-6u##-linux-x64.bin
exit

1e. Add the needed PATH to .bashrc

gedit ~/.bashrc

Add these lines to .bashrc (Better to be near the top):

# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_##
export PATH=$PATH:$JAVA_HOME/bin

Setting Up Android SDK

2a. Download Android SDK at http://developer.android.com/sdk/index.html

2b. Extract it to your home folder [Ex. ~/android/sdk]

2c. Add Android SDK Path

gedit ~/.bashrc

Enter the Following:

#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools

2d. Add Extra Path For Device:

sudo gedit /etc/udev/rules.d/99-android.rules (Text Editor will open up)

Enter this in it:

#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

SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"

After this, close it and then enter:

sudo chmod +x /etc/udev/rules.d/99-android.rules

If your using ANY AOSP rom like AOKP or CM9 and CM10

Go into developer options and go to root access and change it from "Apps only" to Apps and ADB"

2e. Install Certain Android SDK Tools

Type:

android

Check Android SDK Tools and Android SDK platform-tools and Install them

Setting Up the .bashrc file

gedit ~/.bashrc

Enter the Following:

#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools

#Java PATH
export JAVA_HOME=/opt/java/64/jdk1.6.0_32
export PATH=$PATH:$JAVA_HOME/bin

3b. After your done setting this up, close .bashrc file.

Setup Workplace

4a. Download CyanogenMod 9 Source

mkdir -p ~/bin
mkdir -p ~/android/system
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo (Reboot your computer after this)

4b. Add Repo Path

gedit ~/.bashrc

Enter the following:

export PATH=$PATH:~/bin

4c. Setup Necessary Source

For CyanogenMod 9

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

For CyanogenMod 10

cd ~/android/system
repo init -u git://github.com/CyanogenMod/android.git -b jellybean

4d. Download Necessary Source

repo sync

4e. Download Extra Needed Files

~/android/system/vendor/cm/get-prebuilts

Your Final .bashrc

It SHOULD Look Something Like This:

#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools
export PATH=$PATH:~/bin

#Java PATH
export JAVA_HOME=/opt/java/64/jdk1.6.0_##
export PATH=$PATH:$JAVA_HOME/bin

Building CyanogenMod

. build/envsetup.sh; lunch cm_pyramid-userdebug; mka bacon

Making a New Build

Go inside to your source folder and delete the 'out' folder

THEN Do This:

repo sync

. build/envsetup.sh; lunch cm_pyramid-userdebug; mka bacon