Monday, December 12, 2011

Galaxy S I9000 unavailable internal sd / flash

Helping a friend with his Galaxy S I9000 which wouldn't boot has taught me the following things about the device:

1. Stock firmware - there is a difference between Froyo (2.2) and Gingerbread (2.3) stock firmware - they format the internal flash differently.
2. Heimdall is Opensource replacement for ODIN which can install a kernel when phone in download mode:

heimdall flash --kernel zImage

3. The nand partitions layout in Samsung Galaxy S I9000 is controlled by a pit file (Partition Information Table), while for the mmc drive, it is hard coded in the init file.

For example, in Samsung Galaxy S I9000, the stock partition tables for s1_odin_20100512.pit should look like this:

NAND disk */dev/block/stl1 - stl6 omitted
device name mount point size in MB remarks
/dev/block/stl7 n/a 7.5 known as KERNEL, for holding zImage
/dev/block/stl8 n/a 7.5 known as RECOVERY, for storing a copy of zImage
/dev/block/stl9 /system 286.5 known as FACTORYFS
/dev/block/stl10 /dbdata 134 known as DBDATA
/dev/block/stl11 /cache 35 known as CACHE
/dev/block/stl12 n/a 7.5 known as MODEM, for storing modem.bin
MMC disk
device name mount point size in MB remarks
/dev/block/mmcblk0p1 /mnt/sdcard (/sdcard) ~6200 (8G) / ~14200 (16G) none
/dev/block/mmcblk0p2 /data ~2000 none


For other pit files like s1_odin_20100513 and s1_odin_20100803, the size of /system and /dbdata are different. So for a larger /system partition, a smaller /dbdata and/or /cache will be resulted and vice versa since the total size of the nand is fixed (~500MB)

When we flash a rom to our phone, the above information will be read by odin to decide where the files will be stored. For instance, the zImage will be written to /dev/block/stl7 (/dev/block/bml7) and /dev/block/stl8 (/dev/block/bml8), while the FACTORYFS.rfs will be stored on /dev/block/stl9 (or /dev/block/bml9) at a specific start block address, up to the size of the file and so forth.

As a result, if we wanna use our own customized partition layout, we have to deal with the pit file and the mmc via fdisk or parted, etc


BOOT (bml01) = 01 = 1 = 0.25 MB (bootloader)
PIT (bml02) = 01 = 1 = 0,25 MB (the partition table)
EFS (bml03) = 28 = 40 = 10 MB (imei data and such)
SBL (bml04) = 05 = 5 = 1,25 MB (secondary bootloader)
SBL2 (bml05) = 05 = 5 = 1,25 MB (secondary bootloader backup)
PARAM (bml06) = 14 = 20 = 5 MB (the images shown when something is wrong)
KERNEL (bml07) = 1E = 30 = 7,5 MB (kernel image)
RECOVERY (bml08) = 1E = 30 = 7,5 MB (kernel image backup)
FACTORYFS (bml09) = 47A = 1146 = 286,5 MB (/system)
DBDATA (bml10) = 218 = 536 = 134 MB (/dbdata)
CACHE (bml11) = 8C = 140 = 35 MB (/cache)
MODEM (bml12) = 32 = 50 = 12,5 MB (software for wireless)

4. Parted download http://www.sendspace.com/file/w6hi6x

Note also that I had run unrevoked forever (so my phone was S-OFF) ... I'm not sure if that's required or not.

So, grab parted from the link above. Now you need to extract the individual binaries from the .zip (the 6 files in the sdparted folder within the zip), ideally to your android-sdk\tools directory. Now push all 6 files (adb push [file] /sbin/). Next, we need to make them useable, so go into the shell (adb shell). Change to your /sbin/ directory, and run: chmod 0755 on each of the 6 files.

Now, we need to fix the partitions. This is assuming that the partitions are there, just the wrong format (which is what happened to me .. I accidentally made them FAT32 instead of ext). So, run the following: parted /dev/block/mmcblk0 mkfs ext2. It will ask if you want to continue, hit yes. When it asks for the partition number, enter 1. Next, when it asks for the format, enter ext2. Let it do its thing. Now, once it's done, run parted again. This time, enter partition 2 (everything else is the same).

Once all that's done, your recovery program should be able to mount both the /data and /cache partitions. If that's true, you're pretty much done! One thing I found was that I couldn't directly install a new OS (I tried both Cyanogen and Ultimate). In both cases, it would look for stuff in the davik-cache that it couldn't find, so something wasn't installing correctly I think. So, if that happens, flash back to the stock PB31IMG.zip (put it in the root of your /sdcard/ and let hboot install it), and then root your phone anew. That's what I ended up doing.

Again, huge credit for this goes to -Steveo- and ciwrl for helping me figure out which partitions were the right ones (and for supplying parted, which I hadn't been able to find anywhere). If something doesn't end up working, just drop me a pm and we'll see what we can do.

5. Parted show partitions "print"
6. The phone should have 2 flash partitions as described. If they are not available - there is a problem with the flash module
7. More about PIT files: http://forum.xda-developers.com/showthread.php?t=816449 and
http://forum.xda-developers.com/showthread.php?t=999097

Saturday, July 30, 2011

HD2 Preferred network type

*#*#4636#*#*

Scroll Down and set your Preferred Network Type to GSM auto (PRL) - NOTE this does not disable 3G or HSDPA! Speed tests still show I am receiving speeds up to 2.4mbps - NOTE there will still be the 3G and H icons in your status bar
This will remove lots of logs if you are on GSM network and improve reception and reduce CPU use on idle.
Phone will not try to connect to WCDMA

Tuesday, February 22, 2011