How to create using your build aka system.img

In my previous post I have already said that I will explain how to create an from your own build so here it is.

Build unyaffs
To do anything at all you need to extract your system.img, but you can not do that with normal zip because it’s an special format. You need unyaffs to extract it, you can get the c en h file from here or download the zip containing those two files here. I made an small change in my unyaffs.c file so it does not create symbolic links, this way I don’t need to fix that later.
Now let’s compile it:

gcc -o unyaffs unyaffs.c

Extract system.img
To do this follow these command’s.

mkdir ~/update
cd ~/update
mkdir system
cd system
~/unyaffs  ~/myandroid/out/target/product/hero/system.img
cd ..

Prepare your files for zip
You need to create some folders:

mkdir -p META-INF/com/google/android

In the META-INF goes a so called update-script, this scripts says what to do when the is run. Download the update-scriptNoBoot.txt HERE and put it in META-INF\com\google\android. Do not remember to rename it to update-script!!! It’s not a txt file.

Create the
Zip the system folder and the META-INF folder to

cd ~/update
zip -r system META-INF

Sign your

java -jar ~/myandroid/out/host/linux-x86/framework/signapk.jar ~/myandroid/build/target/product/security/testkey.x509.pem ~/myandroid/build/target/product/security/testkey.pk8 ~/update/ ~/update/

All that’s left to do is rename your to, upload it to your sdcard, reboot your phone to nandroid, do a wipe and then select install

If you have done everything right you can reboot your phone and you will have a custom rom running. If not there is something wrong with your or your files in there. Most of the time if the is wrong your Phone will be stuck at the boot text. If you have issues with the update-script you will get those while installing.

DO NOT FORGET to make an backup with nandroid!!!