[Samsung Galaxy Exhibit 4G] jocala:
Compile CM9

Portions copied from Motorola Droid X CyanogenMod Wiki

Thanks to Arco68 for hand-holding and patches. Any mistakes are mine.

These instructions assume that you will be using an Ubuntu 10.10 Linux system (or a close relation, Debian, Linux Mint,etc). Setting up a Linux partition or creating a Linux VM are beyond the scope of this post.

First, Install the Android SDK

Next, install the linux build packages required. I install using apt-get:

For 32-bit & 64-bit systems

apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool

For 64-bit only systems

apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

These instructions assume an "android" directory located in your home

Install repo

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

Download CM9 source

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

This can take hours. When done, ~/android/system should be at least 11Gb in size.

Next:

cd ~/android/system/frameworks/base
git remote add arco git://github.com/arco/android_frameworks_base.git
git fetch arco

Download kernel source

mkdir -p ~/android/system/kernel/samsung/ancora_tmo
cd ~/android/system/kernel/samsung/ancora_tmo
git init
git pull https://github.com/arco/samsung-kernel-msm7x30.git

Repeat the pull command occasionally to obtain updates.

Download ancora_tmo device directory

mkdir -p ~/android/system/device/samsung/ancora_tmo
cd ~/android/system/device/samsung/ancora_tmo
git init
git pull git://github.com/Jocala/device.ancora_tmo.ics.git

Repeat the pull command occasionally to obtain updates.

Download ancora_tmo vendor directory

mkdir -p ~/android/system/vendor/samsung/ancora_tmo
cd ~/android/system/vendor/samsung/ancora_tmo
git init
git pull git://github.com/Jocala/vendor.ancora_tmo.ics.git

Repeat the pull command occasionally to obtain updates.

Set up prebuilts:

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

Applying cherry-picks

You'll need to gain at least a rudimentary knowledge of

using git and github. Teaching this is beyond the scope

of this howto. Cherry-picks must be re-applied after each

repo sync.As time goes by they also get merged, so it may be that some

cherry-picks are no longer required. You can check their status here.

Attached to this post is a script (reposync.txt) that will do a repo

sync then apply current cherry-picks. I keep it in my

android/system directory. Rename and chmod 0755.

Set up your environment & build

. build/envsetup.sh
lunch cm_ancora_tmo-userdebug
brunch ancora_tmo

Building takes at least an hour. If everything worked, you should have a

out/target/product/ancora_tmo/cm-9-SOMEDATE-UNOFFICIAL-ancora_tmo.zip file

============

CCACHE

If you have room on your build system you can speed

your builds up considerably by using ccache. ccache is a compiler

cache. It speeds up re-compilation of C/C++ code by caching

previous compiles and detecting when the same compile is

being done again.

Install it with apt-get: sudo apt-get ccache

Set environment vars for Android use:

(I put these exports in my .bashrc)

export USE_CCACHE=1
export NDK_CCACHE=ccache

Set a cache size of 10G for optimal results:

ccache -M 10G

Check the status of your cache with the command:

ccache -s

Returns:

cache directory /home/jocala/.ccache
cache hit 106673
cache miss 18379
called for link 3758
preprocessor error 5
not a C/C++ file 4425
unsupported compiler option 678
no input file 4565
files in cache 36758
cache size 3.2 Gbytes
max cache size 10.0 Gbytes