FORUMS
Remove All Ads from XDA

[MOD] MT6577 2GB Data Repartition/ SdCard Swap [HACK], INT2EXT (data2ext)

1,152 posts
Thanks Meter: 4,111
 
By yuweng, Senior Member on 1st October 2012, 05:06 AM
Post Reply Email Thread
31st January 2014, 12:48 AM |#91  
Senior Member
Flag Denpasar-Bali
Thanks Meter: 199
 
More
Info 2 [Noob Guide]Understanding the Hex value of MTK's MBR/EBR1/EBR2
Straight to the guide. First of all you need:
  • MtkDroidTools
  • cygwin (cos I'm using Windows, sucks isn't it)
  • Hex editor (I'm using HxD)
  • Notepad++ (or any text editor)
  • your scatter file

In this guide, I'm using my Hisense EG980ae as an example. It is an MTK6589t phone and it doesn't has an EBR2 file. Setting up things first:
  1. Put your MBR and/or EBR1 file in the root folder of Cygwin (or linux user can staraight to type) and type:
    Code:
    file MBR
    you will get something like this:
    Code:
    MBR: x86 boot sector; 
    partition 1: ID=0x5, starthead 0, startsector 1024, 4294967295 sectors;
    partition 2: ID=0x83, starthead 0, startsector 26624, 20480 sectors;
    partition 3: ID=0x83, starthead 0, startsector 47104, 20480 sectors; 
    partition 4: ID=0x83, starthead 0, startsector 93184, 12288 sectors,
    code offset 0x0
    and
    Code:
    file EBR1
    you will get something like this:
    Code:
    EBR1: x86 boot sector;
    partition 1: ID=0x83, starthead 0, startsector 132096, 1433600 sectors;
    partition 2: ID=0x83, starthead 0, startsector 1565696, 258048 sectors;
    partition 3: ID=0x83, starthead 0, startsector 1823744, 4293143551 sectors,
    code offset 0x0
    Copy and paste the result to your text editor and let it open (don't close your text editor yet).

  2. Connect your MTK device to your PC and open MTK droid tools. Click "Blocks Map" and leave the window open, like this:



  3. Open your MBR and/or EBR1/EBR2 with an Hex editor (choose 16 bytes per row), and you'll get a view like this:




    On the left is my MBR and on the right is my EBR1. Just concentrate on the highlighted part, and copy them to your text editor and arrange them like this:



Its time to decrypt things!!!!
Now just for an example, we concentrate on the hex value which I highlighted with the pink background (the MBR part):
Code:
00 00 00 00 83 00 00 00 00 68 00 00 00 50 00 00
  • The first hex number (red) gives two pieces of information. If it is 00, just like the example. then the partition is not the active partition (does not contain the boot loader). If it is 80 or greater, this means it is the active (bootable) partition. Only one partition can be marked as active. The second piece of information applies to fixed disks. If the first fixed disk contains the active partition, this number will be 80. If it were the second fixed disk, this number would be 81, and so on.
  • The hex number 83 (in purple) tells which type of file system the partition contains, and whether the Cylinder, Head, Sector (CHS) or the Large Block Addressing (LBA) system is to be used to locate the partition. In our case, 83 means Linux ext2fs partition.
  • And finally, there are two ways that the location of the partition is specified in the partition table entry:
    • The first is the Cylinder Heads Sectors method (CHS). The three blue numbers (00 00 00) specify the CHS location where the partition begins, and the three orange numbers 00 00 00 specify where it ends.
    • The Cylinder Head Sector method only works on drives up to 8 gigabytes because that is the maximum size that can be specified with the three bytes. I guess this is why MTK does not use this and provide a null value. And to get around this, they instead use the second method of specifying the location of the partition. It is called Logical Block Addressing, and it uses the last eight bytes in the partition table entry. These bytes give the location of the partition by counting the number of sectors from the start of the disk, which is much simpler. The four bytes in lime (00 68 00 00) give the number of sectors before the partition, and the following four bytes (00 50 00 00) in YellowGreen give the length of the partition.

We have to know just one thing to interpret these bytes. They are in "little endian" order. This means that the lowest "place value" is held by the first byte. So to use them like we use ordinary numbers, we just have to reverse the order of the bytes. So 00 68 00 00 becomes 00006800 and 00 50 00 00 becomes 00005000. Using any hex converter, now we can convert these new hex numbers (00006800 and 00005000) to decimal (26624 and 20480). This new decimals tell us that there are 26624 sectors before the partition begins at the 26625th sector, and it is 20480 sectors long. Thus the partition ends at sector 26624+20480=47104. Notice that this is the same result we got with the CHS math.

Now can you see how those numbers (26624, 20480, and 47104) correlated with the data we first acquired when we ran the "file" command on cygwin, which is on the second and third partitions of the "MBR":
Code:
MBR: x86 boot sector
partition 2: ID=0x83, starthead 0, startsector 26624, 20480 sectors;
partition 3: ID=0x83, starthead 0, startsector 47104, 20480 sectors;
But How the hell we convert sectors to bytes?!!!!
Since the default sector-size for almost every single HDD is 512 bytes per Sector, why don't we just multiply all our numbers, especially the size of the MBR's partition number two above 20480 by 512.


So we get 20480 X 512 = 10485760

Now please compare the value with the "Blocks Map" window that we open earlier!!!!!!!




However, sometimes it would get more tricky. For example, let us look at the MBR's partition 3 and 4:

Code:
MBR: x86 boot sector; 
partition 3: ID=0x83, starthead 0, startsector 47104, 20480 sectors;
00 B8 00 00 00 50 00 00
  0000B800    00005000  
   47104       20480
             10485760 Bytes

 
MBR: x86 boot sector; 
partition 3: ID=0x83, starthead 0, startsector 93184, 12288 sectors;
00 6C 01 00 00 30 00 00
  00016C00    00003000
   93184       12288
             6291456 Bytes
This is where it gets tricky:

Code:
 47104 + 20480 = 67584 not 93184
Now where these extra sectors or bytes, to be precise 93184 - 67584 = 25600 sectors or 13107200 Bytes, go? To find the answer of this freak'n mystery, you have to re-open the MTKDroid Tool's "Blocks Map" window that we open earlier!!!!!!!





Ring a bell fellas?!!!!


So.....
Happy re-partitioning your MTK devices and keep on improvising!!!!!!!!!!!!!!
Attached Thumbnails
Click image for larger version

Name:	MBR-EBR1.png
Views:	22457
Size:	29.9 KB
ID:	2549725   Click image for larger version

Name:	Hex.png
Views:	23452
Size:	15.3 KB
ID:	2549776   Click image for larger version

Name:	result1.png
Views:	22314
Size:	25.9 KB
ID:	2549778   Click image for larger version

Name:	result2.png
Views:	22438
Size:	217.8 KB
ID:	2550259   Click image for larger version

Name:	!.png
Views:	22444
Size:	25.8 KB
ID:	2550266  
The Following 24 Users Say Thank You to tirta.agung For This Useful Post: [ View ] Gift tirta.agung Ad-Free
 
 
13th February 2014, 08:22 AM |#92  
Senior Member
Flag Manila
Thanks Meter: 144
 
More
Quote:
Originally Posted by tirta.agung

Straight to the guide. First of all you need:

  • MtkDroidTools
  • cygwin (cos I'm using Windows, sucks isn't it)
  • Hex editor (I'm using HxD)
  • Notepad++ (or any text editor)
  • your scatter file

In this guide, I'm using my Hisense EG980ae as an example. It is an MTK6589t phone and it doesn't has an EBR2 file.

Is this hack possible to MT6577? My lenovo phone doesn't have EBR2 file. I've already partitioned my device using the apk provided in this thread. Though, I would like to do my own partitioning to whatever size i want by following your guide.
23rd February 2014, 07:56 AM |#93  
bigrammy's Avatar
Senior Member
Flag huddersfield
Thanks Meter: 1,887
 
More
Quote:
Originally Posted by tirta.agung

So.....
Happy re-partitioning your MTK devices and keep on improvising!!!!!!!!!!!!!!

Nice work and Very Informative thanks bro
24th February 2014, 09:01 AM |#94  
Senior Member
Flag Denpasar-Bali
Thanks Meter: 199
 
More
Quote:
Originally Posted by iZLeeP

Is this hack possible to MT6577? My lenovo phone doesn't have EBR2 file. I've already partitioned my device using the apk provided in this thread. Though, I would like to do my own partitioning to whatever size i want by following your guide.

Yes, of course, but remember to change your scatter file as well. Here is an excel file that you can use as a base for you for your device.
Attached Files
File Type: xls Partition Edit.xls - [Click for QR Code] (59.0 KB, 497 views)
The Following 2 Users Say Thank You to tirta.agung For This Useful Post: [ View ] Gift tirta.agung Ad-Free
25th February 2014, 12:44 AM |#95  
Senior Member
Flag Manila
Thanks Meter: 144
 
More
Quote:
Originally Posted by tirta.agung

Yes, of course, but remember to change your scatter file as well. Here is an excel file that you can use as a base for you for your device.

Copy mate, will give this a go and report back. Thanks!
15th March 2014, 03:31 PM |#96  
Junior Member
Thanks Meter: 3
 
More
tirta.agung,
thank you very much for your tutorial!
28th March 2014, 11:06 PM |#97  
Junior Member
Thanks Meter: 3
 
More
HELP
helllo every one
i've used this mod to repartition my mt6577 note 2 clone
and it worked but when i tried to revert it the phone wasnt
able to access the internal memory any more, and data part
still 2gb, i tried flashing a full firmware but, the phone became
bricked, no boot, not charging, but still detected by pc ,
also i checked battery drain, there is 50 mA current when pressing
power btn, and voltage is near 4V , what should i do
HELP please
3rd April 2014, 07:12 AM |#98  
Senior Member
Flag Manila
Thanks Meter: 144
 
More
Quote:
Originally Posted by louis xv

helllo every one
i've used this mod to repartition my mt6577 note 2 clone
and it worked but when i tried to revert it the phone wasnt
able to access the internal memory any more, and data part
still 2gb, i tried flashing a full firmware but, the phone became
bricked, no boot, not charging, but still detected by pc ,
also i checked battery drain, there is 50 mA current when pressing
power btn, and voltage is near 4V , what should i do
HELP please

Flashing full firmware should have solved the problem. Try flashing again, but this time format it first using sp flash tool before you proceed with the download.
29th May 2014, 07:36 AM |#99  
keanu_ritz's Avatar
Senior Member
Flag SANGLI
Thanks Meter: 474
 
More
Red face need a little advice
no worries , figured it out myself.
17th July 2014, 04:31 PM |#100  
Member
Thanks Meter: 12
 
More
This thread makes me feel like an idiot :')

I have a ZTE V965. It has 3GB internal storage, which is divided in 2 1.5 GB partitions. One is called phone storage and the other one internal (usually). Apparently it's possible to have just one partition. Which should resolve my storage full problems. I can't figure out how to do it though
Which files need to be edited? vold.fstab? the scatter file for flashing?
9th August 2014, 07:45 AM |#101  
Kunal.Kene.1797's Avatar
Senior Member
Flag Nagpur
Thanks Meter: 786
 
More
I Need Help Please!
Can you take a look ?
MT Device is MT6572 with EBR1 and MBR Files only...this is the Link to my stock MBR and EBR1....i would be very thankful if someone can help or atleast guide me!
Thanks in Advance
I want to increase the Primary Internal Data Partition size from 500MB to 2GB!

MBR and EBR1 : http://forum.xda-developers.com/atta...9&d=1406289303

Scatter[MT6572] : http://forum.xda-developers.com/atta...8&d=1406289178
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes