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
7. Reboot the Phone and check.
Please share your feedback if it helped you!