[Android Software/Hacking General [Developers Only]] tolgainci:
Dear All,

I have been building some custom Android ROMS for the past few years, and my latest toy is a Flytouch 3 :) I wanted to share some of my findings and methods here, perhaps other newbies like me will find it useful.

1. FT3 ROM contents:

FT3 ROMs will be in RAR or ZIP format and have 2 or 3 files in them as explained below. Just unzip or unrar the package to use them:

firmware2 - flash tool which burns the firmware ( I guess...lol)

bootloader-discovery - 7zip file which contains the bootloader

IMPORTANT! Do not flash a wrong bootloader to your device or it will be bricked! Actually this is the only way you can brick the thing, it's pretty sturdy in that sense. If you are not sure, do not copy bootloader-recovery to your sdcard when flashing, it will boot with your existing bootloader anyway.

firmware-discovery - 7zip file which contains the firmware and it's the main file you want to edit.

2. firmware-discovery contents:

This is the easy part! Modifying this file will let you modify system and data partitions. You can also use different ramdisks and kernels compatible with your device. It's a 7zip file and you can unpack and repack easily with the 7-zip file manager (http://www.7-zip.org/).

I use 7-zip on Windows although I use Ubuntu Linux as my main OS. There is something wrong with my 7-zip installation most probably, but I was too lazy to check it :) If you are on Windows anyway, you are good, just download and use 7-zip from the URL above. I advise that you do all your firmware-discovery editing within 7-zip file manager. That way, you won't have to worry about re-packing with the correct 7-zip settings. At least, that's how I do it and had no problems.

firmware-discovery will have these files in the 7zip package:

uImage - kernel

Very important :) Your kernel will make the difference between having and not having certain functionality, even if your hardware supports it.

uImage_recovery - recovery file - I beleive this is what runs when you push menu+power.

ramdisk.img - ramdisk

This is one of the interesting files you might want to play with. Ramdisk is a simple file system with some crucial files, mainly init.rc that lets you control the boot process. You can also stick a initlogo.rle image here to display a splash image in initial boot. More details below at title 4.

data.tar - /data partition - tar archive

All user data is stored here, including apps and user definable settings. This is what gets wiped when you do a recovery by pushing menu+power.

system.tar - /system partition - tar archive

System data, drivers and apps, including Android OS itself (except kernel). Certainly the most interesting part for the average modder :)

3. Editing system.tar and data.tar:

This might be the bulk of your modding, and most probably what will be most visible to the end user.

I very strongly suggest that you use a Linux system to edit these files. If you use Windows,

file permissions will not be saved!

If Windows is your main OS, simply install a VM host such as VirtualBox and install your fav Linux distro inside it. Most of them will have an Archive Manager with a GUI and will certainly support TAR. Even without a GUI, you can use "tar" and "untar" commands from a terminal to unpack and repack these files. When you are on Linux, TAR files will preserve file ownership and file permissions. This can be very crucial in your modding.

For modders who are new to Linux, I can recommend Ubuntu. It's very user friendly and easy to use in my opinion.

When you are done editing system.tar and data.tar copy them to your Windows box and drop and them to firmware-recovery file within 7-zip file manager.

4. Unpack, Edit and Repack ramdisk.img:

Now we are on to more serious stuff :) ramdisk.img consists of a 64 byte U-Boot header, followed by a gzip compressed ramdisk cpio image. So we need to strip the first 64 bytes, and use gunzip to extract it to a folder. After making the changes in the folder, we need apply cpio+gzip compression to the folder and add the 64 byte u-boot header again. You will need to use Linux and install the mkimage tool for these operations.

Here's the command to install mkimage tool in Ubuntu:

sudo apt-get install uboot-mkimage

It sounds complicated, but no worries, I have some shell scripts that can do all that for you! Thanks to leeh33 from Techknow for the scripts below:

unpack_ramdisk.sh

mkdir ramdisk
cd ramdisk
dd if=../ramdisk.img bs=64 skip=1 of=ramdisk.gz
gzip -dc ramdisk.gz | cpio -idmv
rm ramdisk.gz

repack_ramdisk.sh

cd ramdisk
find . | cpio -o -H newc -C 512 | gzip -n > ../ramdisk.cpio.gz
cd ..
mkimage -A ARM -O Linux -T ramdisk -C none -a 0x41000000 -e 0x41000000 -n hRamdisk -d ramdisk.cpio.gz ramdisk.img
rm ramdisk.cpio.gz

Create the scripts above using a text editor or download the attachment to this post and put the scripts together with your ramdisk.img file in a new folder. Executing unpack_ramdisk.sh will create a folder named ramdisk and extract the ramdisk contents here. You can edit e.g. init.rc in this folder, or add a static bootlogo. To add a custom bootlogo create a initlogo.rle image file by following this guide: http://www.androidtablets.net/forum/android-tablet-hacking/438-how-setup-static-bootlogo-before-animated-boot-animation.html Then place the resulting initlogo.rle file directly in the ramdisk directory.

After you are done editing the ramdisk folder, simply run repack_ramdisk.sh and your new ramdisk.img will be created, replacing the old one. Copy the ramdisk.img file to your Windows box again and drop it to firmware-recovery file within 7-zip file manager.

That's it, you have a custom ROM now! Please feel free to ask questions or correct me if you think I have any errors in the info above.

Happy Modding!!!

Tolga