Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to flash MIUI Fastboot ROM from Linux

How to flash MIUI Fastboot ROM from Linux

$ 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 two scripts for flashing the ROM:
    1. - Flash ROM and erase user data
    2. - Flash ROM without erasing user data
  • Whichever script you decide to use, make sure that the interpreter is mentioned at the top of the script like
  • If the above line is missing, add it to the top of the script
  • Make the script executable (I've chosen
$ cd path/to/extracted/ROM/archive
$ chmod a+x ./
  • Run the script
$ ./
  • You may need to run sudo ./ if you had to use sudo with fastboot
  • 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.
Copy link

Ellefly commented Feb 15, 2022

Works, same phone as above. If you flash the keep data script and datas encrypted it wont boot the first time, no need to re-flash the right script tho deleting data from MIUIs recovery sorts it.

Copy link

Tash254-ke commented May 22, 2022

Thank you so much for this. Worked on my Mi A3. Though I had to change slots because it wouldn't boot. Thank you for making it simple to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment