MOD + Tutorial for Re-partitioning Storage of MTK6589 + Flash through CWM/TWRP

Search This thread

bresjanacp

Member
Jan 25, 2015
22
0
MT6582, ZLR i6, 4GB ROM, KitKat 4.4.2

Hi,

veery nice tutorial, but onlu problem that I have is that on my phone, System is P6, Cash is P7, Data is P8 and Internal SD is P9.

So, there is no explanation for EBR1 and EBR2 for this way of partitioning.
 

cupliz

Senior Member
Apr 19, 2011
695
87
Peace
i have similar phone, i try follow your instruction but its still nonsens for me. Please see this hex code and help me, maybe i was wrong and you can correct me.

first i think we have different name of partition so i can't use your guide instantly.

Code:
MBR
00 00 00 00 05 00 00 00 | 00 04 00 00 | FF FF FF FF
00 00 00 00 83 00 00 00 | 00 68 00 00 | 00 50 00 00         ->   20000 =  10240000 > 10mb  
00 00 00 00 83 00 00 00 | 00 B8 00 00 | 00 50 00 00         ->   20000 =  10240000 > 10mb
00 00 00 00 83 00 00 00 | 00 6C 01 00 | 00 30 00 00         ->   12288 =   6291456 >  6mb

EBR1
00 00 00 00 83 00 00 00 | 00 98 01 00 | 00 40 06 00  -systm ->  409600 = 209715200 > 200mb
00 00 00 00 83 00 00 00 | 00 48 08 00 | 00 00 18 00  -cache -> 1572864 = 805306368 > 800mb
00 00 00 00 83 00 00 00 | 00 48 20 00 | 00 D0 0B 00  -data  ->  774144 = 396361728 > 375mb
00 00 00 00 05 00 00 00 | 00 F4 07 00 | FF FF FF FF  -link int-strg

EBR2
00 00 00 00 83 00 00 00 | 00 24 84 00 | FF E7 73 FF  -end

how can i ensure partition name? my phone is 8gb, it should have 1gb++ on data or system but i dont find it.
 
Last edited:

mpankaj78

New member
Jan 2, 2010
2
0
Superb Tutorial

Thanks a lot for the tutorial. It is really helpful to thoroughly understand MBR, EBR1 & EBR2.

I modified stock EBR1 & EBR2 using HxD and flashed using SP Flash tool. Failed once and read the instructions again then found my mistake.
Corrected it and yes, it worked like a charm! I am using MMX A190 (MT 6592), increased /data to 4GB and rest to internal SD.

Using for more than 24 hours, rebooted couple of times and working fine.

Thanks again :good:

Note: I didn't have any option other than using CWM backup. I restored CWM backup after formatting /data. Somehow it is working fine.
 

somshuvra16

New member
Feb 10, 2015
3
0
Need help on some confusions.

Sir,
I am using micromax canvas 2 colours a120 with 8gb rom (mt
6582). I am using TWRP recovery.

I have a lot of confusion about android backup and modification. I
have searched a lot in google, have read a lot of xda forms but did
not found proper answer of the following questions.
I am very sorry for asking so much question.
But I shall be very very much greatfull if you clear my confusions

1) Can TWRP or CWM backup EBR files while nandroid backup? (I know
that mtk droid tools and sp flash tools readback can do that)

2) Where preloader.bin get saved in root explorer?
(while scatter loading through sp flash tools we find preloader.bin
which we should untick before download. Other wise phone may get hard
bricked. So i want to know where it remainis in root explorer. So that
I do not modify it by mistake.

3) May some custom room need modified preloader.bin? (I shall not
flash custom rom if it need modified preloader.bin)
4) Can recovery be accesed and nandroid backup be restored after wrong
flashing through modified recovery ?

5) Is there anything other rather than preloader.bin that I should
untick while flashing through sp flash tools?

6) Does the apps that changes app storage and internal sd size (like
hkromeditor.apk mlpriorepartition.apk)
Only flash Ebr files or they also modify preloader.bin?

7) Does imei, bluetooth , wifi automaticky backuped by TWRP Or CWM in
nandroid backup? (we know imei remains temporary in nvram and
permanently in system\etc\firmwere\modem.ing)

8) If I loose imei and bluetooth or wifi will nandroid backup will
restore it? (I have also mobiuncle tools backup and mtk droid tools
backup)

9) Where Ebr files remain in root explorer?

Please reply. Sorry for asking so many question and for improper english.

NOTE "If you are not developer do not reply unless you know properly".
 

r3flux

Senior Member
Feb 2, 2009
461
91
indroid.info
- Flashed the mod files on my A116 via TWRP
- Wiped cache
- Installed ROM
- Reboot
- Stuck at Canvas HD logo
- Powered off and Booted into recovery
(Unable to mount internal or external storage)

Please suggest what to do.
 

lastkenji

Member
Jun 14, 2012
20
16
SS_003.jpg


How did you convert mb all the way to the hex?

tia..
 

UzUmAKI_NaRuTo1

Senior Member
May 1, 2014
274
263
Mumbai
Xiaomi Poco F1
Help please....

I tried this.............. and when i flashed the rom it went into bootloop...!! i tried second time and this time with diff rom.. it gt stucked on boot logo !!

Infact , your mod itself should work with my device still i did this with my stock ebrs...!! its mtk6589 phone with 4gb of internal

I dont understand whats the issue !! Please helpp............

@keanu_ritz
 
Last edited:

privatezs

Member
May 2, 2014
29
1
29
Cairo
Can Some One help? :(

Please Help :(
i used app called somthing mtk MT65xx rom edit "following another XDA Thread"
it is an android application (APK)
to edit the partation size
my phone have only 4 gb internal , 512 only for apps and games
and only 1.6 availabe at all as i remeber
when i opened the app i found minimum choice is 1.5 GB
i selected it and now i think i have a wrong ebr1 and ebr2 files
my phone dosn't have a stock rom source on the internet
my Phone is
Model : G-Tide E80
Android Version : ICS 4.0.4
internal : 4 GB (503 Mbs user available)
Processor : MTK MT6577

All i Have is CWM Nandroid Backup But i guess /dev/ebr1/ebr2 not included in the nandroid Backup :/
Can Any One Help Me Please?
 

evreniy2141

New member
Apr 18, 2015
3
0
Please Help mtk 6577 16 GB rom I want to changed This


Please Help
I want to changed This
mtk 6577 16 GB Rom
/system = 503 GB
/cache = 503 MB
/data = 503 GB
Internal SD Card = remaining space

OR

/system = 1 GB
/cache = 500 MB
/data = 2 GB

Internal SD Card = remaining space
 
Nov 19, 2014
34
12
28
Hojai
Can you please make it with 750mb system and 1.5gb data? I tried but it is not workin

Can you please make it with 750mb system and 1.5gb data? I tried but it is not working ;( ..I would be very grateful if you help me sir, thank you..
 
Last edited:

cheuri

Account currently disabled
Oct 12, 2014
8
0
GB
meettomy.site
Help me to partition my memory

Recent
/data.. 3020.8 mb
/system. 3183.52mb
/cache... 124 mb
Internal 10055.68mb

Needed
/data.. 5120mb
/system.. 4096mb
/cache... 150 mb
Internal... 7018mb

Thanks in advance
 

rkharat98

Senior Member
Request.

@keanu_ritz .. These are my currency files
/system -> 907mb/953,036,800Bytes
Internal_sd -> 1.5gb/1,610,039,296Bytes
/data -> 0.99gb/1,060,319,232Bytes

I want system to be 950mb... And data to be 1.5gb&2gb..
The files you have in your thread are close, but system partition is 883mb.. Which matters a lot, when installing color os...

Will you do that? Please. These are https://drive.google.com/file/d/0B9abLEpf1IGpTGlIcEhHLU4zbDQ/view?usp=docslist_api my current files.
 

Supermatt01

Senior Member
Nov 20, 2010
796
94
Surabaya
Redmi Note 10 Pro
I'm trying to use this on a lenovo p780. So far I've been trying for a week to get my full 8 gigabytes back in action on a CN markup. Any help? I've tried flashing this file 3 times already with no profit. Should the EBR 1 and 2 lines have " " or no? Do I need to toss in any other files? Scatter, MBR, pmt?
 

mvasim007

Senior Member
Jan 21, 2013
163
416
Tutorial/Guide for Re-partitioning MTK6589 + Increase your System & Data Partitions + Flash through CWM/TWRP + no need to use SPFlashTool

Part 1 :- To Flash existing modified EBR files through CWM/TWRP

There are plenty of guides for re-partitioning mtk devices, so why this one?
Well almost all of them suggest to use SPFlashTool to flash the "EBR" Files.

But we can do that by using CWM/TWRP (Custom Recoveries) as well!!!!!
no need to use SPFlashTool!
no need to format the Internal SDCard through PC!!

Just take your modified "EBR" files and put them into a Flashable Zip.

Edit the "updater-script" file to include the following lines.


Code:
[FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]package_extract_file("EBR1", "/dev/ebr1"); 
#put the name of your EBR1 file in place of "EBR1"
package_extract_file("EBR2", "/dev/ebr2"); 
#put the name of your EBR2 file in place of "EBR2"[/COLOR][/SIZE][/FONT]

Note :-
If your device uses both the files then add both the lines and If your device uses only "EBR1" then add only the line of "EBR1".

Now add the following lines to format your "/system" , "/cache" and "/data" partitions.


Code:
[FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]
format("ext4", "EMMC", "/emmc@android", "0", "/system");
format("ext4", "EMMC", "/emmc@cache", "0", "/cache");
format("ext4", "EMMC", "/emmc@usrdata", "0", "/data");
[/COLOR][/SIZE][/FONT]

Note :- If you are going to increase your "/system" partition then you'll have to format the 3 partitions,
and if you just want to increase the "/data" partition then just include the lines for formatting "/cache" and "/data".


now save the "updater-script" file and replace it in the Flashable zip!!

Or , you can use this sample flashable zip file.
download it and put your EBR files in it!!!!
edit the "updater-script" file according to your need and replace it in the Flashable zip!!

copy the Flashable zip file to your external SDCard
reboot to recovery
select install from zip file and choose the flashable zip file
Flash it.

Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
Just Flash any CWM/TWRP Flashable ROM available for your device!!
Wipe Dalvik Cache if you haven't done it already!!
reboot and see for yourself!!!

Disclaimer :-
I will not be in anyway responsible for any damage this might cause to your phone.
if you'll follow the instructions correctly, then everything will be fine.



i did it with micromax p580 tab . made internal storage 3 gb (app installation) and rest for media storage.
i got partial success. as i reboot device. i get notifiaciton "internal sd got damged. try formatting it" . after formating it works.
But each reboot gives message of damaged internal sd.

please help me solve this .
 

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    Part 2 :-

    for understanding your MTK device's partitions, first read this excellent guide posted by @tirta.agung --> [Noob Guide] Understanding the Hex value of MTK's MBR/EBR1/EBR2


    So How to Increase the system partition? or the data partition?
    I'll tell you!!

    I use MMX Canvas HD A116 (mt6589)
    it has 4GB internal storage distributed as below:
    /system = 650mb
    /cache = 126mb
    /data = 1gb
    Internal SDcard = 1.77gb


    i wanted to change it to this:- (and i've done it!!!)
    /system = 900mb
    /cache = 126mb
    /data = 2gb
    Internal SDCard = remaining space i.e around 536mb



    Note :- First please read the above mentioned guide, otherwise you won't understand this!!


    let me try to make it simple to you
    this is the hex format of "EBR1" & "EBR2"

    EBR1 of MMX A116 (mt6589) :-
    00 00 00 00 83 00 00 00 00 08 02 00 00 50 14 00 --> Partition 5 /system 650MB
    00 00 00 00 83 00 00 00 00 58 16 00 00 f0 03 00 --> Partition 6 /cache 126MB
    00 00 00 00 83 00 00 00 00 48 1a 00 00 00 20 00 --> Partition 7 /data 1GB
    00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> points to ebr2

    EBR2 of MMX A116 (mt6589) :-
    00 00 00 00 83 00 00 00 00 94 38 00 ff b7 c5 ff --> partition 8 Internal SDCard
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



    Note :-
    numbers in red --> Offset of partition

    numbers in DarkOrange --> Size of Partition



    Now if you notice carefully these partitions are continuous/contiguous.

    133120 + 1331200 = 1464320
    1464320 + 258048 = 1722368


    i.e no.of sectors before partition + the length of the partition = no.of sectors before the next partition

    // 133120 = no.of sectors before "/system" partition i.e "/system" starts from sector no. 133121
    // 1331200 = the length of "/system" i.e "/system" is of 1331200 sectors.
    // 1464320 = no.of sectors before "/cache" partition i.e "/cache" starts from sector no. 1464321
    // and so on



    The last line in EBR1 points to EBR2.
    (This one --> 00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff )

    and the First line in EBR2 is the one for the partition of Internal SDCard.
    (This one --> 00 00 00 00 83 00 00 00 00 94 38 00 ff b7 c5 ff )

    Even after reading many guides, I haven't found a proper explanation of this anywhere.
    in one of them it states that,



    D = (A + B) - C
    where,
    A = no.of sectors before "/data"
    B = size of "/data"
    C = offset of EBR2
    D = offset part in EBR2

    E = MaxValue - (A + B)
    where,
    MaxValue = FFFFFFFF (Hex) = 4294967295 (in decimal)
    A = no.of sectors before "/data"
    B = size of "/data"
    E = Size part in EBR2

    A = 00 48 1a 00 --> 001a4800 --> 1722368 //offset of "/data"
    B = 00 00 20 00 --> 00200000 --> 2097152 //size of "/data"
    C = 00 b4 01 00 --> 0001b400 --> 111616 //offset of ebr2
    Max Value = FF FF FF FF --> ffffffff --> 4294967295 //?

    Note :-
    in Red --> Hex values in little endian
    in Orange --> Hex values in big endian
    in Blue --> Decimal values


    D = (A+B) - C = (1722368 + 2097152) - 111616 = 3707904

    E = MaxValue - (A+B) = 4294967295 - (1722368 + 2097152) = 4291147775

    D = 3707904 = 00389400 = 00 94 38 00

    E = 4291147775 = ffc5b7ff = ff b7 c5 ff




    so now you've got a good idea of what the values in "EBR" files mean, haven't you!!
    Now here comes the Important part i.e how to modify the partition sizes.


    I wanted "/system" = 900mb , so





    So we get "00 20 1C 00" as the value for 900mb
    (note-down these new values as we'll need to use them later)

    now as we've increased the size of system we need to change the offset of the next partition so that there won't be any overlapping/corruption of partitions.

    and how do we do that --> "no.of sectors before partition + the length of the partition = no.of sectors before the next partition"
    i.e 133120 + 1843200 = 1976320 //new offset of "/cache"



    decimal value --> 1976320
    Hex value in big endian --> 001E2800
    Hex value in little endian --> 00 28 1E 00


    So we get "00 28 1E 00" as the value for sectors before "/cache"
    i don't want to change size of "/cache" so it remains same i.e "00 f0 03 00"

    now we need to offset the "/data" partition
    ("no.of sectors before partition + the length of the partition = no.of sectors before the next partition")
    1976320 + 258048 = 2234368 // the number of sectors before "/data" partition



    decimal value --> 2234368
    Hex value in big endian --> 00221800
    Hex value in little endian --> 00 18 22 00


    So we get "00 18 22 00" as the value for sectors before "/data"

    now i want to make my "/data" to 2gb i.e 2048mb





    So we get "00 00 40 00" as the value for 2048mb

    The last line in EBR1 Points to EBR2 so don't make any changes to it!!!

    So now our modified EBR1 Becomes like this:-
    00 00 00 00 83 00 00 00 00 08 02 00 00 20 1c 00 --> Partition 5 /system 900MB
    00 00 00 00 83 00 00 00 00 28 1E 00 00 f0 03 00 --> Partition 6 /cache 126MB
    00 00 00 00 83 00 00 00 00 18 22 00 00 00 40 00 --> Partition 7 /data 2GB
    00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> Link to ebr2


    now we need to offset the Internal SDCard's partition which is in EBR2





    calculate new D & E :-

    D = (A+B) - C
    where,
    A = no.of sectors before "/data"
    B = size of "/data"
    C = offset of EBR2


    E = MaxValue - (A+B)
    where,
    MaxValue = FFFFFFFF (Hex) = 4294967295 (Decimal)
    A = no.of sectors before "/data"
    B = size of "/data"


    A = 00 18 22 00 --> 00221800 --> 2234368 //offset of "/data"
    B = 00 00 40 00 --> 00400000 --> 4194304 //size of "/data"
    C = 00 b4 01 00 --> 0001b400 --> 111616 //offset of ebr2
    Max Value = FF FF FF FF --> ffffffff --> 4294967295 //?


    D = (A+B) - C = (2234368 + 4194304) - 111616 = 6317056

    E = MaxValue - (A+B) = 4294967295 - (2234368 + 4194304) = 4288538623


    D = 6317056 = 00606400 = 00 64 60 00

    E = 4288538623 = FF9DE7FF = ff e7 9d ff






    That's it, now we've got all the values ,it's time to put them into the EBR Files.
    So this is the result of our modification:-
    Modified EBR1 :-
    00 00 00 00 83 00 00 00 00 08 02 00 00 20 1c 00 --> Partition 5 /system 900MB
    00 00 00 00 83 00 00 00 00 28 1E 00 00 f0 03 00 --> Partition 6 /cache 126MB
    00 00 00 00 83 00 00 00 00 18 22 00 00 00 40 00 --> Partition 7 /data 2GB
    00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> Link to ebr2


    Modified EBR2 :-
    00 00 00 00 83 00 00 00 00 64 60 00 ff e7 9d ff --> internal sdcard


    To edit "EBR" files :-
    Open your ERB1 & EBR2 files in hex editor and replace the respective values with our modified values.
    save the files and put them into a flashable zip and flash through CWM/TWRP or whatever custom recovery that you use!!!!

    Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
    Just Flash any CWM/TWRP Flashable ROM available for your device!!
    Wipe Dalvik Cache if you haven't done it already!!
    reboot and see for yourself!!!




    Screenshots :-


    Disclaimer :-
    I will not be in anyway responsible for any damage this might cause to your phone.
    if you'll follow the instructions correctly, then everything will be fine.
    18
    Tutorial/Guide for Re-partitioning MTK6589 + Increase your System & Data Partitions + Flash through CWM/TWRP + no need to use SPFlashTool

    Part 1 :- To Flash existing modified EBR files through CWM/TWRP

    There are plenty of guides for re-partitioning mtk devices, so why this one?
    Well almost all of them suggest to use SPFlashTool to flash the "EBR" Files.

    But we can do that by using CWM/TWRP (Custom Recoveries) as well!!!!!
    no need to use SPFlashTool!
    no need to format the Internal SDCard through PC!!

    Just take your modified "EBR" files and put them into a Flashable Zip.

    Edit the "updater-script" file to include the following lines.


    Code:
    [FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]package_extract_file("EBR1", "/dev/ebr1"); 
    #put the name of your EBR1 file in place of "EBR1"
    package_extract_file("EBR2", "/dev/ebr2"); 
    #put the name of your EBR2 file in place of "EBR2"[/COLOR][/SIZE][/FONT]

    Note :-
    If your device uses both the files then add both the lines and If your device uses only "EBR1" then add only the line of "EBR1".

    Now add the following lines to format your "/system" , "/cache" and "/data" partitions.


    Code:
    [FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]
    format("ext4", "EMMC", "/emmc@android", "0", "/system");
    format("ext4", "EMMC", "/emmc@cache", "0", "/cache");
    format("ext4", "EMMC", "/emmc@usrdata", "0", "/data");
    [/COLOR][/SIZE][/FONT]

    Note :- If you are going to increase your "/system" partition then you'll have to format the 3 partitions,
    and if you just want to increase the "/data" partition then just include the lines for formatting "/cache" and "/data".


    now save the "updater-script" file and replace it in the Flashable zip!!

    Or , you can use this sample flashable zip file.
    download it and put your EBR files in it!!!!
    edit the "updater-script" file according to your need and replace it in the Flashable zip!!

    copy the Flashable zip file to your external SDCard
    reboot to recovery
    select install from zip file and choose the flashable zip file
    Flash it.

    Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
    Just Flash any CWM/TWRP Flashable ROM available for your device!!
    Wipe Dalvik Cache if you haven't done it already!!
    reboot and see for yourself!!!

    Disclaimer :-
    I will not be in anyway responsible for any damage this might cause to your phone.
    if you'll follow the instructions correctly, then everything will be fine.


    10
    Mods :-

    Mod 1 :- RiTz_partition_mod_a116.zip
    /system = 900mb
    /data = 2gb
    Internal SDCard = 536mb


    Revert to stock/Original partition sizes :-
    RiTz_partition_mod_Revert_a116.zip

    If you want them resized according to your need then you can request it here or use this tutorial to do it yourself!!!
    4
    I know some people seem to be allergic to hex so I have put together the attached spreadsheet that should help.

    Enter your values and the size you want in the cells highlighted green and read out the required values in yellow.

    Brian
    3
    @keanu_ritz

    Hi.

    Original sizes are
    /system = 650mb
    /cache = 126mb
    /data = 1gb
    Internal SDcard = 1.77gb

    I want it changed to below
    /system = 700mb
    /cache = 126mb
    /data = 2gb
    Internal SDCard = remaining space i.e around 536mb

    Basically you had made /system= 900mb i want 200mb of that moved to Internal SDCard...

    Can you please do that for me ??

    ALso i have a 64GB card with around 1.5gb or 2gb sd-ext.... just for your info.

    regards
    Greg

    take complete backup of your phone before you try this.
    you will have to flash a new ROM after you flash this and you can't/shouldn't restore your old CWM/TWRP backup.

    attaching your requested file.