I've had a few people ask me this over the past few days via Twitter and other means, it was initially sent as a PM to a couple of people but I may as well just make it a thread at this point. I would've written this for CM10 but that's a bit more involved at the moment. Hacks.
This is pretty much how I always did my builds for CyanogenMod 9. I'll be assuming you have general Linux knowledge as teaching that too would take quite a lot longer.
You need a Linux distribution that is Debian based, Ubuntu is always preferred when it comes to building Android, though personally I've always used Debian 6 and had no trouble. I also hope you have lots of RAM.
For 32-bit and 64-bit systems, install as much of:
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
That is available. If you're 64-bit you will also need:
lib32z1-dev lib32ncurses5-dev lib32readline6-dev gcc-multilib g++-multilib
You will also need to install the Sun Java 6 JDK which is a bit of a pain as due to Oracle issues it has been removed from Ubuntu repositories. You'll probably have to do a bit of a Google around as the best method to do this changes pretty often for some reason. The package was sun-java6-jdk. Some have had luck with this: http://www.gaggl.com...n-ubuntu-12-04/
It's time to meet "repo". repo is Google's git management wrapper that ties many git repositories together. It is used to initially sync and update the CM code base.
I would advise you put the "repo" tool at ~/bin so that you can call it anywhere as that user, e.g:
mkdir -p ~/bin curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repo(Had to code tag this one as MoDaCo shortened it as a link...)
After this you'll want to start initialising and cloning the source.
mkdir -p ~/android/source/cm9
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync -j4
This'll take a while as you're downloading the whole Android source and history. Once done, I'd run repo sync again just to make sure everything synced properly. Syncs don't take long after the initial sync, it just pulls what has changed.
You'll now want to set up a local manifest for my repos (unless you want to go it alone and reinvent the wheel with supporting the device). This allows you to pull the updates in my repos at the same time as you run repo sync as if it were part of CM9. It generally makes things easier instead of you having to worry about git pulling all my stuff when there's an update. Navigate to your CM9 folder, and the ".repo" folder within that, e.g; cd ~/android/source/cm9/.repo/
This is my manifest, and I doubt you'll have anything to change. You just save this to local_manifest.xml within the .repo directory.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dazzozo/android_device_zte_blade2" path="device/zte/blade2" remote="github" revision="ics" />
<project name="Dazzozo/proprietary_vendor_zte" path="vendor/zte" remote="github" revision="ics" />
Run repo sync again and you'll also notice it pulling these repos. Pretty much done by this point, you'll want to go to ~/android/source/cm9/vendor/cm and run ./get-prebuilts in there. This just gets the ROM Manager apk, Terminal Emulator apk and its associated lib (yuck, I know, but they are required in the build process and it will complain if they're missing.)
You're ready to build - though it doesn't hurt to throw in another repo sync.
From the CM9 folder, in my example, ~/android/source/cm9/, you want to run . build/envsetup.sh which initialises the environment for building. Once you've done this, run brunch cm_blade2-userdebug and it'll take it from there.
Android is pretty big and it depends on your hardware how quick the build process is, my builds typically take about 20-30 minutes with an Intel i5-2300 2.8GHz Quad-Core. A word of warning: if you're making changes there's a chance they might not get picked up by the build process, I've no idea why this happens - it's apparently a widespread issue. If you want to completely clean your output files, run rm -rf out/target which will scrub anything related to the device.
Once the build has finished it will tell you where the final zip is at. Have fun!