Code:
/*
* Your warranty is now void.
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed.
* Please do some research if you have any concerns.
* YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/
A guide to flash MIUI OTA/Stock/Any MIUI based rom from recovery without any bootloops or bricking device.
First things first, if you haven't done any modifications to your device (not even unlocked bootloader), then this guide is probably not for you. Just update via the Updater app. If you want to unlock bootloader and root read this guide first then come back.
Now if you have unlocked bootloader with TWRP installed and encrypted device then you can flash full ROM from TWRP without any issues.
Staying on an encrypted device is recommend for better security.
To check if your device is encrypted or not go to Phone Settings > Passwords & security > Privacy > Encryption & credentials > check if it shows encrypted or not.
To decrypt your internal storage (Not recommended):
Make sure you have a backup of your data copied in PC.
- In TWRP go to Wipe and select Format Data(don't go to advanced). Type yes and format data. [This process will format all your data so make sure your data is backed up].
- Go back to TWRP home and Reboot > Recovery.
- Reboot > System.
Now if you check again in Phone settings it'll show "Phone not encrypted".
If you have a decrypted device and want to flash MIUI rom or OTA through recovery you'll face bootloop.
Then there are two solutions to overcome this issue:
1. After flashing full MIUI rom through TWRP you need to format data again. But you will have to backup your data to PC everytime as your internal will be formatted. And then you would have to go through the hassle of setting up your phone which takes atleast 15 mins.
2. A better solution is to use another recovery like OrangeFox recovery. It has a special MIUI OTA support. So you can flash MIUI OTA and any MIUI based rom from recovery without bootloop, formatting data or bricking device in any way.
Here's how to use OrangeFox recovery:
Make sure you have a backup of your data copied in PC.
These steps work for both encrypted and non-encrypted devices
- Download the stock MIUI Recovery ROM for your region or any other MIUI based custom rom of your choice, and copy it to your phone’s storage.
- Download the OrangeFox recovery zip from here.
- If you don't have any recovery installed right now then extract the recovery.img file from the zip and follow the "Flashing TWRP" steps from here
- If you already have TWRP then go to Install > flash zip normally. Your device will boot into OrangeFox recovery automatically in 5 seconds.
- Go to the Menu > tap on OrangeFox settings icon in top right corner, and enable these under MIUI OTA settings :
1. Support MIUI incremental OTA
2. Include system in OTA survival
3. Incremental OTA signature verification
4. Prevent auto reboot after installing OTA
5. Disable DM-Verity
6. Disable Forced Encryption (Don't enable this if you have an encrypted device already and want to stay encrypted)
7. Aggressive stock recovery deactivation
- Now go to the “Wipe” menu :
1. If already on a MIUI based rom and flashing your current MIUI rom zip then select data, cache, and dalvik.
2. If coming from a non MIUI based rom to MIUI based one or if switching from current MIUI based rom to completely different MIUI based one then select data, cache, dalvik, system, vendor.
- Now go to "Install" and flash your MIUI ROM. (This is just a one time process.)
- After the ROM is flashed, OrangeFox will start the "OTA_BAK" process, which will backup your system and boot partitions into the /sdcard/Fox/OTA directory. You must NOT delete any of the files in the /sdcard/Fox/OTA directory. If you do, then incremental OTA updates will most definitely fail.
- Reboot > system.
Now when MIUI notifies you that there is an update:
- Download the update, using the MIUI updater app/official website.
- If on an encrypted device allow it to reboot automatically to OrangeFox. If decrypted, boot to recovery manually and under miui OTA settings enable the Disable Forced Encryption option first and then flash OTA from recovery.
- OrangeFox will install the update automatically (this might take several minutes).
- Your phone will reboot automatically upon completion of the installation of the MIUI OTA update (If it doesn't then reboot manually).
- After this, you will not need to flash a full rom any more.
- Enjoy your updated MIUI
Links
1. OrangeFox Recovery
2. Stock MIUI Recovery ROM
If this helped you then hit the Thanks Button. Good Luck.
Last edited: