2015-08-17, 05:15
Tool tutorial guide how to repartition mt6732, mt6735, mt6752, mt6753
Preface
if you have a 64 bit chinaphone that is running android 4.4.4 or 5.0+ you may notice that the phone no longer uses the old MBR/EBR scheme when it comes to partitioning. luckily, a lot of the manufacturers are deciding to use a unified storage layout, like you see on the nexus phones, where you have a system partition and a userdata partition and the internal SD card is emulated... it is a folder in the userdata partition and is linked to the /sdcard folder. this has several benefits and several disadvantages to this. the main benefit is that since app storage is shared with data storage you have limitless room to install apps until your sdcard is full, you no longer have to worry about running out of application space while your internal data space remains near empty. the main downside is that the USB Storage option when you plug your phone is going to be gone. your only option for accessing data is going to be MTP. this is because the userdata partition (and therefore your emulated internal sd card) is formated as a linux file system, Ext4. android refuses to share this as a USB Thumbdrive, even if you are connecting to a linux computer.
anyway, as mentioned before, the phone no longer uses the MBR/EBR partition layout. if you inspect the sdcard, the phone has a true GUID partition table (which i will refer to as the GPT). this is really really really a good thing. you can read more about GPT partition tables here if you want but suffice to say, this is how modern partitioning is done on windows, mac, and unix computers.
so, why this tutorial? well some manufacturers have decided to stick with the old way of doing things. they are using the GPT partition table, but they are still splitting the phone in to a internal userdata partition and a seperate internal sd card. i'll tell you that it is a pain in the ass to change it to a unified storage solution. but with a little knowledge and a little hacking on the scatter file, it is quite easy to resize the internal storage so you can install more apps and shrink the near useless internal SD card partition.
requirements
you will need several things to do this:
procedure with example
first of all: i take no responsibility if you brick your device. this is a relitivly benign mod, but if it somehow fscks up your phone and you can't recover it, i will do my best to help, but i won't be buying you a new phone.
i am going to use the Kingzone Z1 for my example here. i'll add some pictures later if anyone needs it, but the code should be enough to let you figure it out.
after you have your backup and you downloaded and extracted your sp flashtool ROM image, open up the scatter file in a text editor. i use gedit whether i am on linux, windows, or a mac. i prefer it to notepad++. you can get it here . it doesn't much matter what you use, as long as it can read the file.
you want to search the file until you find the reference to the userdata partiton and the intsd partition. in the kingzone ROM it looks like this:
all address and sizes here are written in hex, so we are going to have to convert them to decimal, change them to whatever we want, then convert them back to hex.
lets look at the first value we need to change. if you look at the section titled - partition_index: SYS19 you will find that there is a directive partition_size: 0x100000000. this tells sp flash tool to make this partition called userdata, and have it have a size of 100000000 hex. if you go to we can easily convert the hex value, and we get 4294967296, which is 4.0 gb (4294967296/1204/1024/1024). easy enogh
important!!! do not make your internal storage size more then 12gb-ish. you need to have that internal sd card partition, and you do not have unlimited storage. out of the 16gb flash, you only have about 13gb left to split between app storage and the internal sd card. if you go to big you will either not be able to flash your phone, or you will bork it and and boot loop when you try to boot up.
so, lets say we thing 4gb is too small for apps, and we want more like 8gb available for apps. no problem. 4+4=8. then convert 8 gb to megabytes by multiplying it by 1024 three times: 8*1024*1024*1024 = 8589934592. now use that same to do a decimal to hex conversion, and you get: 200000000. so our first edit will be to replace the size of the partition_size: of the userdata section with 200000000 like so:
- partition_index: SYS19
partition_name: userdata
file_name: userdata.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x61000000
physical_start_addr: 0x61000000
partition_size: 0x200000000 <--edit here
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
now we have to move the intsd card partiton. you will see that it has two lines in it giving start addresses: linear_start_addr and physical_start_addr. the values that are given are already the same. this partition starts right after the end of the last partition. it is pretty easy to calculate. we will take the start address of the userdata partiton and add the size of the user data partiton. they are:
you can't just add hex straight (though in this case you can). so lets turn to this to do the addition for us. 61000000 + 200000000 = 261000000. it is a straight edit here, but if you have some hex numbers in there, it might not be so simple. anyway, we edit the intsd partition to have these values
- partition_index: SYS20
partition_name: intsd
file_name: fat_spare.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x261000000 <--edit 1
physical_start_addr: 0x261000000 <--edit 2
partition_size: 0x0
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
simple, hugh? now save your scatter file and start up sp flash tool. load your scatter file to flash your phone. the trick before flashing is you have to untick the box for "INTSD". why? well, in the Kingzone's case, it points to a file called fat_spare.img. this file is only 20676 bytes in size. but it is an Android Sparse Image File. what this means is that it is sort of a framework file. it contains a couple of bytes detailing the file system, how big it should be and what not, any small files that should be in there, but all of the blank space has been removed from it. if you convert this file to a regular filesystem image, it is 9gb in size. flash tool will try to flash this file, and it being 9gb, plus your new 8gb userdata partition (plus whatever else is on your phone), comes to over 17 gb. most likely your phone has a 16gb flash memory chip. so it will fail. sp flash tool will give you a warning about there not being enough room on your device, and you wont be happy. so just untick the intsd partition. it will still be created, and it will automatically be sized for whatever space is left. it will just be empty.
future
since the phone uses a GPT instead of MBR, live resizing of the partitions should be possible. i do it all the time on my raspberry pi's, without any data loss. a couple of guys and i have been working on this over at XDA with a flashable zip, but so far we haven't had any luck. if you want to try any of the beta zips, follow the thread at . there are some beta zips you can try, but either they have produced bricks or they have not modified storage. either way, it is going to work eventually, and i'll update this post when it does.
support
i hope i have been clear in this tutorial. if you have any questions, feel free to ask. if your scatter is different, and you need help modifing it, let me know, post it here, etc, and i will give it a go!
good luck!!
Preface
if you have a 64 bit chinaphone that is running android 4.4.4 or 5.0+ you may notice that the phone no longer uses the old MBR/EBR scheme when it comes to partitioning. luckily, a lot of the manufacturers are deciding to use a unified storage layout, like you see on the nexus phones, where you have a system partition and a userdata partition and the internal SD card is emulated... it is a folder in the userdata partition and is linked to the /sdcard folder. this has several benefits and several disadvantages to this. the main benefit is that since app storage is shared with data storage you have limitless room to install apps until your sdcard is full, you no longer have to worry about running out of application space while your internal data space remains near empty. the main downside is that the USB Storage option when you plug your phone is going to be gone. your only option for accessing data is going to be MTP. this is because the userdata partition (and therefore your emulated internal sd card) is formated as a linux file system, Ext4. android refuses to share this as a USB Thumbdrive, even if you are connecting to a linux computer.
anyway, as mentioned before, the phone no longer uses the MBR/EBR partition layout. if you inspect the sdcard, the phone has a true GUID partition table (which i will refer to as the GPT). this is really really really a good thing. you can read more about GPT partition tables here if you want but suffice to say, this is how modern partitioning is done on windows, mac, and unix computers.
so, why this tutorial? well some manufacturers have decided to stick with the old way of doing things. they are using the GPT partition table, but they are still splitting the phone in to a internal userdata partition and a seperate internal sd card. i'll tell you that it is a pain in the ass to change it to a unified storage solution. but with a little knowledge and a little hacking on the scatter file, it is quite easy to resize the internal storage so you can install more apps and shrink the near useless internal SD card partition.
requirements
you will need several things to do this:
- a mediatek based android phone that has split storage running android 4.4.4 or more
- a current version of spflash tools
- a copy of your ROM for your phone that can be flashed with spflashtool
- experience flashing ROMs (this isn't difficult, but it isn't for the faint of heart)
- a recent backup (we will be wiping out everything on your phone, so you will have to restore your apps/data when you are done)
- a calculator that can convert hex to decimal and vice versa.
procedure with example
first of all: i take no responsibility if you brick your device. this is a relitivly benign mod, but if it somehow fscks up your phone and you can't recover it, i will do my best to help, but i won't be buying you a new phone.
i am going to use the Kingzone Z1 for my example here. i'll add some pictures later if anyone needs it, but the code should be enough to let you figure it out.
after you have your backup and you downloaded and extracted your sp flashtool ROM image, open up the scatter file in a text editor. i use gedit whether i am on linux, windows, or a mac. i prefer it to notepad++. you can get it here . it doesn't much matter what you use, as long as it can read the file.
you want to search the file until you find the reference to the userdata partiton and the intsd partition. in the kingzone ROM it looks like this:
Code:
- partition_index: SYS19
partition_name: userdata
file_name: userdata.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x61000000
physical_start_addr: 0x61000000
partition_size: 0x100000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS20
partition_name: intsd
file_name: fat_spare.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x161000000
physical_start_addr: 0x161000000
partition_size: 0x0
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
all address and sizes here are written in hex, so we are going to have to convert them to decimal, change them to whatever we want, then convert them back to hex.
lets look at the first value we need to change. if you look at the section titled - partition_index: SYS19 you will find that there is a directive partition_size: 0x100000000. this tells sp flash tool to make this partition called userdata, and have it have a size of 100000000 hex. if you go to we can easily convert the hex value, and we get 4294967296, which is 4.0 gb (4294967296/1204/1024/1024). easy enogh
important!!! do not make your internal storage size more then 12gb-ish. you need to have that internal sd card partition, and you do not have unlimited storage. out of the 16gb flash, you only have about 13gb left to split between app storage and the internal sd card. if you go to big you will either not be able to flash your phone, or you will bork it and and boot loop when you try to boot up.
so, lets say we thing 4gb is too small for apps, and we want more like 8gb available for apps. no problem. 4+4=8. then convert 8 gb to megabytes by multiplying it by 1024 three times: 8*1024*1024*1024 = 8589934592. now use that same to do a decimal to hex conversion, and you get: 200000000. so our first edit will be to replace the size of the partition_size: of the userdata section with 200000000 like so:
- partition_index: SYS19
partition_name: userdata
file_name: userdata.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x61000000
physical_start_addr: 0x61000000
partition_size: 0x200000000 <--edit here
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
now we have to move the intsd card partiton. you will see that it has two lines in it giving start addresses: linear_start_addr and physical_start_addr. the values that are given are already the same. this partition starts right after the end of the last partition. it is pretty easy to calculate. we will take the start address of the userdata partiton and add the size of the user data partiton. they are:
Code:
physical_start_addr: 0x61000000
partition_size: 0x200000000
you can't just add hex straight (though in this case you can). so lets turn to this to do the addition for us. 61000000 + 200000000 = 261000000. it is a straight edit here, but if you have some hex numbers in there, it might not be so simple. anyway, we edit the intsd partition to have these values
- partition_index: SYS20
partition_name: intsd
file_name: fat_spare.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x261000000 <--edit 1
physical_start_addr: 0x261000000 <--edit 2
partition_size: 0x0
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
simple, hugh? now save your scatter file and start up sp flash tool. load your scatter file to flash your phone. the trick before flashing is you have to untick the box for "INTSD". why? well, in the Kingzone's case, it points to a file called fat_spare.img. this file is only 20676 bytes in size. but it is an Android Sparse Image File. what this means is that it is sort of a framework file. it contains a couple of bytes detailing the file system, how big it should be and what not, any small files that should be in there, but all of the blank space has been removed from it. if you convert this file to a regular filesystem image, it is 9gb in size. flash tool will try to flash this file, and it being 9gb, plus your new 8gb userdata partition (plus whatever else is on your phone), comes to over 17 gb. most likely your phone has a 16gb flash memory chip. so it will fail. sp flash tool will give you a warning about there not being enough room on your device, and you wont be happy. so just untick the intsd partition. it will still be created, and it will automatically be sized for whatever space is left. it will just be empty.
future
since the phone uses a GPT instead of MBR, live resizing of the partitions should be possible. i do it all the time on my raspberry pi's, without any data loss. a couple of guys and i have been working on this over at XDA with a flashable zip, but so far we haven't had any luck. if you want to try any of the beta zips, follow the thread at . there are some beta zips you can try, but either they have produced bricks or they have not modified storage. either way, it is going to work eventually, and i'll update this post when it does.
support
i hope i have been clear in this tutorial. if you have any questions, feel free to ask. if your scatter is different, and you need help modifing it, let me know, post it here, etc, and i will give it a go!
good luck!!