Compiling CyanogenMod 9

I initally added instructions here for compiling ColdFusionX as I was helping to maintain the project. Now that it looks like we’ll get an official CM9 for ZTE Blade, its been deprecated, so here’s the CM9 build instructions. It takes about 50mins to compile (including kernel) which is only about 10mins more than CM7+kernel would have taken on my 12Gb RAM, 3.2GHz Intel Core i5 Linux box with SSD.

1. Download CM9 (use repo sync to update) this is about 15Gb worth:

mkdir -p ~/cm9/vendor/zte/blade
curl > ~/bin/repo
chmod a+x ~/bin/repo
cd ~/cm9
repo init -u git:// -b ics

2. Download ZTE proprietary libs (use git pull to update) and copy into place. you’ll probably only have to do this once as they don’t get updated often:

git clone -b ics
rsync -av --delete ~/proprietary_vendor_zte/blade/ ~/cm9/vendor/zte/blade/ --exclude='.git*'

3. Compile the rom – the first time you do this it will download the kernel source (you can add CM_EXTRAVERSION=-whatever on the end of the export line):

cd ~/cm9/vendor/cm/
cd ~/cm9/
. build/
lunch cm_blade-userdebug
make bacon -j8

Edify Scripting And Git Patches

I’ve been working on Edify scripting to create a flashable zip that allows me to patch a regular CM7 nightly build with a reverted and updated

There’s literally no documentation anywhere! There’s some very old posts about Amend scripts (update-script) on XDA but nothing about the newer Edify scripts (updater-script and update-binary) that CM7 uses.

My script is based on the script from gapps:

ui_print("Mounting /system");
run_program("/sbin/busybox", "mount", "/system");

ui_print("Extracting libraries");
show_progress(0.100000, 0);
package_extract_file("", "/system/lib/");
package_extract_file("", "/system/lib/");
show_progress(0.100000, 10);

ui_print("Setting permissions");
show_progress(0.200000, 0);
set_perm(0, 0, 0644, "/system/lib/");
set_perm(0, 0, 0644, "/system/lib/");
show_progress(0.200000, 10);

run_program("/sbin/busybox", "umount", "/system");
ui_print("Installation complete!");

There’s not a huge amount of documentation about the folder structure of a zip or apk, but essentially its this:

You have to take update-binary from another zip file, such as a the CM7 zip itself.

There’s also very little documentation about signing zips. I found that the command to do that is:

java -jar signapk.jar testkey.x509.pem testkey.pk8

signapk.jar can be found in the out/host/linux-x86/framework/ directory of a compiled build and the AOSP signing keys can be found in the build/target/product/security/ directory of the Android source tree.

To make a patch to revert libaudio I had to diff against the version before HEAD for that whole directory – we have to do it this way as the previous commit is different for AudioHardware to AudioPolicyManager – this is “get the previous commit, whatever that may be”, not “get this specific commit for this specific file”:

cd device/zte/blade/libaudio/
git diff HEAD^ > ~/libaudio.patch

Then I can apply the patch to HEAD (optionally check for errors first):

git apply --check ~/libaudio.patch

No we have a patch to revert to a previous version, kind of the opposite of what patches are usually for!

I’ve created a new directory on my server for all the CM7 stuff like patches and KANG builds here, which includes this signed zip patch.

Self-built CM7

I got fed up of waiting for the Cyanogenmod team to merge in the broken slidey keyboard revert so decided to take the plunge and install my own build on my Orange San Francisco smartphone. I did a “repo sync” and checked out the revert from Git then compiled what was essentially a nightly build of CM 7.1.0 RC0 between N71 and N72.

I installed it on my phone and put it up on my server for download, and posted to the MoDaCo forum, and now about 18 hours later I’ve had 222 downloads using a whopping 21Gb of bandwidth – I’m so glad that only works out as about 2% of my monthly allowance and we’re halfway through the month!

I’ve been running it on my phone for those 18 hours and haven’t seen any issues – the and new sensor libs were merged in before N71 and the screen orientation revert I merged in meant that the screen wasn’t stuck in landscape mode.

The only problem I can still see is that the dialler is using sensors all the time and stops the phone going into standby properly, so eats the battery after you’ve made/received a phonecall – intermittently. If they can fix that, then I reckon CM7.1 is ready to go RC1.

Cyanogenmod 7.1.0 nightly 59

Cyanogenmod 7.1.0 nightly 59 with Android 2.3.4 (GRJ22) is available for download. I installed it on my ZTE Blade and it doesn’t seem any better or worse than CM7.0.2 N57, of course this isn’t even 7.1 RC1 yet, its RC0.

I think the main focus of 2.3.4 was on video performance which probably won’t have much of an effect on the lowly Blade which can’t even run Flash.

I’ve also been playing with which is a Calibre plugin to strip the DRM crap from Amazon ebooks so that your ebooks are not tied solely to your Kindle3G, and can be opened on Linux or a non-Kindle ereader application on your Android/Mac for instance.

Plain old 0.29 no longer seems to work since the 2.5 firmware, but the K4 tools add some functionality to it and now you don’t even need a PID, just your Kindle serial number.

Update 1: Nightly 60 is out, I installed it and it seems ok now (after several reboots for some reason). Apparently 7.0.3 stable is coming soon, then development can concentrate on 7.1.0 RC1.

Update 2: Nightly 62 is out as is stable 7.0.3, here’s hoping for kernel 2.6.35 in N63…..

Update 3: Just installed Nightly 63 and its still 2.6.32 albeit with some fixes in it for battery life, I/O performance and touchscreen. There does seem to be a slight hissing after using the loudspeaker, confirmed on the issue tracker.

I also installed new which provides slightly updated Google Apps like Talk with video chat for 2.3.4

Update 4: Nightly 64 is out with some new music player features. Apparently the hissing from the loudspeaker was introduced when a new /system/lib/ was merged in to fix some VOIP issues, sometime after moving to Gen2-only. I tried the patch on N64 but it seems to mute the speaker altogether rather than just stop the hissing!

Cyanogenmod 7.0.2 nightly 57

Well I finally bit the bullet and installed CM7 on my ZTE Blade (Orange San Francisco) as well as upgrading from the Gen1 radio to Gen2.

The install all went quite well using the TPT image-and-upgrade method.

Disappointingly my downloaded apps didn’t all reinstall automatically, so spent a while on the Market re-sending them to the phone. Also the paid-for LauncherPro+ didn’t automatically unlock itself, however ROMManager did.

I forgot to backup my SMS’s, but I found that you can unzip your nandroid backup’s data.img using unyaffs and use sqliteman or sqlite3 to open the SMS or contacts databases:


ClockworkMod Recovery now works (doing a nandroid as I write this).

iGo 8.4.2 works fine. I don’t seem to have the charger reboot or GPS issues, although Google Maps caused the phone to reboot the first time.

Update: OK so the phone rebooted once when I yanked the USB cable – but I was overclocked to 710MHz from 604MHz stock at the time!

I’ve extracted the proprietary files from the phone into my cyanogenmod repo and have now compiled my own CM7 for the Blade. Nfc doesn’t seem to cause a problem for a Blade build like it does for the emulator.

Also it seems the platform version is 2.3.4 and the resulting zip is called, so major upgrades are afoot it seems….