[Hardware Hacking General] darkspr1te:
For the Posted SHV-E160L based MSM8660 device, there is a hexdump of the original parition0.bin

darkspr1te@darkspr1te:~/Desktop/Samsung/brixfix/partition_load_pt$ hexdump shv-e160l-partition0.bin
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
00001c0 0000 0092 0000 0001 0000 2000 0003 0080
00001d0 0000 004d 0000 2001 0003 03e8 0000 0000
00001e0 0000 0051 0000 23e9 0003 0bb8 0000 0000
00001f0 0000 0005 0000 2fa1 0003 705f 01d2 aa55
0000200 0000 0000 0000 0000 0000 0000 0000 0000
*
00003c0 0000 0047 0000 105f 0000 03e8 0000 0000
00003d0 0000 0005 0000 0001 0000 0001 0000 0000
00003e0 0000 0000 0000 0000 0000 0000 0000 0000
00003f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000400 0000 0000 0000 0000 0000 0000 0000 0000
*
00005c0 0000 0045 0000 305e 0000 1000 0000 0000
00005d0 0000 0005 0000 0002 0000 0001 0000 0000
00005e0 0000 0000 0000 0000 0000 0000 0000 0000
00005f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000600 0000 0000 0000 0000 0000 0000 0000 0000
*
00007c0 0000 004c 0000 505d 0000 1388 0000 0000
00007d0 0000 0005 0000 0003 0000 0001 0000 0000
00007e0 0000 0000 0000 0000 0000 0000 0000 0000
00007f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000800 0000 0000 0000 0000 0000 0000 0000 0000
*
00009c0 0000 0048 0000 705c 0000 5000 0000 0000
00009d0 0000 0005 0000 0004 0000 0001 0000 0000
00009e0 0000 0000 0000 0000 0000 0000 0000 0000
00009f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000a00 0000 0000 0000 0000 0000 0000 0000 0000
*
0000bc0 0000 0046 0000 d05b 0000 03e8 0000 0000
0000bd0 0000 0005 0000 0005 0000 0001 0000 0000
0000be0 0000 0000 0000 0000 0000 0000 0000 0000
0000bf0 0000 0000 0000 0000 0000 0000 0000 aa55
0000c00 0000 0000 0000 0000 0000 0000 0000 0000
*
0000dc0 0000 005d 0000 f05a 0000 03e8 0000 0000
0000dd0 0000 0005 0000 0006 0000 0001 0000 0000
0000de0 0000 0000 0000 0000 0000 0000 0000 0000
0000df0 0000 0000 0000 0000 0000 0000 0000 aa55
0000e00 0000 0000 0000 0000 0000 0000 0000 0000
*
0000fc0 0000 0091 0000 1059 0001 03e8 0000 0000
0000fd0 0000 0005 0000 0007 0000 0001 0000 0000
0000fe0 0000 0000 0000 0000 0000 0000 0000 0000
0000ff0 0000 0000 0000 0000 0000 0000 0000 aa55
0001000 0000 0000 0000 0000 0000 0000 0000 0000
*
00011c0 0000 0093 0000 3058 0001 5000 0000 0000
00011d0 0000 0005 0000 0008 0000 0001 0000 0000
00011e0 0000 0000 0000 0000 0000 0000 0000 0000
00011f0 0000 0000 0000 0000 0000 0000 0000 aa55
0001200 0000 0000 0000 0000 0000 0000 0000 0000
*
00013c0 0000 000c 0000 9057 0001 1000 0003 0000
00013d0 0000 0005 0000 0009 0000 0001 0000 0000
00013e0 0000 0000 0000 0000 0000 0000 0000 0000
00013f0 0000 0000 0000 0000 0000 0000 0000 aa55
0001400 0000 0000 0000 0000 0000 0000 0000 0000
*
00015c0 0000 004a 0000 b056 0004 1800 0000 0000
00015d0 0000 0005 0000 000a 0000 0001 0000 0000
00015e0 0000 0000 0000 0000 0000 0000 0000 0000
00015f0 0000 0000 0000 0000 0000 0000 0000 aa55
0001600 0000 0000 0000 0000 0000 0000 0000 0000
*
00017c0 0000 004b 0000 d055 0004 1800 0000 0000
00017d0 0000 0005 0000 000b 0000 0001 0000 0000
00017e0 0000 0000 0000 0000 0000 0000 0000 0000
00017f0 0000 0000 0000 0000 0000 0000 0000 aa55
0001800 0000 0000 0000 0000 0000 0000 0000 0000
*
00019c0 0000 0058 0000 f054 0004 1800 0000 0000
00019d0 0000 0005 0000 000c 0000 0001 0000 0000
00019e0 0000 0000 0000 0000 0000 0000 0000 0000
00019f0 0000 0000 0000 0000 0000 0000 0000 aa55
0001a00 0000 0000 0000 0000 0000 0000 0000 0000
*
0001bc0 0000 008f 0000 1053 0005 1000 0003 0000
0001bd0 0000 0005 0000 000d 0000 0001 0000 0000
0001be0 0000 0000 0000 0000 0000 0000 0000 0000
0001bf0 0000 0000 0000 0000 0000 0000 0000 aa55
0001c00 0000 0000 0000 0000 0000 0000 0000 0000
*
0001dc0 0000 0059 0000 3052 0008 1800 0000 0000
0001dd0 0000 0005 0000 000e 0000 0001 0000 0000
0001de0 0000 0000 0000 0000 0000 0000 0000 0000
0001df0 0000 0000 0000 0000 0000 0000 0000 aa55
0001e00 0000 0000 0000 0000 0000 0000 0000 0000
*
0001fc0 0000 005a 0000 5051 0008 1800 0000 0000
0001fd0 0000 0005 0000 000f 0000 0001 0000 0000
0001fe0 0000 0000 0000 0000 0000 0000 0000 0000
0001ff0 0000 0000 0000 0000 0000 0000 0000 aa55
0002000 0000 0000 0000 0000 0000 0000 0000 0000
*
00021c0 0000 005b 0000 7050 0008 1800 0000 0000
00021d0 0000 0005 0000 0010 0000 0001 0000 0000
00021e0 0000 0000 0000 0000 0000 0000 0000 0000
00021f0 0000 0000 0000 0000 0000 0000 0000 aa55
0002200 0000 0000 0000 0000 0000 0000 0000 0000
*
00023c0 0000 00ab 0000 904f 0008 5000 0000 0000
00023d0 0000 0005 0000 0011 0000 0001 0000 0000
00023e0 0000 0000 0000 0000 0000 0000 0000 0000
00023f0 0000 0000 0000 0000 0000 0000 0000 aa55
0002400 0000 0000 0000 0000 0000 0000 0000 0000
*
00025c0 0000 0060 0000 f04e 0008 5000 0000 0000
00025d0 0000 0005 0000 0012 0000 0001 0000 0000
00025e0 0000 0000 0000 0000 0000 0000 0000 0000
00025f0 0000 0000 0000 0000 0000 0000 0000 aa55
0002600 0000 0000 0000 0000 0000 0000 0000 0000
*
00027c0 0000 0094 0000 504d 0009 5000 0000 0000
00027d0 0000 0005 0000 0013 0000 0001 0000 0000
00027e0 0000 0000 0000 0000 0000 0000 0000 0000
00027f0 0000 0000 0000 0000 0000 0000 0000 aa55
0002800 0000 0000 0000 0000 0000 0000 0000 0000
*
00029c0 0000 00a5 0000 b04c 0009 d000 002e 0000
00029d0 0000 0005 0000 0014 0000 0001 0000 0000
00029e0 0000 0000 0000 0000 0000 0000 0000 0000
00029f0 0000 0000 0000 0000 0000 0000 0000 aa55
0002a00 0000 0000 0000 0000 0000 0000 0000 0000
*
0002bc0 0000 00a6 0000 904b 0038 1000 0040 0000
0002bd0 0000 0005 0000 0015 0000 0001 0000 0000
0002be0 0000 0000 0000 0000 0000 0000 0000 0000
0002bf0 0000 0000 0000 0000 0000 0000 0000 aa55
0002c00 0000 0000 0000 0000 0000 0000 0000 0000
*
0002dc0 0000 00a8 0000 b04a 0078 7000 0009 0000
0002dd0 0000 0005 0000 0016 0000 0001 0000 0000
0002de0 0000 0000 0000 0000 0000 0000 0000 0000
0002df0 0000 0000 0000 0000 0000 0000 0000 aa55
0002e00 0000 0000 0000 0000 0000 0000 0000 0000
*
0002fc0 0000 00a9 0000 3049 0082 0800 0004 0000
0002fd0 0000 0005 0000 0017 0000 0001 0000 0000
0002fe0 0000 0000 0000 0000 0000 0000 0000 0000
0002ff0 0000 0000 0000 0000 0000 0000 0000 aa55
0003000 0000 0000 0000 0000 0000 0000 0000 0000
*
00031c0 0000 0095 0000 5048 0086 a000 000f 0000
00031d0 0000 0005 0000 0018 0000 0001 0000 0000
00031e0 0000 0000 0000 0000 0000 0000 0000 0000
00031f0 0000 0000 0000 0000 0000 0000 0000 aa55
0003200 0000 0000 0000 0000 0000 0000 0000 0000
*
00033c0 0000 0090 0000 f047 0095 [COLOR="red"][B]8000 013c[/B][/COLOR] 0000
00033d0 0000 0000 0000 0000 0000 0000 0000 0000
*
00033f0 0000 0000 0000 0000 0000 0000 0000 aa55
0003400

And this is the output from the Parsebinarypartitionfile.pl when run on the same file.

darkspr1te@darkspr1te:~/Desktop/Samsung/brixfix/partition_load_pt$ perl perl/ParseBinaryPartitionFile.pl shv-e160l-partition0.bin

----------------------------------------------------------
Parsing shv-e160l-partition0.bin ------------------

1	0x00	0x92	0x00000001 (000001)	0x00032000 (204800) (100.00MB)
2	0x80	0x4D	0x00032001 (204801)	0x000003E8 (001000) (0.49MB)
3	0x00	0x51	0x000323E9 (205801)	0x00000BB8 (003000) (1.46MB)
0x00	0x05	0x00032FA1 (208801)	0x01D2705F (30568543) (14926.05MB)	- EXT PARTITION (Type=0x05) - not counted as a partition

$ExtendedPartitionBeginsAt=208801

4	0x00	0x47	0x0000105F (004191)	0x000003E8 (001000) (0.49MB)	4MB boundary #26 (sector 212992)
0x00	0x05	0x00000001 (000001)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

5	0x00	0x45	0x0000305E (012382)	0x00001000 (004096) (2.00MB)	4MB boundary #27 (sector 221184)
0x00	0x05	0x00000002 (000002)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

6	0x00	0x4C	0x0000505D (020573)	0x00001388 (005000) (2.44MB)	4MB boundary #28 (sector 229376)
0x00	0x05	0x00000003 (000003)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

7	0x00	0x48	0x0000705C (028764)	0x00005000 (020480) (10.00MB)	4MB boundary #29 (sector 237568)
0x00	0x05	0x00000004 (000004)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

8	0x00	0x46	0x0000D05B (053339)	0x000003E8 (001000) (0.49MB)	4MB boundary #32 (sector 262144)
0x00	0x05	0x00000005 (000005)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

9	0x00	0x5D	0x0000F05A (061530)	0x000003E8 (001000) (0.49MB)	4MB boundary #33 (sector 270336)
0x00	0x05	0x00000006 (000006)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

10	0x00	0x91	0x00011059 (069721)	0x000003E8 (001000) (0.49MB)	4MB boundary #34 (sector 278528)
0x00	0x05	0x00000007 (000007)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

11	0x00	0x93	0x00013058 (077912)	0x00005000 (020480) (10.00MB)	4MB boundary #35 (sector 286720)
0x00	0x05	0x00000008 (000008)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

12	0x00	0x0C	0x00019057 (102487)	0x00031000 (200704) (98.00MB)	4MB boundary #38 (sector 311296)
0x00	0x05	0x00000009 (000009)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

13	0x00	0x4A	0x0004B056 (307286)	0x00001800 (006144) (3.00MB)	4MB boundary #63 (sector 516096)
0x00	0x05	0x0000000A (000010)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

14	0x00	0x4B	0x0004D055 (315477)	0x00001800 (006144) (3.00MB)	4MB boundary #64 (sector 524288)
0x00	0x05	0x0000000B (000011)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

15	0x00	0x58	0x0004F054 (323668)	0x00001800 (006144) (3.00MB)	4MB boundary #65 (sector 532480)
0x00	0x05	0x0000000C (000012)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

16	0x00	0x8F	0x00051053 (331859)	0x00031000 (200704) (98.00MB)	4MB boundary #66 (sector 540672)
0x00	0x05	0x0000000D (000013)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

17	0x00	0x59	0x00083052 (536658)	0x00001800 (006144) (3.00MB)	4MB boundary #91 (sector 745472)
0x00	0x05	0x0000000E (000014)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

18	0x00	0x5A	0x00085051 (544849)	0x00001800 (006144) (3.00MB)	4MB boundary #92 (sector 753664)
0x00	0x05	0x0000000F (000015)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

19	0x00	0x5B	0x00087050 (553040)	0x00001800 (006144) (3.00MB)	4MB boundary #93 (sector 761856)
0x00	0x05	0x00000010 (000016)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

20	0x00	0xAB	0x0008904F (561231)	0x00005000 (020480) (10.00MB)	4MB boundary #94 (sector 770048)
0x00	0x05	0x00000011 (000017)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

21	0x00	0x60	0x0008F04E (585806)	0x00005000 (020480) (10.00MB)	4MB boundary #97 (sector 794624)
0x00	0x05	0x00000012 (000018)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

22	0x00	0x94	0x0009504D (610381)	0x00005000 (020480) (10.00MB)	4MB boundary #100 (sector 819200)
0x00	0x05	0x00000013 (000019)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

23	0x00	0xA5	0x0009B04C (634956)	0x002ED000 (3067904) (1498.00MB)	4MB boundary #103 (sector 843776)
0x00	0x05	0x00000014 (000020)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

24	0x00	0xA6	0x0038904B (3706955)	0x00401000 (4198400) (2050.00MB)	4MB boundary #478 (sector 3915776)
0x00	0x05	0x00000015 (000021)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

25	0x00	0xA8	0x0078B04A (7909450)	0x00097000 (618496) (302.00MB)	4MB boundary #991 (sector 8118272)
0x00	0x05	0x00000016 (000022)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

26	0x00	0xA9	0x00823049 (8532041)	0x00040800 (264192) (129.00MB)	4MB boundary #1067 (sector 8740864)
0x00	0x05	0x00000017 (000023)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

27	0x00	0x95	0x00865048 (8802376)	0x000FA000 (1024000) (500.00MB)	4MB boundary #1100 (sector 9011200)
0x00	0x05	0x00000018 (000024)	0x00000001 (000001)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

28	0x00	0x90	0x0095F047 (9826375)	[COLOR="Red"][B]0x013C8000[/B][/COLOR] (20742144) (10128.00MB)	4MB boundary #1225 (sector 10035200)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)
0x00	0x00	0x00000000 (000000)	0x00000000 (000000)

This partition table has 28 usable partitions (29 parititions if you count the EXT which Linux does)

I've highlighted in red two sections showing how the file is stored on disk and interpreted in terms on endiness.

Now this if you refer back to http://xdaforums.com/showpost.php?p=33359011&postcount=4 and cross reference to

partition_parser.h in kernel sources (this one is from a copy of moboot http://code.google.com/r/geauxlsu20....h?r=dfd2d6b446d5c86640accd8843d9cdea40159507 )

We can confirm that partition type id is used to to build the partition table in terms of which file goes where

#define MBR_EBR_TYPE 0x05
#define MBR_MODEM_TYPE 0x06
#define MBR_MODEM_TYPE2 0x0C
#define MBR_SBL1_TYPE 0x4D
#define MBR_SBL2_TYPE 0x51
#define MBR_SBL3_TYPE 0x45
#define MBR_RPM_TYPE 0x47
#define MBR_TZ_TYPE 0x46
#define MBR_MODEM_ST1_TYPE 0x4A
#define MBR_MODEM_ST2_TYPE 0x4B
#define MBR_EFS2_TYPE 0x4E

#define MBR_ABOOT_TYPE 0x4C
#define MBR_BOOT_TYPE 0x48
#define MBR_SYSTEM_TYPE 0x82
#define MBR_USERDATA_TYPE 0x83
#define MBR_RECOVERY_TYPE 0x60
#define MBR_MISC_TYPE 0x63
#define MBR_PROTECTED_TYPE 0xEE

and a excerpt from partition.xml for compiling a .mbn boot image

<?xml version="1.0"?>
<image>
<physical_partition number="0">
<primary order="1" type="c" bootable="false" label="MODEM" size="10" readonly="true">
</primary>
<primary order="2" type="4d" bootable="true" label="SBL1" size="256" readonly="true">
<file name="sbl1.mbn" offset="0"/>
</primary>
<primary order="3" type="51" bootable="false" label="SBL2" size="512" readonly="true">
<file name="sbl2.mbn" offset="0"/>
</primary>
<primary order="4" type="5" bootable="false" label="EXT" size="1000000">
<extended order="1" type="47" label="RPM" size="256" readonly="true">
<file name="rpm.mbn" offset="0"/>
</extended>
<extended order="2" type="45" label="SBL3" size="2048" readonly="true">
<file name="sbl3.mbn" offset="0"/>
</extended>
<extended order="3" type="46" label="TZ" size="256" readonly="true">
<file name="tz.mbn" offset="0"/>
</extended>
</primary>
</physical_partition>
[B]<parser_instructions>
WRITE_PROTECT_BOUNDARY_IN_KB = 0
GROW_LAST_PARTITION_TO_FILL_DISK=false
ALIGN_ALL_LOGICAL_PARTITIONS_TO_WP_BOUNDARY=false
</parser_instructions>[/B]
</image>

The above file has additional commands contained within highlighted in bold, these are parsed by ptool.py which creates the need rawprogram.xml ( xml without instructions for creating mbr/ebr files ) it also creates the files for blanking emmc(optional) and it's new partition tables in the form of mbr0.bin/ebr0.bin

here is the output when run on the above file

darkspr1te@darkspr1te:~/Desktop/Samsung/brixfix/partition_load_pt/python$ python ./ptool.py -x ../xml/singleimage_partition_8660.xml -t ./

CWD: /home/darkspr1te/Desktop/Samsung/brixfix/partition_load_pt/python

OutputFolder= ./
XMLFile= ../xml/singleimage_partition_8660.xml
OutputFolder= ./
OutputToCreate None
PhysicalPartitionNumber 0
verbose False

Looking for ../xml/singleimage_partition_8660.xml
----------------------------------------
Searching /home/darkspr1te/Desktop/Samsung/brixfix/partition_load_pt/python

**Found ../xml/singleimage_partition_8660.xml (1208 bytes)

Found a physical_partition, NumPhyPartitions=1

len(PhyPartition)=0

Testing if GUID= c
GUID does not match regular expression
LABEL: MODEM
========================================
storing at 0
Adding PartitionCollection to "PhyPartition" of size 0

Testing if GUID= 4d
GUID does not match regular expression
LABEL: SBL1
========================================
storing at 0
Adding PartitionCollection to "PhyPartition" of size 0

Testing if GUID= 51
GUID does not match regular expression
LABEL: SBL2
========================================
storing at 0
Adding PartitionCollection to "PhyPartition" of size 0

LABEL: EXT
Testing if GUID= 5
GUID does not match regular expression

LABEL: RPM
Testing if GUID= 47
GUID does not match regular expression
========================================
storing at 0
Adding PartitionCollection to "PhyPartition" of size 0

LABEL: SBL3
Testing if GUID= 45
GUID does not match regular expression
========================================
storing at 0
Adding PartitionCollection to "PhyPartition" of size 0

LABEL: TZ
Testing if GUID= 46
GUID does not match regular expression
========================================
storing at 0
Adding PartitionCollection to "PhyPartition" of size 0
HashInstructions['WRITE_PROTECT_BOUNDARY_IN_KB'] =0
HashInstructions['ALIGN_BOUNDARY_IN_KB'] =0
HashInstructions['GROW_LAST_PARTITION_TO_FILL_DISK']=False
HashInstructions['DISK_SIGNATURE']=0x0
len(PhyPartition)= 1
LABEL: 'MODEM' with 2 sectors
LABEL: 'SBL1' with 150 sectors
LABEL: 'SBL2' with 220 sectors
LABEL: 'RPM' with 232 sectors
LABEL: 'SBL3' with 1200 sectors
LABEL: 'TZ' with 208 sectors
MinSectorsNeeded=2016

==============================================================================
MBR type discovered in XML file, Output will be MBR
==============================================================================

==============================================================================
OutputToCreate ===> 'mbr'
==============================================================================

On PHY Partition 0 that has 6 partitions

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

For PHY Partition 0
We will need an MBR and 3 EBRs

Inside CreateMasterBootRecord(3) -------------------------------------

1 of 6 "MODEM" (readonly=true) and size=1KB (0.00MB or 2 sectors)

2 of 6 "SBL1" (readonly=true) and size=75KB (0.07MB or 150 sectors)

3 of 6 "SBL2" (readonly=true) and size=110KB (0.11MB or 220 sectors)

About to make EBR, FirstLBA=373, LastLBA=373

Inside CreateExtendedBootRecords(3) -----------------------------------------
EBROffset= 0
Extended Partition begins at FirstLBA=373, size is 1643

FirstLBA now equals 376 since NumEBRPartitions=3

4 of 6 "RPM" (readonly=true) and size=116KB (0.11MB or 232 sectors)
FirstLBA=376 (with size 232 sectors) and LastLBA=376
PhyPartition[k][j]['align']= false
SectorsTillNextBoundary= 0
FirstLBA (376) is *not* covered by the end of the WP region (0),
it needs to be moved to be aligned to 376

FirstLBA=376, LastLBA=608, PartitionSectorSize=232
LastLBA is currently 608 sectors
Card size of at least 0.3MB needed (608 sectors)

5 of 6 "SBL3" (readonly=true) and size=600KB (0.59MB or 1200 sectors)
FirstLBA=608 (with size 1200 sectors) and LastLBA=608
PhyPartition[k][j]['align']= false
SectorsTillNextBoundary= 0
FirstLBA (608) is *not* covered by the end of the WP region (0),
it needs to be moved to be aligned to 608

FirstLBA=608, LastLBA=1808, PartitionSectorSize=1200
LastLBA is currently 1808 sectors
Card size of at least 0.9MB needed (1808 sectors)

6 of 6 "TZ" (readonly=true) and size=104KB (0.10MB or 208 sectors)
FirstLBA=1808 (with size 208 sectors) and LastLBA=1808

THIS IS THE LAST PARTITION
It cannot be marked as read-only, it is now set to writeable
PhyPartition[k][j]['align']= false
SectorsTillNextBoundary= 0

This partition is *NOT* readonly (or does not have align='true')

FirstLBA=1808, LastLBA=2016, PartitionSectorSize=208
LastLBA is currently 2016 sectors
Card size of at least 1.0MB needed (2016 sectors)

------------------------------------------------------------------------------
LastLBA is currently 2016 sectors
Card size of at least 1.0MB needed (2016 sectors)
------------------------------------------------------------------------------

ptool.py is running from CWD: /home/darkspr1te/Desktop/Samsung/brixfix/partition_load_pt/python

Created "./partition0.bin"
Created "./MBR0.bin"
Created "./EBR0.bin"
Created "./rawprogram0.xml"
Created "./patch0.xml"
Created "./emmc_lock_regions.xml"

Use msp tool to write this information to SD/eMMC card
i.e.
sudo python msp.py rawprogram0.xml /dev/sdb <---- where /dev/sdb is assumed to be your SD/eMMC card
sudo python msp.py patch0.xml /dev/sdb <---- where /dev/sdb is assumed to be your SD/eMMC card

Created "zeros_1sector.bin"	<-- full of binary zeros - used by "wipe" rawprogram files
Created "zeros_33sectors.bin"	<-- full of binary zeros - used by "wipe" rawprogram files
Created "./wipe_rawprogram_PHY0.xml"	<-- Used to *wipe/erase* partition information
Created "./wipe_rawprogram_PHY1.xml"	<-- Used to *wipe/erase* partition information
Created "./wipe_rawprogram_PHY2.xml"	<-- Used to *wipe/erase* partition information
Created "./wipe_rawprogram_PHY4.xml"	<-- Used to *wipe/erase* partition information
Created "./wipe_rawprogram_PHY5.xml"	<-- Used to *wipe/erase* partition information
Created "./wipe_rawprogram_PHY6.xml"	<-- Used to *wipe/erase* partition information
Created "./wipe_rawprogram_PHY7.xml"	<-- Used to *wipe/erase* partition information
darkspr1te@darkspr1te:~/Desktop/Samsung/brixfix/partition_load_pt/python$

now in partition.xml before it's parsed by ptool.py it is as the following with partition size as SIZE

<primary order="1" type="c" bootable="false" label="MODEM" size="10" readonly="true">
</primary>
<primary order="2" type="4d" bootable="true" label="SBL1" size="256" readonly="true">
<file name="sbl1.mbn" offset="0"/>

but after parsing it's in sectors and offsets

program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="" label="MODEM" num_partition_sectors="2" physical_partition_number="0" size_in_KB="1.0" sparse="false" start_byte_hex="0x200" start_sector="1"/>
<program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="sbl1.mbn" label="SBL1" num_partition_sectors="150" physical_partition_number="0" size_in_KB="75.0" sparse="false" start_byte_hex="0x600" start_sector="3"/>

A group of Partition Tools compiled static from original (open) sources -

http://www.sendspace.com/file/4g1atr aimed at mbr/ebr only

http://www.sendspace.com/file/5b3jdc inclusive of mbr tools plus GPT tools