As I’ve been compiling Cyanogenmod for the ZTE Blade, I thought I’d have a look at compiling the kernel instead of applying binary patches. I found this tutorial which kind of helped, here’s my simplified summary:

  1. Pull kernel source from Github (currently weighs in at 1.7Gb):
git clone git://
  1. Get the .config file – most tutorials say to get this from your phone which is running the kernel that you want to compile, but actually its already stored in git:
cp ~/kernel_zte_blade/arch/arm/configs/cyanogen_blade_defconfig ~/kernel_zte_blade/.config
  1. Build the kernel:
make ARCH=arm CROSS_COMPILE=~/cyanogenmod/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
  1. Build CM7 as usual, and to make things easier we’re going to copy a few files all into the same directory, including the we downloaded:
mkdir ~/custom_kernel
cd ~/custom_kernel/

cp ~/ .
cp ~/kernel_zte_blade/arch/arm/boot/zImage .
cp ~/cyanogenmod/out/host/linux-x86/bin/mkbootimg .
cp ~/cyanogenmod/out/target/product/blade/ .
cp ~/cyanogenmod/out/host/linux-x86/framework/signapk.jar .
cp ~/cyanogenmod/build/target/product/security/testkey.* .

  1. Unzipping the KANG has given us the META-INF and system directories and boot.img file, which we must now unpack:
./ boot.img

6a. Optionally copy across the .ko files mentioned in modules.order to system/lib/modules/ the highlighted ones are probably not neccessary:

grep -v test modules.order | sed 's|^kernel/||g'

  1. Recreate the boot.img with the new kernel:
./mkbootimg --cmdline 'androidboot.hardware=blade console=ttyMSM2,115200 g_android.product_id=0x1354 g_android.serial_number=Blade-CM7' --base 0x2600000 --kernel zImage --ramdisk boot.img-ramdisk.gz -o boot.img
  1. Zip up the new boot.img and old META-INF and system directories:
zip -r META-INF boot.img system
  1. Sign the zip:
java -jar signapk.jar testkey.x509.pem testkey.pk8
  1. Generate an md5sum of the signed zip so users can check it downloaded properly:
md5sum >

And here’s the screenshot of the running ROM with my kernel: