[Samsung Galaxy Grand Quattro] Arinio:
How To Unpack Recovery Image

For now let us shift our attention fro the /proc folder and focus over the recovery image file. Later on we will again review our previous discussion in more detailed manner.

Let us jump into this current topic.

Now the first question is where to find the recovery image?

In old days it was possible to locate that file by simply typing the command:

$ adb devices

$ adb shell

$ su -

and then in the root typing # cat /proc/mtd (for Samsung) or # cat /proc/emmc (for HTC)

Alas! Now there is no such files.

So, let us apply the hard way to find that image file.

Start...............

In google simply type sammobile or directly type in the address bar www.sammobile.com

Register yourself first and foremost.

Now click the Firmware link or you can directly click the Firmwares link after typing sammobile in google search box. It's up to you.

Here you will find a box 'search your device here'

There simply type I8552

The search result will consist of seven columns.

Importantis column no. two where you will find your country, column three where you will find the Firmware release month (go for the latest month), column six where the name of the version you will get and finally the last column where the download link is there.

Now click the latest download link (for India it is I8552XXAMJ7) and in the latest windows you will get a Captcha challenge. Unfortunately though filling the right letters/numbers the Captcha will fail and fortunately you will get another link for download. [There are two links for India, one will show INU file and another INS file. In your Galaxy Grand Quattro box you will find whether your device is based on INU or INS].

The download links are always Hotfile links and they are resumable. Better to use Internet Download Manager (IDM) to download this file.

The files are nearly 750 MB sizes and they are compressed in rar format.

With the help of WInRAR unRAR it and you will get a tar.md5 formatted file and the latest Firmwares size will become 1.3 GB.

We call them as tarball (actually a .tar file is a tarball file and here in this case this is a tarball file with md5 checksum) files and inside this Firmware the recovery image file is hidden.

For Indian user the file will look like I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar.md5

If you are not very much accustomed with VMWare how to create a link between your Original OS (we call it host) and virtually running Ubuntu (we call it guest) simply go to your Windows OS, copy the file in a USB drive and then again plug it while in Ubuntu and paste it in your home folder.

Now the main part...............

Right click this file and delete the .md5 words (mind the dot)

In Ubuntu open a terminal window and fire up these commands:

arinio@ubuntu:~$ mkdir quattro

arinio@ubuntu:~$ mv I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar /home/arinio/quattro/

arinio@ubuntu:~$ cd quattro/

arinio@ubuntu:~/quattro$ tar xvf I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar

boot.img

recovery.img

system.img.ext4

fat.bin

cache.img.ext4

hidden.img.ext4

So finally inside the quattro folder we got six files and one of them is recovery.img. Note that another important file is boot.img

Now you can delete the I8552XXAMJ7_I8552ODDAMI4_I8552DDAMI1_HOME.tar file. This will be no more needed. Infact you can delete all other files except recovery.img and boot.img

So if now you issue this command you will observe

arinio@ubuntu:~$ ls /home/arinio/quattro/

boot.img recovery.img

Let us target recovery.img

First visit this page http://xdaforums.com/showthread.php?t=1877807 and download unmkbootimg.gz file.

Inside your /home partition you will find one folder named Download. After the download is complete (1-5 second) you will find the unmkbootimg.gz file there only.

Now issue this commands:

arinio@ubuntu:~$ cd /home/arinio/Downloads/

arinio@ubuntu:~/Downloads$ ls

ADB.txt dump1.txt Python-2.7.5

ADB.txt~ dump2.txt REPO PART.txt

Android Developer Tools Essentials.pdf dump.txt REPO PART.txt~

CWM BUILD PATH.txt~ make-4.0 unmkbootimg.gz

arinio@ubuntu:~/Downloads$ gunzip unmkbootimg.gz

arinio@ubuntu:~/Downloads$ ls

ADB.txt dump1.txt Python-2.7.5

ADB.txt~ dump2.txt REPO PART.txt

Android Developer Tools Essentials.pdf dump.txt REPO PART.txt~

CWM BUILD PATH.txt~ make-4.0 unmkbootimg

So unmkbootimg.gz becomes unmkbootimg

Now cut the unmkbootimg file from Downloads folder and paste it inside quattro folder.

So now the quattro folder will look like:

arinio@ubuntu:~/Downloads$ ls /home/arinio/quattro/

boot.img recovery.img unmkbootimg

Now right click the unmkbootimg and click 'Properties'.

In the new window click the tab 'Pemissions' and check-mark 'Allow executing file as program'.

Close the 'Permissions' window.

Now while inside the quattro folder issue this command:

arinio@ubuntu:~/quattro$ ./unmkbootimg recovery.img > recoveryoutput.txt

Now issue

arinio@ubuntu:~/quattro$ ls

boot.img recovery.img unmkbootimg

initramfs.cpio.gz recoveryoutput.txt zImage

Here The kernel is zImage and the ramdisk is initramfs.cpio.gz.

So, ultimately we have successfully unpacked the recovery image and recovery.img consists two files namely zImage and initramfs.cpio.gz

If we issue this command:

arinio@ubuntu:~/quattro$ cat recoveryoutput.txt

The output will show:

unmkbootimg version 1.2 - Mikael Q Kuisma <kuisma@ping.se>

Kernel size 4694160

Kernel address 0x208000

Ramdisk size 1082913

Ramdisk address 0x1500000

Secondary size 0

Secondary address 0x1100000

Kernel tags address 0x200100

Flash page size 4096

Board name is ""

Command line "androidboot.hardware=qcom loglevel=1 vmalloc=200M"

*** WARNING ****

This image is built using NON-standard mkbootimg!

OFF_RAMDISK_ADDR is 0x01300000

Please modify mkbootimg.c using the above values to build your image.

****************

Extracting kernel to file zImage ...

Extracting root filesystem to file initramfs.cpio.gz ...

All done.

---------------

To recompile this image, use:

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x200000 --cmdline 'androidboot.hardware=qcom loglevel=1 vmalloc=200M' --pagesize 4096 -o new_boot.img

---------------

Done!