First of all we'll need an example to work with.
Get it here: http://dl.dropbox.co...428/Example.rar
This is a 200MB system & 205MB data & 35MB cache partition layout.(made by Amphoras)
You can use any HEX editor, but I'll be using HxD.
So let's open the partition_zte.mbn with our HEX editor, and we get the following(I get this in HxD):
partition_zte_output.png 150.56K
90 downloadsAs you can see we have the partition names on the right side:
Recovery; Boot; Splash; Misc; Cache; System; UserData; OEM; Persist.
Let's say we want to edit the System partition, so we select on the right side "system" and it will highlight both the right side and the corresponding on the left side, like this:
system_highlight.png 7.46K
106 downloadsAs we can see, after the highlighted selection in hex(left side) we have a lot of zeros(0), when the zeros end we will get a set of 12 characters with 4 zeros in the middle, like this:
after_system.png 5.79K
70 downloadsLet's write down this set of caharacters: 44 03 00 00 40 06
Every set of this will be in this format XX XX 00 00 XX XX, always with 4 zeros in the middle.
But we only need the last 4 characters, those correspond to that specific partition size: 40 06
Now we need to reverse this set so we can work with it: 06 40
Here's a table to convert Hex to Decimal:
hex_dec.png 4.64K
52 downloadsLet's convert this Hex set to MB:
Let's make 4 columns from 3 to 0.
| Column 3 | Column 2 | Column 1 | Column 0 |
And now we'll place each number in 00 28 to each column.
| Column 3 | Column 2 | Column 1 | Column 0 |
|----0----|-----6----|----4-----|----0----|
In the next step we should convert each hex to its corresponding decimal, but the numbers will look the same as you can see from the table attached to this post.
In the following step we multiply the each decimal for 16 elevated to the corresponding column number.
| Column 3 | Column 2 | Column 1 | Column 0 |
|-----0-----|-----6-----|-----4-----|-----0-----|
|-----0-----|-----6-----|-----4-----|-----0-----|
| 0*(16^3) | 6*(16^2) | 4*(16^1) | 0*(16^0) |
Now we write down the results and add them all together.
| Column 3 | Column 2 | Column 1 | Column 0 |
|-----0----|-----6----|----4-----|----0-----|
|-----0----|-----6----|----4-----|----0-----|
| 0*(16^3) |6*(16^2)| 4*(16^1)| 0*(16^0) |
|-----0----|--1536---|---64----|-----0----| The total here is 1600
Now we divide 1600 by 8 and we get the size in MB.
1600 / 8 = 200 MB , our System partition has 200 MB.
How to do the inverse? MB to HEX? Easy!
Take the result from before: 200 MB
Multiply those 200 by 8: 200 * 8 = 1600
Now let's divide 40 for 16 and the remainders are our hexs.
1600 / 16 = 100 , here our reminder will be 0 as we can see: 0 * 16 = 0 <- This is our first Hex
100 / 16 = 6,25 , now let's keep the number 6 in our head and take only the value after comma(,), let's get our remainder: 0,25 * 16 = 4 <- This is our second Hex
6 / 16 = 0,375 , same thing as before, we keep the 0(zero) and take only the value after comma(,) to get the remainder: 0,375 * 16 = 6 <- This is our third Hex
0 / 16 = 0 , so the remainder will also be 0 <- This is our fourth and last Hex
We do the above process untill the remainder is less than 1.
Sow we have 06 40.
Now we need to switch places each pair so we get the hex we need 40 06.
So if you want to build a partition layout with 150MB you'll have to use the 40 06 hex value.
Now that we understand HEX let's make a partition layout using the above.
We should just touch system, data and cache unless you want to mess up your phone's partitions.
Let's use the above partition_zte.mbn where system has 40 06, data has 68 06 and cache has 18 01.
By the method above we can say that each partition is 200MB, 205MB and 35MB.
Let's say we want a system 150MB, data 250MB and cache 40MB.
We just need to convert these to HEX values using the method above:
150 = B0 04
250 = D0 07
40 = 40 01
So we go on our partition_zte..mbn and make the changes:
System: From 44 03 00 00 40 06 go to 44 03 00 00 B0 04
Data: From 84 09 00 00 68 06 go to 84 09 00 00 D0 07
Cache: From 2C 02 00 00 18 01 go to 2C 02 00 00 40 01
You must make this changes in appsboot.mbn as well, you can find it in the end of the file.
appsboot_edition.png 163.03K
37 downloadsCongratulations, you just graduated in HEX
Happy Math!
P.S.: You can always use Google, but here you have everything already
Edited by D3abL3, 21 November 2011 - 11:23 AM.







Sign In
Create Account





Back to top










