Updated on July 18th 2020
As Android 10 is just round the corner, I tried my hands on AOSP ROM for Mi 6. Being an MIUI Fan, I always prefer MIUI. I flashed AOSP to check new features. While flashing back MIUI using fastboot ROM. I got an error "Find device storage corrupted your device is unsafe now" while setting up the phone. I lost MAC id for wifi and Bluetooth.
To fix the issue, I need to flash persist.img which is present inside fastboot ROM. But using fastboot command it can't be flashed. It will give error "FAILED (Remote: 'Partition flashing is not allowed')"
Here I am sharing the guide to flash persist.img
Note: I have done it successfully on Mi 6.
1. You need Unlocked Bootloader and TWRP. You can boot in TWRP instead of flashing it.
2. Download the fastboot ROM for the device. Extract it and copy persist.img file to the internal memory of the phone. Make sure put the file in internal storage rather than in any folder.
3. Put the phone in fastboot Mode, Power Button and Volume Down key.
4. Boot in TWRP by "fastboot boot twrp.img" command.
5. In the TWRP Main Menu. Go to Advanced ------ Terminal
6. Write the below 2 lines:
simg2img /sdcard/persist.img /sdcard/persist_EXT4.img
dd if=/sdcard/persist_EXT4.img of=/dev/block/bootdevice/by-name/persist
Update: If you are facing this error
No need to use simg2img command, Just use the dd if= Command.
"invalid sparse file format at header, failed to read sparse file"
dd if=/sdcard/persist.img of=/dev/block/bootdevice/by-name/persist
If you have Orange Fox recovery You can directly flash img file.
7. Reboot the Phone and check.
Please share your feedback if it helped you!
In order to fulfill the basic functions of our service, the user hereby agrees to allow Xiaomi to collect, process and use personal information which shall include but not be limited to written threads, pictures, comments, replies in the Mi Community, and relevant data types listed in Xiaomi's Private Policy. By selecting "Agree", you agree to Xiaomi's Private Policy and Content Policy .