[Galaxy S II Q&A, Help & Troubleshooting] jimstaffer:
GT-I9100 appears to have a separate recovery partition

By SG2, I assume you meant GS2. I have an GT-I9100.

I've read several times in various places that GS2s do

not

have a separate recovery partition. Though I'm quite new to android in general, it seems that my GS2

does

.

Here is a bit of my PIT (heimdall print-pit --verbose) output:

...

--- Entry #6 ---

Binary Type: 0 (AP)

Device Type: 2 (MMC)

Identifier: 6

Attributes: 0 (Read-Only)

Update Attributes: 0

Partition Block Size/Offset: 73728

Partition Block Count: 16384

File Offset (Obsolete): 0

File Size (Obsolete): 0

Partition Name: KERNEL

Flash Filename: zImage

FOTA Filename:

--- Entry #7 ---

Binary Type: 0 (AP)

Device Type: 2 (MMC)

Identifier: 7

Attributes: 0 (Read-Only)

Update Attributes: 0

Partition Block Size/Offset: 90112

Partition Block Count: 16384

File Offset (Obsolete): 0

File Size (Obsolete): 0

Partition Name: RECOVERY

Flash Filename:

FOTA Filename:

...

Here are the details of all the partitions listed in the verbose PIT output (sorry about the formatting):

Partition offset blocks hi-end size (MiB)

GANG 0 0 0.00

BOOT 0 8192 8192 4.00

EFS 8192 40960 49152 20.00

SBL1 49152 2560 51712 1.25

SBL2 53248 2560 55808 1.25

PARAM 57344 16384 73728 8.00

KERNEL 73728 16384 90112 8.00

RECOVERY 90112 16384 106496 8.00

CACHE 106496 204800 311296 100.00

MODEM 311296 32768 344064 16.00

FACTORYFS 344064 1048576 1392640 512.00

DATAFS 1392640 4194304 5586944 2.00

UMS 5586944 24133632 29720576 11.00

HIDDEN 29720576 1048576 30769152 512.00

blank 0 0 0 0.00

15022.50 Total

As you can see, there are no overlaps. In fact, the SBL1 and SBL2 have unused space after them - if they were 4096 blocks (2 MiB) instead of 2560 (1.25 MiB), then all the space would be allocated in contiguous, non-overlapping chunks.

Q1: is my reading correct, that is, my GS2 does have a separate recovery partition? (As there are several GS2 models, my question relates to the I9100.)

Second point. It seems that when I flash a CWM recovery, it really is being written to (what I believe to be) the recovery partition.

On my Linux desktop:

$ ls -l zImage

-rwxr-xr-x. 1 me me 6190876 Mar 16 2013 zImage*

$ sha1sum zImage

ee4464781de5396b769eab9325ae43a84e942ef9 zImage

$ adb shell

Now On my GS2:

shell@GT-I9100:/ $ su

Note: I used a block size of 4 because 4 x 1547719 = 6190876.

root@GT-I9100:/ # dd if=/dev/block/mmcblk0p6 bs=4 count=1547719 | sha1sum

ee4464781de5396b769eab9325ae43a84e942ef9 -

1547719+0 records in

1547719+0 records out

6190876 bytes transferred in 26.631 secs (232468 bytes/sec)

As you can see, the sums agree. So, assuming /dev/block/mmcblk0p6 is pointing to the (presumed to exist) recovery partition, the zImage contents is definitely there.

So, it seems to me that RECOVERY

is

a separate chunk of the storage partition, and that I have successfully written an image to that partition. Booting CM 12.1 does

not

overwrite this. CM appears to ignore it.

Q2: If that is correct, why does booting into recovery still boot the "Cyanogen Recovery" - and, is there any way to get it to boot off the zImage?

Q3: Can anyone please post some useful links into how this all works? I've spent quite a while looking, but I have yet to find anywhere that clearly (and accurately!) documents how this all works.

Tx