How to make a backup of an Android device before flashing the firmware. How to make a backup of an Android device before flashing the firmware Unknown rom structure backup is impossible

Hello, Habrakhabr.

general information

This guide is designed to help you create a full backup of your device (entire memory with all partitions) or a single partition (including sdcards, etc.) directly to your computer:
  • At the Memory Block level (using the dd command): for individual sections or the entire memory (all sections). Backup copy will always have the same size as the partition being saved.
  • At the File level (using the tar command): only for individual partitions. The copy will only contain files and folders that exist on the device, thus taking up much less space, depending on how full the partition is.

These instructions are applicable when the device is turned on or is in ClockworkMod Recovery (in these cases, ADB will work in Fastboot mode this instruction not applicable). Unless otherwise noted, all commands are intended for use on Windows. The same applies to Linux and Unix.

Requirements

  • Rooted Android device;
  • Busybox installed on the device;
  • If you are using Linux / OS X, you already have necessary tools, for Windows, download Cygwin and install netcat, pv and util-linux with it, selecting them during installation (I’ll add that it’s better to use the terminal from Cygwin mintty.exe than the native Windows cmd.exe, since the copying speed for the first one it reached 3-4 MB/s, and for cmd.exe - a maximum of 400 kB/s);
  • ADB installed;
  • Make sure adb.exe is in your PATH variable. Look and, or use Path Manager;
  • Enabled USB debugging mode on the device and the corresponding drivers installed in Windows. Typing "adb devices" in the terminal should show your device.

Partitions in the device

Now you need to identify the partitions and blocks on your device that you want to make a copy of. To copy a single partition, you can use the tar or dd commands, while to copy entire memory, you need to use only dd.

On Teclast x98 3g To define partitions, two commands are used: cat proc/partitions and mount.

An example of what should appear in response to their input in the terminal.

127|root@android:/ # mount
mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
[b]/dev/block/mmcblk0p9 /system ext4 ro,noatime,data=ordered 0 0
/dev/block/mmcblk0p7 /cache ext4 rw,nosuid,nodev,noatime,data=ordered 0 0
/dev/block/mmcblk0p6 /config ext4 rw,nosuid,nodev,noatime,data=ordered 0 0
/dev/block/mmcblk0p10 /data ext4 rw,nosuid,nodev,noatime,noauto_da_alloc,data=ordered 0 0
/dev/block/mmcblk0p8 /logs ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
tmpfs /mnt/libreg tmpfs rw,noexec,noatime,size=4k,mode=700,gid=1003 0 0
/dev/block/vold/179:1 /storage/sdcard_ext fuseblk rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096 0 0
root@android:/ # cat proc/partitions
cat proc/partitions
major minor #blocks name

179 10 30535680 mmcblk0
179 11 229376 mmcblk0p1
179 12 32768 mmcblk0p2
179 13 32768 mmcblk0p3
179 14 131072 mmcblk0p4
179 15 131072 mmcblk0p5
179 16 131072 mmcblk0p6
179 17 786432 mmcblk0p7
179 18 262144 mmcblk0p8
179 19 1048576 mmcblk0p9
259 0 27742188 mmcblk0p10
179 30 2048 mmcblk0boot1
179 20 2048 mmcblk0boot0
179 0 30657536 mmcblk1
179 1 30657504 mmcblk1p1

Typically on Android, the entire block containing all the partitions is located in /dev/block/mmcblk0, and all other partitions are subsections of it. You can install parted with GPT support to view information about all partitions.

All phone memory -> /dev/block/mmcblk0 (although on some phones this may also be an sdcard).
Partitions -> it all depends on the specific device. Typically /dev/block/platform/dw_mmc/by-name/ lists all partitions for a given device.

Backup all memory (via adb)

Connect your phone with USB debugging mode enabled to your computer.

Concerning Teclast x98 3g and the case when the device does not boot (bootloop). It is very important that USB debugging mode is enabled before all this happens. Turn off the tablet completely, disconnect all cables, give a couple of seconds to “rest” and connect the cable from the computer to the tablet, such a large white battery should appear that will indicate that the charging process is in progress, only then, even in the off state, you can work with the device via the terminal and adb.

Launch Cygwin Terminal and enter (replace mmcblk0 if necessary):

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0

You will see a blinking cursor on the next line on the left. At the moment, the device is waiting for the Block to be transmitted over the network.

adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw

You will see the file size begin to increase until the entire Block you selected is copied. Now you have a complete backup of the device in raw format. You can see all the contents in the copied Block using gptfdisk, available for Windows, Linux and other OS (official website or). You can do the same using ClockworkMod Recovery, but initially you need to mount the /system partition, since BusyBox, included in ClockworkMod, does not have netcat, so you need to use netcat from the /system partition of your device.

With the help of certain tools in Linux, you can modify and extract the required Sections from the entire Block.

You can use ADB over WiFi, similar to Wi-Fi ADB.

Backup all memory (via WiFi)

Link to author: Nandroid directly to computer w/o sdcard.

Necessary:

  • Installed FTP server on a computer or other device;
  • User with password;
  • Installed port for FTP servers, default is 21, but in in this example used 40;
  • Home directory of the user with write rights.

A good rule of thumb is to copy myfifo to /cache and not to /data, since you can accidentally overwrite important data if you use raw data for recovery.

Launch Cygwin Terminal and enter:

adb shell
su
mkfifo /cache/myfifo
ftpput -v -u user -p pass -P 40 COMPUTER_IP block.raw /cache/myfifo

Open another Cygwin Terminal and type:

adb shell
su
dd if=/dev/block/mmcblk0p12 of=/cache/myfifo

Some notes:

  • FIFOs can only be made on Linux Native file systems; FAT is not suitable for this;
  • The process of reading a Partition from a device does not modify it in any way.

Backup all memory (via USB tethering or Wi-Fi tethering)

To do this, you need to disconnect all network connections on the computer, except for the one with which you will carry out the copying process.
As soon as you connect your computer to your Android device, you can view the IP of the computer and the IP of the device in the “Connection Properties”. IP - will be the IP of the computer itself, and Gateway will contain the IP of the Android device.
  • Wi-Fi modem: Computer< - Wi-Fi --->Android device< - 3G --->Internet
  • USB modem:
    Computer< - USB --->Android device< - Wi-Fi --->Internet
    Computer< - USB --->Android device< - 3G --->Internet

The process is absolutely similar to transferring data via Wi-Fi, the only thing is that the data transfer speed will be much higher because the computer and Android device are connected directly, instead of using the router as a gateway. In this case, the gateway will be the Android device itself. The USB modem has the most high level data transmission.

Backup one Partition (raw = exact bit-by-bit copy of the partition)

Everything is similar to what was described above, only you need to replace mmcblk0 with the appropriate Section. In this particular case, you can use software to view the contents of the copied Section. Depending on the file system: DiskInternals Linux Reader, plugin for Total Commander and ImDisk Virtual Disk Driver. You can also use software to recover data from individual partitions, for example, Recuva together with VHD Tool or tools command line, included in the operating systems themselves.

Backup one Partition (tar = only files and folders are copied)

In this case, an already mounted partition is required. (I described above how to find partitions on Teclast x98 3g.)
To see a list of all mounted partitions in Cygwin Terminal, enter:

Now you should know where and what partition is mounted, for example, Firmware is mounted in /system, which is essentially a ROM.
In this case, you will have to open three Cygwin Terminals, due to restrictions imposed by Android itself:

Open the first Cygwin Terminal and create a FIFO, for example in /cach, and redirect tar to it:

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox mkfifo /cache/myfifo
/system/xbin/busybox tar -cvf /cache/myfifo /system

You have to do this because redirecting tar to stdout (with "-") does not work on Android and corrupts the saved file.

Open a second Cygwin Terminal:

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox cat /cache/myfifo

Open a third Cygwin Terminal:

adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > system.tar

You can view the resulting tar file using Winrar, Total Commander, PeaZip, etc. Please note that you should not extract files or edit them, as the tar format retains access and owner data for each file, which disappears when extracted to FAT/NTFS partitions.

Tags: Add tags

Hello, Habrakhabr.

general information

This guide is designed to help you create a full backup of your device (entire memory with all partitions) or a single partition (including sdcards, etc.) directly to your computer:
  • At the Memory Block level (using the dd command): for individual sections or the entire memory (all sections). The backup copy will always have the same size as the partition being saved.
  • At the File level (using the tar command): only for individual partitions. The copy will only contain files and folders that exist on the device, thus taking up much less space, depending on how full the partition is.

This instruction is applicable when the device is turned on or is in ClockworkMod Recovery (in these cases, ADB will work; in Fastboot mode, this instruction is not applicable). Unless otherwise noted, all commands are intended for use on Windows. The same applies to Linux and Unix.

Requirements

  • Rooted Android device;
  • Busybox installed on the device;
  • If you are using Linux / OS X, you already have the necessary tools, for Windows download Cygwin and install netcat, pv and util-linux with it, selecting them during installation (I will add that it is better to use the terminal from Cygwin mintty. exe than the native Windows cmd.exe, since the copying speed of the first reached 3-4 MB/s, and that of cmd.exe - a maximum of 400 kB/s);
  • ADB installed;
  • Make sure adb.exe is in your PATH variable. Look and, or use Path Manager;
  • Enabled USB debugging mode on the device and the corresponding drivers installed in Windows. Typing "adb devices" in the terminal should show your device.

Partitions in the device

Now you need to identify the partitions and blocks on your device that you want to make a copy of. To copy a single partition, you can use the tar or dd commands, while to copy entire memory, you need to use only dd.

On Teclast x98 3g To define partitions, two commands are used: cat proc/partitions and mount.

An example of what should appear in response to their input in the terminal.

127|root@android:/ # mount
mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
[b]/dev/block/mmcblk0p9 /system ext4 ro,noatime,data=ordered 0 0
/dev/block/mmcblk0p7 /cache ext4 rw,nosuid,nodev,noatime,data=ordered 0 0
/dev/block/mmcblk0p6 /config ext4 rw,nosuid,nodev,noatime,data=ordered 0 0
/dev/block/mmcblk0p10 /data ext4 rw,nosuid,nodev,noatime,noauto_da_alloc,data=ordered 0 0
/dev/block/mmcblk0p8 /logs ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
tmpfs /mnt/libreg tmpfs rw,noexec,noatime,size=4k,mode=700,gid=1003 0 0
/dev/block/vold/179:1 /storage/sdcard_ext fuseblk rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096 0 0
root@android:/ # cat proc/partitions
cat proc/partitions
major minor #blocks name

179 10 30535680 mmcblk0
179 11 229376 mmcblk0p1
179 12 32768 mmcblk0p2
179 13 32768 mmcblk0p3
179 14 131072 mmcblk0p4
179 15 131072 mmcblk0p5
179 16 131072 mmcblk0p6
179 17 786432 mmcblk0p7
179 18 262144 mmcblk0p8
179 19 1048576 mmcblk0p9
259 0 27742188 mmcblk0p10
179 30 2048 mmcblk0boot1
179 20 2048 mmcblk0boot0
179 0 30657536 mmcblk1
179 1 30657504 mmcblk1p1

Typically on Android, the entire block containing all the partitions is located in /dev/block/mmcblk0, and all other partitions are subsections of it. You can install parted with GPT support to view information about all partitions.

All phone memory -> /dev/block/mmcblk0 (although on some phones this may also be an sdcard).
Partitions -> it all depends on the specific device. Typically /dev/block/platform/dw_mmc/by-name/ lists all partitions for a given device.

Backup all memory (via adb)

Connect your phone with USB debugging mode enabled to your computer.

Concerning Teclast x98 3g and the case when the device does not boot (bootloop). It is very important that USB debugging mode is enabled before all this happens. Turn off the tablet completely, disconnect all cables, give a couple of seconds to “rest” and connect the cable from the computer to the tablet, such a large white battery should appear that will indicate that the charging process is in progress, only then, even in the off state, you can work with the device via the terminal and adb.

Launch Cygwin Terminal and enter (replace mmcblk0 if necessary):

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0

You will see a blinking cursor on the next line on the left. At the moment, the device is waiting for the Block to be transmitted over the network.

adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw

You will see the file size begin to increase until the entire Block you selected is copied. Now you have a complete backup of the device in raw format. You can see all the contents in the copied Block using gptfdisk, available for Windows, Linux and other OS (official website or). You can do the same using ClockworkMod Recovery, but initially you need to mount the /system partition, since BusyBox, included in ClockworkMod, does not have netcat, so you need to use netcat from the /system partition of your device.

With the help of certain tools in Linux, you can modify and extract the required Sections from the entire Block.

You can use ADB over WiFi, similar to Wi-Fi ADB.

Backup all memory (via WiFi)

Link to author: Nandroid directly to computer w/o sdcard.

Necessary:

  • Installed FTP server on a computer or other device;
  • User with password;
  • The set port for the FTP server is 21 by default, but in this example 40 is used;
  • Home directory of the user with write rights.

A good rule of thumb is to copy myfifo to /cache and not to /data, since you can accidentally overwrite important data if you use raw data for recovery.

Launch Cygwin Terminal and enter:

adb shell
su
mkfifo /cache/myfifo
ftpput -v -u user -p pass -P 40 COMPUTER_IP block.raw /cache/myfifo

Open another Cygwin Terminal and type:

adb shell
su
dd if=/dev/block/mmcblk0p12 of=/cache/myfifo

Some notes:

  • FIFOs can only be made on Linux Native file systems; FAT is not suitable for this;
  • The process of reading a Partition from a device does not modify it in any way.

Backup all memory (via USB tethering or Wi-Fi tethering)

To do this, you need to disconnect all network connections on the computer, except for the one with which you will carry out the copying process.
As soon as you connect your computer to your Android device, you can view the IP of the computer and the IP of the device in the “Connection Properties”. IP - will be the IP of the computer itself, and Gateway will contain the IP of the Android device.
  • Wi-Fi modem: Computer< - Wi-Fi --->Android device< - 3G --->Internet
  • USB modem:
    Computer< - USB --->Android device< - Wi-Fi --->Internet
    Computer< - USB --->Android device< - 3G --->Internet

The process is absolutely similar to transferring data via Wi-Fi, the only thing is that the data transfer speed will be much higher because the computer and Android device are connected directly, instead of using the router as a gateway. In this case, the gateway will be the Android device itself. A USB modem has the highest data transfer rate.

Backup one Partition (raw = exact bit-by-bit copy of the partition)

Everything is similar to what was described above, only you need to replace mmcblk0 with the appropriate Section. In this particular case, you can use software to view the contents of the copied Section. Depending on the file system: DiskInternals Linux Reader, plugin for Total Commander and ImDisk Virtual Disk Driver. You can also use software to recover data from individual partitions, such as Recuva in conjunction with the VHD Tool, or the command line tools included with the operating systems themselves.

Backup one Partition (tar = only files and folders are copied)

In this case, an already mounted partition is required. (I described above how to find partitions on Teclast x98 3g.)
To see a list of all mounted partitions in Cygwin Terminal, enter:

Now you should know where and what partition is mounted, for example, Firmware is mounted in /system, which is essentially a ROM.
In this case, you will have to open three Cygwin Terminals, due to restrictions imposed by Android itself:

Open the first Cygwin Terminal and create a FIFO, for example in /cach, and redirect tar to it:

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox mkfifo /cache/myfifo
/system/xbin/busybox tar -cvf /cache/myfifo /system

You have to do this because redirecting tar to stdout (with "-") does not work on Android and corrupts the saved file.

Open a second Cygwin Terminal:

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox cat /cache/myfifo

Open a third Cygwin Terminal:

adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > system.tar

You can view the resulting tar file using Winrar, Total Commander, PeaZip, etc. Please note that you should not extract files or edit them, as the tar format retains access and owner data for each file, which disappears when extracted to FAT/NTFS partitions.

Tags:

  • Android
  • Nandroid backup
  • Saving data
  • Translation
Add tags

After we have downloaded everything we need, we can, for example, create an Android folder in the root of some folder and organize the unpacked contents of the archives into folders, i.e. drivers in the Drivers folder, Platform Tools in separate folder, SP Flash Tool in a separate one, MTK Droid Tools also in a separate one.

Next, enable Developer Mode on your device and activate USB debugging. Those. First, go to Settings -> About phone (About device) and click several times (5-7) on the “Build number” until a message appears stating that Developer Mode is activated. Next, go to the Settings menu -> For developers and check the box for “USB debugging”:

After that, connect the device to the PC and install the ADB drivers (i.e., either by running AdbDriverInstaller.exe from the archive, or by opening the device manager and manually specifying the path to the drivers in Android folder ADB driver x64 for unknown device). The result should look like this (Device Manager):

Device Android ADB Interface in Device Manager confirms that we are ready for the next step.

We wait until the device is detected in it and click the “Block Map” button:

Then click the “Create scatter file” button and save the resulting file (for me it was called MT6582_Android_scatter.txt) to disk. At this point, the preparation stage is completed and you can proceed directly to reading the data.

Open the resulting file in Notepad++ or Word (note that regular notepad will not work) and find the line partition_name: CACHE in it:

And remember what is written in the linear_start_addr column, in this case it is 0x3E900000.

We disconnect the phone from the PC and turn it off, i.e. hold the power off button and select “Power off” in the menu, you can also disconnect and insert the battery. Next, launch the SP Flash Tool and go to the Readback tab. Next, click the Add button. As a result, one row will appear in the table:

We click on it, we are asked to select a location to save the ROM_0 file, select the folder in which we want to save it and on the next screen in the Length field we enter the number we remembered earlier (linear_start_addr):

The end result should be something like this:

Then we connect the switched off phone (!) to the PC. At this point, it is advisable to open the device manager. For now, we don’t press any buttons in the SP Flash Tool on this screen!

At the moment of connection, an unknown MT65xx PreLoader device will be detected and the OS will prompt you to install drivers for it. The picture below clearly shows this. It’s better to open the device manager immediately before connecting the phone in order to “catch” the moment the MT65xx PreLoader appears. If the device appears, but the OS does not offer to automatically install drivers, then this must be done manually by right-clicking on the MT65xx PreLoader device.

Select “Search for drivers on this computer” and indicate the folder in which the unpacked contents of the mtk_xp_vista_7_8_x32_x64.zip archive are located (i.e. by this point you should unpack the archive somewhere). After the drivers are successfully installed, the picture in the device manager should change to this:

If the drivers are installed, you can proceed to the next step. Please note that when you connect the phone, the Preloader USB VCOM Port may appear for only a few seconds - this is normal, our task at this stage is to install the phone drivers so that it is detected exactly as the Preloader USB VCOM Port, and not the unknown MT65xx PreLoader device. If you suddenly did not have time to install the drivers, and the phone turned on, take out the battery, disconnect the phone, insert the battery, connect the phone and repeat the procedure.

Once we are sure that the drivers are installed, we disconnect the phone from the PC. We turn it off, in the open SP Flash Tool we press the Readback button and connect the turned off phone to the PC. After this, we will go through the process of reading the firmware from the phone:

Many people write about the difficulties that arise precisely at this step. I'll try to explain in a little more detail. After you press the Readback button, SP Flash Tool goes into standby mode for the phone to connect, i.e. It is assumed that before this you managed to catch the moment when your switched off phone is identified as MT65xx PreLoader and installed drivers on it so that Preloader USB VCOM Port appears in the COM ports. If suddenly for some reason the SP Flash Tool wrote an error, or the phone did not have time to connect, the following method can help (everything described is only true if you installed the drivers correctly and when you connect the phone, Preloader USB VCOM Port appears): disconnect the phone from the PC, remove the battery, press the Readback button, connect the phone with the battery removed. In the SP Flash Tool there will be a red bar (Download), during this time we quickly insert the battery back, if we have time, then a blue Readback bar will appear with percentages, as in the picture:

We are waiting for the process to complete. Creating a backup can take 10-15 minutes. Just look at the running percentages and don’t touch anything 😉 At the end of the reading procedure, you will see the message Readback Ok:

While we are doing Backup, it’s time to explain what a scatter file is and what the ROM_0 file is, which we will receive as an output. The phone's memory is a regular EMMC Flash, which is divided into specific sections. A Scatter file is a section description file (for example, Scatter has sections PRELOADER, RECOVERY, LOGO, ANDROID, etc.). The purpose of the partitions is different, for example, Recovery contains the recovery image, logo contains the logo used when loading the system, Android contains the system image, etc. The ROM_0 file that we get as an output is essentially a continuous dump of EMMC Flash in one file. But in order to use the resulting firmware backup, for example, to restore another similar device, we will still need to split it into partitions. Here I will describe several ways to do this. The first and most common is through MTK Droid Tools. Let's say we already have a ROM_0 file made using the SP Flash Tool.

Turn on the power of the device (phone) and let it boot, after which we launch MTK Droid Tools again (USB debugging mode on the phone must, of course, be turned on, and ADB drivers installed on the PC), go to the root, backup, recovery tab and click the “Create backup from ROM_ flash drive” button:

We select the ROM_0 we obtained in the previous step and in the log window we see something like the following:

— Save folder on the computer: E:\Android\MtkDroidTools\backups\KINGSING_S1_141117_ForFlashtoolFromReadBack_150512-005322\
— scatter is saved in the file:
E:\Work\Megaphone Login Plus\MtkDroidTools\backups\KINGSING_S1_141117_ForFlashtoolFromReadBack_150512-005322\MT6582_Android_scatter.txtcopying completed
- preloader.bin ... copied ... cut OK
- MBR...copied
- EBR1...copied
- pro_info ...copied
- nvram.bin...copied
- protect_f ...copied
— protect_s ...copied
-seccfg...copied
- uboot.bin...copied
- boot.img ...copied

Well, etc. Now in the save folder, for me it is E:\Android\MtkDroidTools\backups\ we have a folder with a complete backup of our firmware, divided into sections (i.e., each section in a separate file):

This completes the process of creating Backup firmware. If you just wanted to find out how to make backup firmware using the SP Flash Tool and you succeeded, you don’t have to read further.

For advanced

What to do if MTK Droid Tools does not “see” the phone? Or is it impossible to create a scatter file or split the resulting ROM_0 file into sections? How to get a partition map and is it possible to “cut” the ROM_0 file manually? There is such a possibility. To get a partition map on MTK 65xx you need to give a command in the ADB console - i.e. run adb shell in the console and type this command there:

If suddenly the phone is not visible through ADB for some reason (in this case, I advise you to read the ADB manual, there may be a problem with the VEN_ID of the device and you just need to register it in %USERPROFILE%\.android\adb_usb.ini, then the same command can be given in the phone itself by installing Terminal Emulator for Android from Google Play:

As you can see, the result is exactly the same and the linear_start_address of the cache section can be taken from here. Yes, by the way, in new devices, for example based on MTK 6752, such as Beeline Pro, ZTE Q Lux, etc. The partition map can be obtained using cat /proc/partinfo. MTK Droid Tools does not work with these devices at all.

We now have a method for obtaining the start address of the cache section, which is needed to obtain ROM_0 using the SP Flash Tool. We also know the addresses (offsets) and sizes of each partition. Those. To “cut” ROM_0 into partitions, we don’t need to use MTK Droid Tools. This can be done manually in any Hex editor that supports the function of selecting and saving a block to a file (I use the console HIEW). Well, as an example, let’s “cut out” the Recovery partition from the resulting ROM_0 file.

We know (from scatter or from dumchar_info) its linear_start_addr: 0x4180000 and partition_size: 0x1000000. Open ROM_0 in HIEW and go to 0x4180000. Those. in the console we make hiew32 ROM_0, then press F5 and enter the address of the beginning of the partition - 4180000:

As you can see from 4180000 we have the ANDROID! signature, which tells us that we are on the right track 😉 The end of partition address is calculated as linear_start_addr+partition_size-1 = 0x517FFFF in our case. We press in HIEW * (the asterisk on the additional keyboard) to start selecting the block (if we move the arrows up / down / right / left, we see how the block begins to be highlighted in color) and either go down to 0x517FFFF, or do it through F5:

And we finish selecting the block, again using the “gray” * (on the additional keyboard). After that, press F2 - Put block (saving the block to a file):

AND recovery section we have it recorded. In the same way, you can cut any other partition from ROM_0. As you understand, we don’t need MTK Droid Tool at all.

To simplify the procedure, you can also write a script / program that will do this automatically for all sections, but to be honest, I don’t have enough time for this, and this task does not arise very often, so HIEW is quite enough for these purposes .

p.s. That's all for now... the post turned out to be a “draft version”, because... I wrote it in a hurry, maybe I’ll add to it later if there are any unclear points. And of course, as always, I will respond to your comments and questions...

p.p.s. As they managed to correct me a little, /proc/dumchar_info does not contain linear_start_addr from the scatter, but physical_start_addr. Those. in the example given for the recovery partition we have:

linear_start_addr: 0x4180000
physical_start_addr: 0x2D80000
partition_size: 0x1000000

And in /proc/dumchar_info we see exactly physical_start_addr in the StartAddr column. But if we look at the size of the first partition (preloader), it becomes clear how to convert physical_start_addr to linear_start_addr; if you add 0x1400000 to 0x2D80000 (this is exactly the size of the preloader), then you get 0x4180000.

Publications on the topic