Flashing unlocked Xiaomi Mi 5 with MiFlash Tool Guide
First of all make sure you’ve got all drivers installed on your PC. On Windows 8 & 10 disable driver signature verification (here’s the tutorial).
Install Xiaomi USB Drivers, XiaoMiFlash and ADB drivers and tools. It’s recommended to use the latest version of MiFlash Tool.
Download required fastboot ROM (do not confuse it with the recovery ROM version) from en.miui.com and unpack downloaded ROM.
Boot your device in fastboot mode (turn it off > press “Power” and “Volume Down” buttons and wait for fastboot logo to appear on the screen).
Connect to PC via USB-cable.
Open folder with ADB files and open command window here (press “shift” and right mouse click on empty space, select “Open command window here”. Type “fastboot devices” to check if device is connected.
If everything is ok, you’ll see a unique device number.
Run MiFlash.exe as administrator and press “Refresh” button. In your device is not being seen, then try updating drivers.
Next, in MiFlash press “Select” or “Browse” and locate the folder with unpacked ROM files.
In the bottom select “clean all” or “flash all” option. This will lead to clean ROM installation and deletion of all data.
Press “Flash” to start ROM installation. You should see a progress bar at this point. Flashing takes around 5-7 minutes. If everything was successful you’ll see a “The operation is completed successfully” message on the screen.
The phone will automatically reboots, first startup will take around 5-7 minutes.
In case you stuck with some errors:
Probably you’re using old version of MiFlash, try installing a newer version.