How to Edit EBR Files and Change Partition Size in MediaTek Phones

May 21, 2018 | Author: asiasi | Category: Secure Digital, Flash Memory, Booting, Backup, Android (Operating System)


Comments



Description

Object 42 How to edit EBR files and change partition size in MediaTek phones Many android user faces low storage problem after installing few apps even if they have huge free space in internal SD card. Some people may recommend to move apps to external SD card but that too doesn’t solve the problem because only apk file can be moved to SD card and not the data. Moving apk with app data requires link2sd app and 2nd partition of SD card and can be done in rooted phones only. Using link2sd can decrease SD Object 5 1 3 card read/write life and it can also affect phone performance. Apps linked to SD card using link2sd won’t work after removing SD card or if SD card stops functioning. So, what is the permanent solution to low app storage? The only answer is repartition i.e. defining new partition size for app storage. If your phone has 1 GB for app storage and 1 GB for file storage then we can create new partition by increasing app storage to 1.5 GB and decreasing file storage to 0.5 GB. I’m going to show you how to do repartition in simple steps. This guide is for MediaTek phones only which have separate partition for app storage and internal SD card. This guide is for ROM partition and has no connection with RAM or external SD card. Repartition doesn’t require rooted phone. This guide is for advanced users and may cause soft brick if not done properly. Do this only if you know how to flash ROM using sp flash tool. I’ll not be responsible for any damage caused to your device. I have seen many noobs getting trained by reading tutorials from different sources. They create mods using other’s guide and give credits to themselves. If you’re one of them then stop reading now. Or if you want to create mod using this tutorial then give proper credits to me (Qamrul Haque) with source link to this page. Requirements: • Cygwin (Download | Instructions) • SP flash tool (Download) • HxD Hex Editor (Download) • Notepad++ (Download) • Programmer & Scientific Calculator (Built-in with Windows OS) • MBR, EBR1, EBR2 & Scatter file (Get these from ReadBack backup) Recommended Backups: • ReadBack backup • Nandroid backup • NVRAM backup Some phones contain two EBRs i.e. EBR1 and EBR2. Some phones contain only 1 EBR i.e. EBR1. If your phone have two EBRs then there’s no need of MBR but if your phone have only one EBR then you might need to edit MBR. Here I’m using EBR1 and EBR2 of Micromax A106 Unite 2. Republishing any post from DroidGyan.com to any other blog or forum without author’s permission is strictly prohibited. Steps for editing EBRs: Step 1: Copy EBR files to the user directory or current working directory of cygwin Step 2: Open cygwin terminal and type ls and hit enter key to make sure files are copied to correct location. If files aren’t showing then type pwd to see the current working directory path. Step 3: Type file EBR1 and hit enter key. Again type file EBR2 and hit enter key. Now copy results to notepad++. Step 4: Arrange each partition detail in a separate line as shown below Copy values in red as shown in below screenshot: . CACHE and USRDATA from scatter file and paste in notepad++ below EBR1 and EBR2.Step 5: Now copy partition_name and partition_size of ANDROID. Paste above values in notepad++ as shown below: . In EBR. So we have to convert Bytes to sectors.e. partition size is given in sectors and in scatter file partition size is given in Bytes (hexadecimal). CACHE and USRDATA. partition 2 in EBR1.e. partition 3 in EBR1. c) USRDATA partition 1892352 sectors i. ANDROID is partition 1 in EBR1. a) Find ANDROID partition size in hexadecimal = 0x38400000 size in decimal = 943718400 943718400 / 512 = 1843200 sectors So. To do this first convert hexadecimal value to decimal and then divide decimal value by 512. b) CACHE partition 258048 sectors i.Step 6: Now lets find which partition in EBR1 and EBR2 is ANDROID. . Step 7: Now we know that partition 1 is system partition. Step 9: Now decide how much app storage you want in GB or MB and convert it to sectors. Now write partition name right to all partitions to identify them. Here I’m showing how to convert GB to sectors: . If you don’t have EBR2 then next partition after USRDATA in EBR1 will be the internal SD. We only want to increase app partition size by decreasing internal SD card. Step 8: Lets understand the sectors in EBR1 and EBR2. partition 2 is cache partition and partition 3 is app partition.e. Partition 1 of EBR2 starts from sector (2267136 + 1892352) – 144384 = 4015104 To increase app storage we need to increase total sectors of partition 3 in EBR1 and startsector of partition 1 in EBR2. Partition 4 is a link to EBR2 and its startsector is 144384. partition 1 in EBR2. We don’t need to edit other sectors if we’re not changing system and cache partitions. Partition 2 starts from sector 165888 + 1843200 = 2009088 and its total size is 258048 sectors. Partition 1 starts from sector 165888 and its total size is 1843200 sectors. Partition 3 starts from sector 2009088 + 258048 = 2267136 and its total size is 1892352 sectors. Internal SD partition is the last partition i. 1 GB = 1024 MB = 1048576 KB = 1073741824 Bytes = 2097152 sectors.e. You can use scientific calculator for this.5 GB = 3145728 sectors 2 GB = 4194304 sectors 2. i. 1. 1 GB = ((1 x 1024 x 1024 x 1024) / 512) sectors.5 GB to 6 GB.5 GB = 5242880 sectors . Here I’m giving some values from 1. 5 GB = 7340032 sectors 4 GB = 8388608 sectors 4.3 GB = 6291456 sectors 3. write new partition in notepad++ in a separate line. Also replace default startsector of internal SD with new startsector using below formula: (startsector of partition 3 + new size of partition 3) – startsector of partition 4 = new startsector of SD card i.5 GB = 11534336 sectors 6 GB = 12582912 sectors Step 10: After deciding required app storage. (2267136 +5242880) – 144384 = 7365632 . Here I’m going to increase app partition from default 924 MB to 2. To do this I’ve to replace 1892352 sectors with new 5242880 sectors.5 GB = 9437184 sectors 5 GB = 10485760 sectors 5.5 GB.e. Step 11: Open EBR1 and EBR2 in HxD Hex Editor. . The rows to be copied are shown in red. 4th last row is partition 1. . Copy those two rows in notepad++. 3rd last row is partition 2. 2nd last row of EBR1 and partition 1 i. 2nd last row is partition 3 and last row is partition 4. 4th last row of EBR2.e. As we’re changing only app and SD card partition so we only need partition 3 i.Step 12: The last 4 rows are the partitions so we only need those rows.e. . We only need to edit these hex numbers.Step 13: Underline 11th to 14th hex bytes in EBR1 and 7th to 10th hex bytes in EBR2 as shown in below screenshot. The underlined hex numbers in EBR1 is the total sectors of app partition and underlined hex numbers in EBR2 is the startsector of SD card partition. . 5242880 sectors (decimal) = 500000 sectors (hex) 7365632 sectors (decimal) = 706400 sectors (hex) As I said earlier bytes in hex editor is in little endian order so we have to reverse the bytes. 00 E0 1C 00 = 00 1C E0 00 and.Step 14: The bytes in hex editor are in little endian order so we have to reverse them to get the original number. open notepad++ and convert new sectors (which we got from step 10) to hex using programmer calculator. . 00 44 3D 00 = 00 3D 44 00 Now. So. That is. 00 70 64 00 = 00 64 70 00 This is the final value. replace 00 44 3D 00 with 00 64 70 00 Step 15: Open hex editor. replace 00 E0 1C 00 with 00 00 50 00 and.So. 00 50 00 00 = 00 00 50 00 and. write new values in EBR1 and EBR2 and save file. Here is the new EBR1 and EBR2: . We’ve to replace hex values which we underlined in step 13 with above hex values. . Flashing only EBRs using “Download only” option in sp flash tool may also work in some cases but it is always recommended to flash fresh ROM by replacing old EBRs and scatter file with new EBRs and scatter file. . Follow below steps to edit scatter file for new partition size. cache or any other partition then start from that partition instead of USRDATA. Step 16: Open scatter file in notepad++ and find partition_name: USRDATA. If you have changed size for system.Editing scatter file: After you have completed EBR editing you have to edit scatter file to flash firmware with new partition. Step 18: Now change linear_start_addr and physical_start_addr of next partitions (except BMTPOOL).5 x 1024 x 1024 x 1024 = 2684354560 Bytes (decimal) 2684354560 Bytes (decimal) = A0000000 Bytes (hex) Now add 0x in front of A0000000 i.e 0xA0000000 and write this value in partition_size of USRDATA (or whatever partition you have edited).5 GB = 2. I have changed partition_size (total sectors) of USRDATA only so .Step 17: Convert the new partition size from GB or MB to Bytes in hexadecimal. I’m showing how to convert GB to Bytes: 2. So. If you have changed total sectors in EBR/MBR then change partition_size as shown in step 17. linear_start_addr + partition_size = linear_start_addr of next partition physical_start_addr + partition_size = physical_start_addr of next partition .I’m not changing partition_size of other partitions. In my scatter file the next partitions after USRDATA are FAT and BMTPOOL. I have to change linear and physical start address of FAT only. scatter file and flash ROM through sp flash tool using “Firmware upgrade” option.Step 19: Save your scatter file.com). Unzip downloaded file . Flashing EBRs from custom recovery: Download Repartition_Mod_by_Qamrul_Haque(droidgyan. Replace old EBR/MBR.zip Download from Android file host Download from Google Drive Creating flashable zip: 1. scatter file with new EBR/MBR. Flashing EBRs using sp flash tool: Please follow this GUIDE to flash firmware with new EBRs and scatter file. zip using 7-Zip and keep zip file in sdcard Flashing steps if you have edited data partition only: 1. Wipe /data. Flash repartition zip 3.agung whose guide helped me to understand EBRs.droidgyan. Reboot to custom recovery 2. 2. /cache. Credits: Qamrul Haque Special thanks to tirta.com/edit-ebr-files-and-change-partition-size-in- mediatek-phones/ . copy your edited EBRs/MBR in unzipped folder 4. Read more https://www. /cache and dalvik-cache (can be skipped if you don’t face any force-close or other storage problems after starting phone). Flash repartition zip 4. Take nandroid backup 3. Flashing steps if you have edited system partition: 1. Restore nandroid backup Flashing EBRs from recovery may not work in some phones or ROMs. Compress files to . Reboot to custom recovery 2. If it doesn’t work then try flashing from sp flash tool using firmware upgrade. /system and dalvik-cache 5. Wipe /data. delete EBR1 and EBR2 from unzipped folder 3. Nandroid backup is very useful in case of soft brick. It is recommended to create NVRAM backup and nandroid backup in rooted phones asap.Love You need: • Custom recovery To create nandroid backup follow these steps: Step 1: Make sure at least 3-4 GB space is free in external sd card. 3 GB or even more depending on installed apps and data size. The backup size can be 2 GB.Before flashing • Make nandroid backup • Make NVRAM backup • Backup all files from internal memory • Make titanium backup • Charge phone at least 60% How to create Nandroid backup from custom recovery Nandroid backup is full backup of current ROM. Step 2: Reboot to recovery Step 3: Go to backup and restore . patch or repartition. Nandroid backup must be created before flashing new rom. Step 4: Select backup . . If shows error while backing up data then reboot phone and delete unsuccessful backup from clockworkmod folder and delete some more files to free space in sd card. Repeat from step 1.Step 5: Wait for backup to complete. You can also use this nandroid backup to revert back from new ROM. .Step 6: You’ll see Backup Complete! after successful backup. Now you can use this backup to restore system if you face any error in future like bootloop or soft brick. The backup is stored in clockworkmod folder in external SD card. Warning: Never try to edit nandroid backup files. Read more https://www. Keep nandroid backup in SD card as it is.droidgyan.com/nandroid-backup/ . Tips: Don’t forget to delete old nandroid backup after taking new backup. You can also keep two or more nandroid backups for safety. IMEI can be restored even if you don’t have backup by using apps like chamelephon. If your phone doesn’t connect to network or wifi then you have to restore the NVRAM backup. . Requirements: •MediaTek Drivers (Download | How to install Drivers) •ADB Drivers for Lollipop (Guide) •MTKDroidTools (Download) •Busybox (install from play store) •Rooted MediaTek phone Steps to create NVRAM backup: Step 1: In your phone go to Settings -> Developer Options and select USB debugging. etc. Without IMEI phone can’t connect to network. Keeping backup is always a good idea. mobileuncle tools. Sometimes flashing ROMs.How to create NVRAM / IMEI backup with MTK Droid tools NVRAM backup is the backup of NVRAM partition which contains the IMEI number and other network info. IMEI can be restored permanently by restoring the backup from MTK droid tools. recoveries or formatting phone may corrupt NVRAM partition which results into invalid IMEI. But these apps will write IMEI temporarily. If there is no Developer Options in Settings then go to About phone and tap Build number 7 times to enable Developer Options. . Step 3: In MTKdroidTools click ROOT button and grant root permission if asked in phone. .Step 2: Open MTKdroidTools and connect your phone to PC via USB cable. .Step 4: Click IMEI/NVRAM button in MTK droid tools. Step 5: Click Backup button in MTK droid tools to start backup. . After completion you can find your backup files in the MtkDroidToolsBackupNVRAM folder. The backup size can be 1 GB. 2 GB or even more depending on how many apps you have installed. call logs. Titanium backup pro (Play store) 2. Wi-Fi access points. MMS. Titanium backup is one of the most useful app for advanced android users specially for custom rom users who change their roms regularly.droidgyan. SMS. accounts.com/nvram-backup/ [Titanium Backup] How to make backup of all apps and system data Titanium backup is the most powerful backup tool on Android. bookmarks. .Also check: How to restore NVRAM / IMEI backup using MTK Droid tools Read more https://www. Rooted Android phone Follow these steps to make titanium backup of all user apps and system data: Step 1: Make sure at least 3 GB space is free in your external SD card. You can backup and restore apps + data.You need: 1. Titanium backup is very useful app to take backup of your apps and data. You can also restore individual apps. Titanium backup is very useful in case you flash new rom and want to restore all user apps with data. Titanium backup can be used to restore apps+data in new roms. etc. Step 2: Go to Settings -> Security and disable App permissions or open App permissions and select Always allow for all permissions of Titanium Backup OR . Step 3: Open Titanium Backup and tap the tick mark icon in top right corner next to search icon or press menu key and select Batch actions Step 4: Tap RUN in Backup all user apps + system data option . Tap the tick mark icon in top right corner to start backup .Step 5: You can unselect any app which you don’t want to backup. img on your phone can refuse it to boot ! cache.img : boot.com/titanium-backup/ And what does each image do ? Boot. Having a wrong Boot. if you get a checksum error before flashing. you should reflash and check those files.img contains the kernel and ramdisk. not really needed and should be unticked when trying to flash a device. Uboot and BootIMG are important files on your phone.img Contains the cache data where Android stores frequently accessed data and app components. You can also edit the size of them. targeting different platforms including ARM. EBR2 Are your partitions. Checksum.Step 6: Wait for backup to complete. UBOOT (LK.BIN) U-Boot is an universal boot loader for embedded systems. Logo. just delete it Wink EBR1. If your device is not booting or your display is not working ( black or stripes ) .bin As the name suggests.ini verifies md5 checksum . this is your bootlogo Happy It can be changed using this tutorial . critical files necessary to load the device before the filesystem can be mounted.droidgyan. You will see a notification Batch backup finished when titanium backup finishes successfully Read more https://www. 1+2 Means 2 Partitions. It must be "tailored" to each device. MBR is generally referred to as first sector (size : 512 bytes) of any partitioned drive whereas volume or partition boot record holds code to initiate booting and is invoked by MBR.img Thats you recovery. but you can create your own CWM recovery using MTK droid tools. this partition will wipe out. Recovery. Preloader : this is really important. But anyway you have to restore your IMEI too. just be sure to have a backup when you try them Happy User Data : Contains your personal data (do not share it with a backup) So this partition contains the user’s data like your contacts. so be careful ! Never flash the preloader if not needed. Secro. While you are doing factory reset on your device. Even when you think your phone is bricked.MBR Stands for Master-Boot-Record.img As the name suggests. Then your device will be in the state. or the way it was after the last official or custom ROM installation. I hope this helps you to understand the rom structure Br Umesh Gaba . You need to reflash it to rebuild the structure. Scatter File : Scatter is a file which is used to describe the loads of regions in a specific android device running MediaTeks ARM architecture. this partition contains the entire Android OS. System.img Is an important file for the baseband and the IMEI. Due to the preloader your phone should be detected as a port on your pc and should be flashable. when you use for he first time. There are different states of the pre-loader (like META Mode). sms. Downloading a wrong pre-loader can brick your phone . The preloader communicates with your PC. it defines your partitions. You cant flash a recovery image from a different device. It´s needed when you want to flash your device. So in short words. mostly you can revive it.img from other phones without a problem. You can try different system. Bascially it tells the flash tool where to flash each image. settings and all android applications that you have installed.
Copyright © 2024 DOKUMEN.SITE Inc.