- Download the fastboot ROM suitable for your device from the Xiaomi Firmware Updater and extract the downloaded archive
- Download and extract the official Android SDK Platform Tools or install them using your package manager of choice.
- If you are using the official platform tools, make sure
adb
andfastboot
(components of platform-tools) are in your path
- If you are using the official platform tools, make sure
$ export PATH=path/to/android/sdk/platform-tools:$PATH
- Connect your device to your computer using a USB cable and enable USB Debugging in your device's settings. Check if your device is detected.
$ adb devices
- If device is listed, reboot to bootloader
$ adb reboot bootloader
- Check if your device is detected by fastboot
$ fastboot devices
You may need to use sudo
before fastboot
if you get a permission denied error
- There are three scripts for flashing the ROM:
flash_all.sh
- Flash ROM and erase user dataflash_all_except_data_storage.sh
- Flash ROM without erasing user dataflash_all_lock.sh
- Flash ROM and lock the bootloader after flashing. (Don't do this!)
Whichever script you decide to use, make sure that the interpreter is mentioned at the top of the script like
#!/bin/sh
If the above line is missing, add it to the top of the script
- Make the script executable (I've chosen
flash_all.sh
)
$ cd path/to/extracted/ROM/archive
$ chmod a+x ./flash_all.sh
- Run the script
$ ./flash_all.sh
- You may need to run
sudo ./flash_all.sh
if you had to usesudo
withfastboot
- Sit back and relax. The script needs no user interaction. After flashing the ROM, the script will reboot your device.
- Reboot will take quite a bit of time. Don't panic.
OMG! You saved my device! This guide is pure gold for people who does not have Windows. I was searching for solutions in hours of pure pain.
YAY! It booted without errors!