Sunday, November 3, 2013

How I obtained Stock ROMs

The first and most important step to obtaining the stock system ROM is to figure out your partitioning scheme so that you know what you need to and should not backup. To figure this out, you will need to view your Partition Information Table (PIT) - a GPT based descriptor for your NAND flash's logical layout. For the most authoritative source of information that I have found regarding the partitioning on Android phones, check out El Grande Partition thread over at xda-developers.com To get a good sense of your partitioning, you will need both the block device names (used by the mount command) and the actual partition names. This translates roughly into: You need the output of /proc/partitions and parted. Once you have root, getting /proc/partitions is easy. Simply type "cat /proc/partitions":

app_128@android:/ $ su
root@android:/ # cat /proc/partitions

This results in the following output:

major    minor    #blocks        name
17907634944mmcblk0
179161440mmcblk0p1
1792128mmcblk0p2
1793256mmcblk0p3
1794512mmcblk0p4
17952048mmcblk0p5
1796512mmcblk0p6
179710240mmcblk0p7
1798512mmcblk0p8
1799512mmcblk0p9
1791010240mmcblk0p10
1791113952mmcblk0p11
179123072mmcblk0p12
179133072mmcblk0p13
179141536000mmcblk0p14
179155079040mmcblk0p15
179168192mmcblk0p16
17917860160mmcblk0p17
1791810240mmcblk0p18
1791910240mmcblk0p19
179206144mmcblk0p20
179213072mmcblk0p21
179228mmcblk0p22
179235120mmcblk0p23
179642048mmcblk0boot1
179322048mmcblk0boot0

To get the output from parted requires a little more skill as parted is not present on most phones by default and it is not included with busybox. Thanks to the guys over at droidforum however, you can download this from here. Once you have unzipped this file and uploaded it to your device, either by placing it into disk mode, using adb push or by taking out the mini-SD card and putting it into your computer, you can then use parted to dump the partition table:
app_128@android:/ $ su
root@android:/ #cp /mnt/extSdCard/parted
Number    Start            End            SizeFile system    NameFlags
14194kB67.1MB62.9MBmodem
267.1MB67.2MB131kBsbl1
367.2MB67.5MB262kBsbl2
467.5MB68.0MB524kBsbl3
568.0MB70.1MB2097kBaboot
670.1MB70.6MB524kBrpm
770.6MB81.1MB10.5MBboot
881.1MB81.7MB524kBtz
981.7MB82.2MB524kBpad
1082.2MB92.7MB10.5MBparam
1192.7MB107MB14.3MBext4efs
12107MB110MB3146kBmodemst1
13110MB113MB3146kBmodemst2
14113MB1686MB1573MBext4system
151686MB6887MB5201MBext4userdata
166887MB6895MB8389kBext4persist
176895MB7776MB881MBext4cache
187776MB7787MB10.5MBrecovery
197787MB7797MB10.5MBfota
207797MB7804MB6291kBbackup
217804MB7807MB3146kBfsg
227807MB7807MB8192Bssd
237807MB7812MB5243kBgrow

dd if=/dev/block/mmcblk0p1 of=/sdcard/modem.bin
dd if=/dev/block/mmcblk0p2 of=/sdcard/sbl1.mbn
dd if=/dev/block/mmcblk0p3 of=/sdcard/sbl2.mbn
dd if=/dev/block/mmcblk0p4 of=/sdcard/sbl3.mbn
dd if=/dev/block/mmcblk0p5 of=/sdcard/aboot.mbn
dd if=/dev/block/mmcblk0p6 of=/sdcard/rpm.mbn
dd if=/dev/block/mmcblk0p7 of=/sdcard/boot.img
dd if=/dev/block/mmcblk0p8 of=/sdcard/tz.mbn
dd if=/dev/block/mmcblk0p9 of=/sdcard/pad.mbn
dd if=/dev/block/mmcblk0p10 of=/sdcard/param.mbn
dd if=/dev/block/mmcblk0p12 of=/sdcard/modemst1.bin
dd if=/dev/block/mmcblk0p13 of=/sdcard/modemst2.bin
dd if=/dev/block/mmcblk0p16 of=/sdcard/persist.ext4
dd if=/dev/block/mmcblk0p18 of=/sdcard/recovery.img
dd if=/dev/block/mmcblk0p21 of=/sdcard/fsg.mbn
dd if=/dev/block/mmcblk0p23 of=/sdcard/grow.mbn

No comments:

Post a Comment