• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Anybody is pro/has much experience with Fastboot/Mi Flash Tool/Stock Recovery?

Search This thread

rodagola

Senior Member
Nov 13, 2019
64
0
You will need to do that method again everytime you interact with SPFT
I had a better idea now. On the regular folder with the firmware, there's already a preset .img file for every partitions. Including a "userdata" one. The default userdata img came with 24Mb file size. I simply replaced it with my custom one that weighs 12Gb. Clever? I figured all I needed to do now was load the scatter and uncheck all boxes except userdata, THEN flash... but oh dammmm........scatter doesn't want to load because now userdata throws a checksum mismatch error. See images for what I did.

EDIT: I saw on YT a guy simply deleted the file found within the main folder called "Checksum.ini" and it allowed him to load. However, I don't know if this is healthy for the process/if this could brick the phone lol
 

Attachments

  • replaced.png
    replaced.png
    52 KB · Views: 8
  • userdata mismatch wtf.png
    userdata mismatch wtf.png
    11.8 KB · Views: 8
Last edited:

kekesed97

Senior Member
I had a better idea now. On the regular folder with the firmware, there's already a preset .img file for every partitions. Including a "userdata" one. The default userdata img came with 24Mb file size. I simply replaced it with my custom one that weighs 12Gb. Clever? I figured all I needed to do now was load the scatter and uncheck all boxes except userdata, THEN flash... but oh dammmm........scatter doesn't want to load because now userdata throws a checksum mismatch error. See images for what I did.

EDIT: I saw on YT a guy simply deleted the file found within the main folder called "Checksum.ini" and it allowed him to load. However, I don't know if this is healthy for the process/if this could brick the phone lol
Why don't you try to generate a new checksum for that brewed ROM?
Skipping checksum is also acceptable if you sure your files are correct. And I can't think any potential cause for brick if you do everything "correctly".
 

rodagola

Senior Member
Nov 13, 2019
64
0
Why don't you try to generate a new checksum for that brewed ROM?
Skipping checksum is also acceptable if you sure your files are correct. And I can't think any potential cause for brick if you do everything "correctly".
Well, meanwhile, I removed the checksum from the group of things and the scatter actually loaded, I unticked all boxes except userdata and succesfully flashed this partition.

When I reset phone, as I expected, it didn't go past redmi logo.

It then automatically took me to TWRP, I then attempted to "file browse" while inside twrp, went to "sd card" but was empty. Not sure if I'm missing something. I did not root it with magisk before, but I guess shouldnt be a problem.

Okay, now I should try again so I selected the wipe option on twrp and now it boots again. I have several ideas.

1: back when I extracted the userdata partition... my phone was running MIUI 11 and I know the exact version. Therefore I would like to try rolling back to that exact OS version, and try the flashing again (in case these have to match). - I also have my current and previous OS versions's firmwares downloaded. On both I checked the checksum.ini values, and they are different. Anyways, spft still gives a similar checksum error when trying to load scatter from one or the other.

2: ...therefore, I could try to make the checksum match (as you suggest, but idk how) then flash this partition and see the result

3: find a way twrp can actually find my files after flashing, thanks to mtp access

Do you recommend route 1? Or should I try your suggestion first. HOW do I generate a new checksum for this new ROM? Please your help is always much loved <3
 

rodagola

Senior Member
Nov 13, 2019
64
0
Why don't you try to generate a new checksum for that brewed ROM?
Skipping checksum is also acceptable if you sure your files are correct. And I can't think any potential cause for brick if you do everything "correctly".
This is the result I'm getting. They're found through file manager on twrp and when i go to the "restore" tab they're also there. I think they're unreadable because they look as encrypted in some way? But these should make up for my personal files. just need to figure out the correct way to make them "real"

How do I generate the new checksum for the brewed ROM again? D:
 

Attachments

  • weird folders.png
    weird folders.png
    33.4 KB · Views: 7

kekesed97

Senior Member
This is the result I'm getting. They're found through file manager on twrp and when i go to the "restore" tab they're also there. I think they're unreadable because they look as encrypted in some way? But these should make up for my personal files. just need to figure out the correct way to make them "real"

How do I generate the new checksum for the brewed ROM again? D:
It's encrypted, and the decryption is on your phone's side. Do your TWRP display this weird files prior restoring? Do your TWRP ask for a decryption password upon boot? Making a new checksum won't cure this.
It's a good bet to back to the same firmware version.
 

rodagola

Senior Member
Nov 13, 2019
64
0
It's encrypted, and the decryption is on your phone's side. Do your TWRP display this weird files prior restoring? Do your TWRP ask for a decryption password upon boot? Making a new checksum won't cure this.
It's a good bet to back to the same firmware version.
Yes, priority set now to downgrade to MIUI V11.0.3.0.PGGCNXM, which was based on Android Pie,

this was the exact version I had when I did readback my userdata partition, so I think only on this version it can be decrypted

I already tried loading up fastboot, and mi flash, phone is currently running Android 10 on V12.0.5.0.QGGCNXM, I once tried flashing this same version over itself on fastboot, it did let me! But when I try with that older V11, it first throws "antirollback error", I start deleting lines in the batch script, then errors keep coming up, I keep deleting their respective lines but no desired results.. ;( It doesn't flash.

Can you teach me how to rollback using TWRP? If that's even possible.. :/
 

kekesed97

Senior Member
Yes, priority set now to downgrade to MIUI V11.0.3.0.PGGCNXM, which was based on Android Pie,

this was the exact version I had when I did readback my userdata partition, so I think only on this version it can be decrypted

I already tried loading up fastboot, and mi flash, phone is currently running Android 10 on V12.0.5.0.QGGCNXM, I once tried flashing this same version over itself on fastboot, it did let me! But when I try with that older V11, it first throws "antirollback error", I start deleting lines in the batch script, then errors keep coming up, I keep deleting their respective lines but no desired results.. ;( It doesn't flash.

Can you teach me how to rollback using TWRP? If that's even possible.. :/
Anti rollback? First thing I heard. Go and check V11 rom anti version, in yourdirectorytoimage/images/anti_version.txt. I only have 12.0.3, 12.0.7, and 12.5.1, and all of them declare anti version 1.
Or try to force install it by flashing the images one by one via fastboot, or via SPFT.
 

rodagola

Senior Member
Nov 13, 2019
64
0
Anti rollback? First thing I heard. Go and check V11 rom anti version, in yourdirectorytoimage/images/anti_version.txt. I only have 12.0.3, 12.0.7, and 12.5.1, and all of them declare anti version 1.
Or try to force install it by flashing the images one by one via fastboot, or via SPFT.
yes, my anti version txt file on v11.0.3.0 also declares "1", is this good?

Also, how do I flash it through fastboot by just using the batch file "clean all" (this might give no errors) instead of loading up the entire folder on miflashtool
 

kekesed97

Senior Member
yes, my anti version txt file on v11.0.3.0 also declares "1", is this good?

Also, how do I flash it through fastboot by just using the batch file "clean all" (this might give no errors) instead of loading up the entire folder on miflashtool
As expected ARB is virtually doesn't exist in this device, yet it gives that result.
You input the command one by one for every images in every respective partitions. Or use modified batch file. Erase the anti checking part. Or use SPFT.
 

rodagola

Senior Member
Nov 13, 2019
64
0
As expected ARB is virtually doesn't exist in this device, yet it gives that result.
You input the command one by one for every images in every respective partitions. Or use modified batch file. Erase the anti checking part. Or use SPFT.
I managed to rollback using the unofficial mitool v2.

I'm now running begonia w MIUI11.0.3, based ON ANDROID 9, I now need TWRP for this specific version, can you link me to a proper yt tutorial? I looked up but the tutorials are very general and didn't find specific. For android 10 on miui12 there's specific procedure on yt, I'd like something similar otherwise a text based tutorial could do! Thanks a lot.
 

Attachments

  • stuck.png
    stuck.png
    32.5 KB · Views: 4

kekesed97

Senior Member

This is an old twrp for this need. Just install it as you've installed twrp back then
 

rodagola

Senior Member
Nov 13, 2019
64
0

This is an old twrp for this need. Just install it as you've installed twrp back then
Hi, Im back! Throught SPFT I've flashed my peculiar userdata over the same OS I had before from where I took the readback. The result is weird. It will show in TWRP a reduction in size for the internal memory, meaning something is occupying the space, but will not display any files. The result when I had the wrong OS version was it showed space occupied and also a bunch of random named folders (encrypted) so I atleast got to see that before. Now I dont even see encrypted things.

I wanna try flashing DIRECTLY through adb on my PC, with the command "fastboot flash userdata userdata.img"

for this I would need a light-size file. command rejects flashing when it's too large. I have had the idea of possibly "COMPRESSING" this .img? Do you think there's any possibility this could even work? TWRP can compress I think. Not sure if the internal system can decompress/understand the compressed .img once flashed... My entire userdata weights 12GB and I'd need to get it around 1GB. Maybe this is the most retarded idea I'm telling you so far?

Another thing was you said I could create a brewed ROM or unofficial ROM with a generated checksum and try to flash it. However I would need a guide on the brewed ROM and creating a that corresponding checksum?
 

kekesed97

Senior Member
Hi, Im back! Throught SPFT I've flashed my peculiar userdata over the same OS I had before from where I took the readback. The result is weird. It will show in TWRP a reduction in size for the internal memory, meaning something is occupying the space, but will not display any files. The result when I had the wrong OS version was it showed space occupied and also a bunch of random named folders (encrypted) so I atleast got to see that before. Now I dont even see encrypted things.

I wanna try flashing DIRECTLY through adb on my PC, with the command "fastboot flash userdata userdata.img"

for this I would need a light-size file. command rejects flashing when it's too large. I have had the idea of possibly "COMPRESSING" this .img? Do you think there's any possibility this could even work? TWRP can compress I think. Not sure if the internal system can decompress/understand the compressed .img once flashed... My entire userdata weights 12GB and I'd need to get it around 1GB. Maybe this is the most retarded idea I'm telling you so far?

Another thing was you said I could create a brewed ROM or unofficial ROM with a generated checksum and try to flash it. However I would need a guide on the brewed ROM and creating a that corresponding checksum?
You are saying with the previous version when you made the backup is not showing anything, as in a completely blank disk? I don't quite get that part.

I don't know partition compression thing exist in either linux or android. I simply can't see any direction to there. Maybe you can do some digging.
Retarded? Maybe. Impossible? Maybe, since I'm not sure about it myself.
What's popping in my head is, instead of compressing, splitting it to multiple chunks will make better sense. But we still don't have the method to do that thing either.

For brewing rom, if your problem is checksum error then it is logical to recalculate the checksum and slap that into that rom. It maybe uses MD5 checksum. This is what I know about MD5 checking, as long as the calculated value is identical, it won't question the file source. But I might be wrong.
Do remind me, is single file flashing evaluate the checksum?

What about flashing it with the prior version? Does your "wrong version" testing phase include that? What about in the engineering rom? There's still so many rooms to look after.

Well, it's quite late in my place, so good night for now.
 

rodagola

Senior Member
Nov 13, 2019
64
0
You are saying with the previous version when you made the backup is not showing anything, as in a completely blank disk? I don't quite get that part.

I don't know partition compression thing exist in either linux or android. I simply can't see any direction to there. Maybe you can do some digging.
Retarded? Maybe. Impossible? Maybe, since I'm not sure about it myself.
What's popping in my head is, instead of compressing, splitting it to multiple chunks will make better sense. But we still don't have the method to do that thing either.

For brewing rom, if your problem is checksum error then it is logical to recalculate the checksum and slap that into that rom. It maybe uses MD5 checksum. This is what I know about MD5 checking, as long as the calculated value is identical, it won't question the file source. But I might be wrong.
Do remind me, is single file flashing evaluate the checksum?

What about flashing it with the prior version? Does your "wrong version" testing phase include that? What about in the engineering rom? There's still so many rooms to look after.

Well, it's quite late in my place, so good night for now.
See, I AM ABLE to flash over the single "userdata" partition with my custom userdata.img file. (But only because I remove the checksum file from the file list where the scatter file is also located...)

If I dont remove it, it says checksum md5 error or something similar. It dont matter what fastboot rom I'm using, either miui 11 and miui 12 both have given me the same checksum error as long as I use a custom userdata.img. They will only flash the original .imgs with no checksum errors.

I dont know how to do the recalculate to match the checksum thing as you say, if you could throw me a guide I would be grateful.

Answering your initial question:

When I flashed my personal data over miui 12 (which is my "wrong version") I started to see encrypted files on the userdata partition through Twrp's MTP. Those encrypted files are supposed to be my correct personal data, but I dont know how to retrieve them unencrypted. The MTP shows it has ~100ishGB/120GB empty, because my personal userdata.img weighs 12GB.

Then when I downgraded and flashed over miui 11 (which is the same version I made the readback backup with), I also see through Twrp's MTP that the phone has ~100ishGB/120GB empty. Meaning it's actually flashing. However, I do not see any of the files now. Not even encrypted. And even weirder is when I reboot into Twrp, it now shows as if the phone deleted the previous invisible files on its own, because capacity shows it's almost 120/120GB again.
 

kekesed97

Senior Member
See, I AM ABLE to flash over the single "userdata" partition with my custom userdata.img file. (But only because I remove the checksum file from the file list where the scatter file is also located...)

If I dont remove it, it says checksum md5 error or something similar. It dont matter what fastboot rom I'm using, either miui 11 and miui 12 both have given me the same checksum error as long as I use a custom userdata.img. They will only flash the original .imgs with no checksum errors.

I dont know how to do the recalculate to match the checksum thing as you say, if you could throw me a guide I would be grateful.

Answering your initial question:

When I flashed my personal data over miui 12 (which is my "wrong version") I started to see encrypted files on the userdata partition through Twrp's MTP. Those encrypted files are supposed to be my correct personal data, but I dont know how to retrieve them unencrypted. The MTP shows it has ~100ishGB/120GB empty, because my personal userdata.img weighs 12GB.

Then when I downgraded and flashed over miui 11 (which is the same version I made the readback backup with), I also see through Twrp's MTP that the phone has ~100ishGB/120GB empty. Meaning it's actually flashing. However, I do not see any of the files now. Not even encrypted. And even weirder is when I reboot into Twrp, it now shows as if the phone deleted the previous invisible files on its own, because capacity shows it's almost 120/120GB again.
Maybe start with MD5 calculator. I never deal with MD5 file checksum calculation myself.

It's quite a weird behaviour. What about flashing it over a version below your backup version?
What about flashing it into a USB drive with some flashing tools like Balena Etcher or Rufus? But don't expect things run smoothly in Windows machines tho, since Windows don't understand linux ext partition.
If fastboot flash don't work I suppose adb sideload won't work either, but can you go to terminal mode after flashing the userdata and browse things from your computer and see if you can see anything? You can use adb pull to take things after you sure your things are sitting there.
 

rodagola

Senior Member
Nov 13, 2019
64
0
Maybe start with MD5 calculator. I never deal with MD5 file checksum calculation myself.

It's quite a weird behaviour. What about flashing it over a version below your backup version?
What about flashing it into a USB drive with some flashing tools like Balena Etcher or Rufus? But don't expect things run smoothly in Windows machines tho, since Windows don't understand linux ext partition.
If fastboot flash don't work I suppose adb sideload won't work either, but can you go to terminal mode after flashing the userdata and browse things from your computer and see if you can see anything? You can use adb pull to take things after you sure your things are sitting there.
"You can use adb pull to take things after you sure your things are sitting there."

----What's the command?

"go to terminal mode after flashing the userdata and browse things from your computer and see if you can see anything"

----Is terminal mode found within SPFT? where to reach this mode?

"What about flashing it into a USB drive with some flashing tools like Balena Etcher or Rufus"

----I might try this, though I only know how to use Windows properly. So maybe it wont work for me because youre saying its better on Linux. Anyways, first I wanna try flashing the userdata on alternate miui versions!
 

kekesed97

Senior Member
The command is "adb pull <your file>"

Terminal mode can be found in TWRP by going to others section and enable terminal. Then access the terminal from a computer with command "adb shell"

You can use balena etcher or rufus in windows just fine, but you will need linux to be able to read the content. Just use live cd for that task.