How to customize firmware

Factory update.img contains encrypted images, therefore it is needed to flash update.img to device and dump them (unencrypted).

Unpack/pack update.img

AFPTool.exe -unpack update.img update

You will get boot.img, kernel.img, system.img, etc. in update/Image folder.

AFPTool.exe -pack update update.img

Unpack/pack system.img

First install cramfsprogs & fusecram

sudo apt-get install cramfsprogs fusecram

unpack.sh script

#!/bin/sh
echo "unpacking..."
mkdir $1
sudo mount -t cramfs -o loop $1.img  $1
tar cvzf $1.tgz $1
sudo umount $1
tar xzvf $1.tgz
echo "done"

Usage:

./unpack.sh update

Pack system.img

mkcramfs system system.img

Boot & recovery image

You can use same steps to unpack boot and recovery images, but it is needed to add CRC at the end of both images.

Pack boot/recovery

mkfs.cramfs -n v1.01 boot boot.img

Add CRC

rkcrc file.img file-crc.img

Kernel.img

...TBD

This howto is based on work of xaueious.