ClockworkMod Recovery is a replacement recovery system for Android devices developed as part of famous CyanogenMod project. Because under the hood FirefoxOS reuses most low-level components from Android, we can use this recovery to easily backup and restore for example Alcatel One Touch Fire devices (but the steps shown here should be similar for other devices). This guide shows how to port and build ClockworkMod to AOTF devices by yourself.

Get boot.img

First of all, you have to dump boot.img image form your device as described in my previous post. Lets assume that you dumped this image to ~/boot.img file.

Download CyanogenMod

As already mentioned, ClockworkMod is part of CyanogenMod project. We have to download CyanogenMod sources in order to create recovery image. CM10 didn’t work for me so you have to download older version - CM9.1. You will need repo tool for this:

mkdir -p ~/BUILD/cyanogen9.1
cd ~/BUILD/cyanogen9.1
~/bin/repo init -u git:// -b cm-9.1.0
~/bin/repo sync

This will take a lot of time to finish. Go for a walk or something.

Prepare for build

Now lets prepare our build environment:

cd ~/BUILD/cyanogen9.1
source build/ 
make -j4 otatools

This will build some essential tools and should take no more than couple of minutes to finish. When it’s done, we can create device tree for our phone:

export PATH=$PATH:$PWD/out/host/linux-x86/bin/
./build/tools/device/ alcatel hamachi ~/boot.img

This will create and populate device/alcatel/hamachi/ directory. Now we have to change inside of this directory to the values used by our device:


Those values can be obtained from the device itself, by running (we are interested in 2nd column):

$ adb shell cat /proc/mtd | grep -e 'boot\|system\|recovery\|user'
mtd0: 00600000 00020000 "boot"
mtd1: 0c800000 00020000 "system"
mtd5: 0a100000 00020000 "userdata"
mtd7: 00a00000 00020000 "recovery"

You should also uncomment following line:


Otherwise you won’t be able to use POWER button to select menu item.

Build recovery image

Now we are ready to build the image:

source build/
lunch full_hamachi-eng
make -j4 recoveryimage

If everything goes fine, after couple minutes your should get following messages:

Made recovery image: out/target/product/hamachi/recovery.img
out/target/product/hamachi/recovery.img total size is 6082560

You are ready to run your new recovery image!.

Boot it

In order to run recovery.img you have to boot your device in fastboot mode. You can do this using ADB (if your phone is already runnig) using adb reboot-bootloader command or manualy by pressing volume-down button while powering up your phone. You should see familiar Alcatel logo and phone should stay at this screen forever.

You can ensure that device entered fastboot mode by running:

$ fastboot devices
MSM7627A        fastboot

Now you can boot your image with:

$ fastboot boot ~/BUILD/cyanogen9.1/out/target/product/hamachi/recovery.img
downloading 'boot.img'...
OKAY [  0.493s]
OKAY [  0.167s]
finished. total time: 0.661s

If everything goes well, you should see well-known CWM recovery screen. Go and backup your phone!

After backing up your original firmware (including original recovery), you can reboot your phone to fastboot mode and install your custom recovery image:

$ fastboot flash recovery ~/BUILD/cyanogen9.1/out/target/product/hamachi/recovery.img
sending 'recovery' (5940 KB)...
OKAY [  0.497s]
writing 'recovery'...
OKAY [  0.974s]
finished. total time: 1.471s

From now on, you can run CWM recovery by holding volume-up button when powering up your device.