Porting CWM to New Device

If you are not familiar and don’t know what is recovery, read my topic dedicated for recovery images.

First you need to have the source of recovery which is already included in cyanogenmod source code. If you don’t know how to initializing build environment check my tutorial.

So first sync the source, then begin the actual process for compiling recovery.
Here i am using the Cyanogenmod 10.1 source to build CWM 6. You can use any of your need.

Step 1 : Grab the stock boot.img and recovery.img from your running device, using adb.

adb shell
dump_image boot /sdcard/boot.img
dump_image recovery /sdcard/recovery.img

Now pull/copy these images from sd card to your local directory.

Step 2 : Prepare the device config skeleton, this is a long process to do for any device. Or for only recovery we can use cyanogenmod mkvendor.sh which prepare your device config with ease.

build/tools/device/mkvendor.sh manufacturer codename /path-to-boot.img

Tip : manufacturer is the brand, and codename is device release name which you can found it on your build.prop.

Step 3 : Setup device tree to build recovery, you might need to edit your BoardConfig.mk. Once BoardConfig is ready you need to add recovery.fstab which you can get from your stock  extracted recovery.img you pulled from your phone.

Note : Each device have different paritions and fstab differs.

Step 4 : We have setup config, now we can start compiling. cd to source and command :

. build/envsetup.sh && lunch

Now choose your device no. now run the command :

make recoveryimage

This will make your fresh recovery.img, if you need only for testing purpose use :

make recoveryzip

The compilation depends on your computer hardware.
After compilation you will get your new  recovery.img and recovery.zip in /out/target/product/codename

Now you can test/flash the recovery using a flashable zip or from adb using flash_image.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s