In a case where you can still access your data partition, or just want to update your firmware using the recovery, the following steps will deem useful.
How to Flash Xiaomi Firmware using Recovery
1.Download the firmware file compatible with your device, and rename it to update.zip.
2.Transfer it to the root of your internal storage.
3.Proceed by booting your Xiaomi device into the recovery mode by pressing both the Power and Volume Up buttons together.
4.Once you enter the recovery mode, you can navigate using the volume up and down keys, and use the power button to select an option.
5.Scroll down and select the "Install update.zip" option, and give your phone a while to do the task.
6.Once done, if you phone doesn’t reboot automatically, just navigate and select the "Reboot" option from the recovery.
How to Flash Xiaomi Firmware using Fastboot
1. Download the MIUI xxxx Fastboot firmware for your Xiaomi devices.
2. Now turn your device off completely. Press the Volume–key and the Power button simultaneously to enter Fastboot mode.
3. Once you have entered fastboot mode, you will see the Mi Bunny Fastboot mode picture.
4. Now connect the device to the Windows PC/laptop via a USB cable.
5. You need to double click on the downloaded file to extract it.
6. Open the extracted folder and copy its path on the computer.
7. To install MiFlash Tool, download Mi Flash Tool Zip and extract the MIUI MiFlash tool on your computer.
8. Now click on the installer file on your computer and continue the installation. (Ignore the security warning) and select run to continue the installation.
9. After installation is completed, open MiFlash.exe and paste the address bar from the file folder path copied in the 6th step. (You can also browse the folder by tapping the Select button).
10. If you have pasted the address code, now click on the first button (circled out in yellow) to Refresh, and MiFlash should automatically recognize the device. Then click the second button (circled out in red) to flash the firmware file to the device.
11. Your flashing process has started, wait until the progress bar inside MiFlash turns fully green, which means the firmware has been successfully installed. Then your device should automatically boot to the new version.