FORUMS
Remove All Ads from XDA

[TOOL] [TISSOT] Low-level Backup/Restore/Unbrick toolkit for Mi A1

5,462 posts
Thanks Meter: 6,485
 
By CosmicDan, Senior Member on 14th May 2018, 03:25 PM
Post Reply Email Thread
What?

A Windows (only) toolkit for making full backup/restore of all Mi A1 partitions to/from your PC.
  • Utilizes EMMCDL in Qualcomm EDL mode - only needs fastboot access (unlocked BL) or testpoint (for bricked devices, maybe locked ones too - not sure)
  • Backups create a rawprogram0.xml file which could also be restorable in MiFlash if you choose (untested - not part of toolkit goal).
  • See FAQ at bottom for details about how to use EDL mode.

--------------------------------

Why?

Mainly to...
  • ...backup all your hidden/system partitions that TWRP cannot (e.g. persist) to keep them safe.
  • ...recover your device in the event of a brick

--------------------------------

How?

Requirements
  • Windows PC ONLY
  • Qualcomm EDL drivers (can get them from here, among other places)
  • Fastboot access working with driver (generic binary and driver work fine, it's all over the place
  • If you're firm-bricked (stuck in Diagnostic mode) you need to disassemble and bridge the test-points to kick it out of diagnostic mode - but that's beyond the scope of this thread/tool.

Setup
  1. Download the latest version from GitHub (link at bottom) and extract
  2. Connect your device with a quality USB-C cable (original worked well). Some cheap cables, or USB2 > USB-C adapters can cause the process to fail.
  3. Boot into fastboot and run the command...
    Code:
    fastboot oem edl
    ...you may see an error, that's normal. Device should now have blank screen and a white flashing light.
  4. Install the QDLoader driver. You may see this in device manager if you've not installed it yet...
    [Link because XDA forum keeps breaking my IMG tags whenever I edit]
    ...just right click > properties > update driver, the usual thing (if you downloaded the smaller driver pack ZIP from above). Then it should look like this...
    [Link because XDA forum keeps breaking my IMG tags whenever I edit]
  5. If your COM port in device manager (see above) is not COM30, you need to-
    1. Edit the config.ini in the toolkit folder
    2. Replace com30 with whatever your port is
  6. Now you're ready to use the tool.

Usage

The toolkit is pretty self-explanatory. But first you need to select which partitions you want to backup with option 1. Two partition lists are already included:
  • partition_list.all.txt - this list selects all partitions that exist on the Mi A1. Note that backing up system(_a/_b) and especially userdata will take a VERY LONG TIME. Also note that the backup images are NOT compressed; so expect to have 32GB space free for example (if you have a 32GB device).
  • partition_list.skip-systems-and-userdata.txt - this will backup all partitions except system(_a/_b) and userdata. More useful, since we backup system and userdata in TWRP anyway. All the other firmware partitions come to only about 500MB.
Once you select the list you want to use, you can run the backup with 2 - just enter a folder name and it'll go there.

Restore does not require a partition list to be loaded; since the partition table is stored inside the backup as rawpartition0.xml. You can manually edit this file if you want to selectively restore partitions - just delete the whole line of partitions you don't want to restore. Note that changing any of these values will NOT repartition the device - you'll only corrupt your partition table if you do this.

Well I guess that's it, I will update this guide after feedback (it's a bit rough, I am kind of rushing lol).

--------------------------------

Where?


Download the latest version on GitHub:
https://github.com/CosmicDan-Android/MiA1LowLevelBackupRestoreTool
... simply press the green 'Clone or download' button on the right, then 'Download ZIP'.

--------------------------------

Who?
  • Special thanks to @emuzychenko for his batch script wizardry which this is mostly based on. You can see his original tool and scripts here. I just re-wrote it all to be more user friendly and convenient for me and others.

--------------------------------

History



2018-05-23
  • Added config option to change transfer speed (reducing may help with freezes)

2018-05-15

  • Fixed crashing when path containing tool has spaces
  • Added a "debug mode" that won't instantly close the Window in event of a hard crash (why oh why did I ever use Batch again...)
  • Added a "persist-only" partition list
2018-05-14
  • Initial version


--------------------------------

FAQ

Q) EDL mode? Eh?
A) EDL mode, or "Emergency DownLoad" mode, is a low-level mode for flashing devices. It is entered by the command:
Code:
fastboot oem edl
EDL mode is used to read/write to the eMMC more directly. It is used by this tool, as well as flashing with MiFlash.
Other important notes:
  • You will need good QDLoader drivers. These drivers gave me the best results.
  • You can exit EDL mode by holding Power button for ~10 seconds. Hold with VolDn to reboot into fastboot again, as one might expect.
  • Make sure you use a good USB-C cable.
  • Sometimes the flashing process can freeze. It will always report success when done. If it freezes, you need to reboot EDL mode. Try a different USB port or cable if you keep experiencing freezes.


Q) I get a freeze or hang when trying backup/restore partitions
A) First, make sure it's actually frozen. Open log.txt in the tool folder, and then open it again to see if it's changed.

If not, make sure you're using the driver linked in this post, as it proved to be most reliable by myself and others. You can also try these things (recommended in this order):
  • Reboot to EDL mode again;
  • Use a different (better) cable;
  • Use a different USB port;
  • Reduce the transfer speed in config.ini (be sure to read the comments)
  • Use a different PC;

Of course all are welcome to post their questions/suggestions and so on. Happy flashing!
The Following 40 Users Say Thank You to CosmicDan For This Useful Post: [ View ] Gift CosmicDan Ad-Free
 
 
14th May 2018, 06:58 PM |#2  
Member
Thanks Meter: 19
 
More
Very good job man tnx
14th May 2018, 08:10 PM |#3  
Senior Member
Flag 26.8500° N, 80.9200° E
Thanks Meter: 66
 
More
First of all it doesn't work for me with a locked bootloader, I had to unlock the bootloader and followed the instructions, after opening the program and selecting any option in the tool simply closes the window and nothing happens. I tried it 4 times but no use, it just closes the command prompt window
14th May 2018, 11:23 PM |#4  
CosmicDan's Avatar
OP Senior Member
Flag Sydney
Thanks Meter: 6,485
 
Donate to Me
More
Quote:
Originally Posted by rubenswing

First of all it doesn't work for me with a locked bootloader, I had to unlock the bootloader and followed the instructions, after opening the program and selecting any option in the tool simply closes the window and nothing happens. I tried it 4 times but no use, it just closes the command prompt window

Oh derp to me; of course locked bootloader can't access fastboot at all can it! Shows how experienced I am with locked devices thanks - updated thread with statement of unlocked BL requirement.

Re: Your crash, I realized right away that that is very likely because the program path has spaces in it. I fixed that now, just download the tool again and it should work. If not though, there is now a _debug tool that will show you the error instead of instantly closing. But I'm 90% sure that the problem you had is now fixed.
The Following 2 Users Say Thank You to CosmicDan For This Useful Post: [ View ] Gift CosmicDan Ad-Free
15th May 2018, 01:29 AM |#5  
Senior Member
Thanks Meter: 119
 
More
So you mention that all partition. Mean I can make persist and IMEI partition (I don't know whatever it called in our device in Samsung it's called efs) backup to. I did backup of IMEI partition via qpst tool (it's .qcnfile) but I wanted to make more backup. My WiFi is broken since I installed custom rom so I restored it via persist resurrect tool.
Thanks for your hardwork making thing easy for us.
15th May 2018, 03:03 AM |#6  
CosmicDan's Avatar
OP Senior Member
Flag Sydney
Thanks Meter: 6,485
 
Donate to Me
More
Quote:
Originally Posted by cherryb8844

So you mention that all partition. Mean I can make persist and IMEI partition (I don't know whatever it called in our device in Samsung it's called efs) backup to. I did backup of IMEI partition via qpst tool (it's .qcnfile) but I wanted to make more backup. My WiFi is broken since I installed custom rom so I restored it via persist resurrect tool.
Thanks for your hardwork making thing easy for us.

If IMEI is on EFS, yes it will do that but TWRP also has EFS backup/restore.

This tool will do absolutely every partition, there is literally nothing else on the storage that needs to be backed up. Only thing it can't do is repartition device, that has to be done manually (I have another thread about that).
The Following User Says Thank You to CosmicDan For This Useful Post: [ View ] Gift CosmicDan Ad-Free
15th May 2018, 07:00 AM |#7  
Senior Member
Flag 26.8500° N, 80.9200° E
Thanks Meter: 66
 
More
Quote:
Originally Posted by CosmicDan

Oh derp to me; of course locked bootloader can't access fastboot at all can it! Shows how experienced I am with locked devices thanks - updated thread with statement of unlocked BL requirement.

Re: Your crash, I realized right away that that is very likely because the program path has spaces in it. I fixed that now, just download the tool again and it should work. If not though, there is now a _debug tool that will show you the error instead of instantly closing. But I'm 90% sure that the problem you had is now fixed.

Yep it's working very much now as expected and a big thank you I now could backup up all the partitions on my device
The Following User Says Thank You to rubenswing For This Useful Post: [ View ] Gift rubenswing Ad-Free
18th May 2018, 06:59 PM |#8  
Member
Thanks Meter: 10
 
More
flash_factory.bat
Which are the files that are nuked when you do a flash_factory? I know modemst1, modemst2 and persist are the important ones that are mentioned in the threads. There's any other data you should backup? I see there's a lot more partitions other than the usual ones, they hold irrecoverable data too? Also I'have seen that to recover IMEI people use a qualcomm tool, do you need that process or you can just flash modemst1 and modemst2 to recover IMEI?
19th May 2018, 03:13 AM |#9  
CosmicDan's Avatar
OP Senior Member
Flag Sydney
Thanks Meter: 6,485
 
Donate to Me
More
Quote:
Originally Posted by ekistece

Which are the files that are nuked when you do a flash_factory? I know modemst1, modemst2 and persist are the important ones that are mentioned in the threads. There's any other data you should backup? I see there's a lot more partitions other than the usual ones, they hold irrecoverable data too? Also I'have seen that to recover IMEI people use a qualcomm tool, do you need that process or you can just flash modemst1 and modemst2 to recover IMEI?

Check the factory_flash.bat, it flashes everything. Also the rawpartition0.xml (which is used in edl mode, factory_flash.bat is only for fastboot mode). So backup everything.

I don't know where Imei is stores, so just backup everything.

Qualcomm tool IMEI recovery is for injecting IMEI into existing partition somewhere. Not necessary if you already have full IMG backups.
19th May 2018, 05:37 AM |#10  
Junior Member
Thanks Meter: 10
 
More
Noob Questions

1. Ok, so consider i have used your tool and worked as intended. so currently the Phone will be in 'edl mode' how can i reboot it back to system (i guess fastboot commands wont work in edl mode).


2. After creating backup, How should i restore partions ?...
using twrp or CMD....?
(Does Tool backup Partitions as img or zip file....?)

3. Does this tool allows user to restore partition individually or one has restore all the backup data as a whole (i.e all backup partions)

Thanks again for the amazing tool
The Following User Says Thank You to thepandas For This Useful Post: [ View ] Gift thepandas Ad-Free
19th May 2018, 06:31 AM |#11  
CosmicDan's Avatar
OP Senior Member
Flag Sydney
Thanks Meter: 6,485
 
Donate to Me
More
Quote:
Originally Posted by thepandas

Noob Questions

1. Ok, so consider i have used your tool and worked as intended. so currently the Phone will be in 'edl mode' how can i reboot it back to system (i guess fastboot commands wont work in edl mode).


2. After creating backup, How should i restore partions ?...
using twrp or CMD....?
(Does Tool backup Partitions as img or zip file....?)

3. Does this tool allows user to restore partition individually or one has restore all the backup data as a whole (i.e all backup partions)

Thanks again for the amazing tool

1) Hold power button for 10+ seconds to reboot

2) You restore them with the same tool, there is a restore option in the menu, it's right there 🤨

3) The restore will restore everything listed in rawpartitions0.xml inside the IMG backup folder. If you want to exclude some partitions in restore, delete the corresponding XML line. This is already explained in the OP.
The Following 3 Users Say Thank You to CosmicDan For This Useful Post: [ View ] Gift CosmicDan Ad-Free
Post Reply Subscribe to Thread

Tags
backup, flash, partition, restore, unbrick

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

Advanced Search
Display Modes