Skip to content

Instantly share code, notes, and snippets.

Embed
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_all.sh - Flash ROM and erase user data
    2. flash_all_except_data_storage.sh - 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
#!/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 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.
@danielglez
Copy link

danielglez commented Nov 3, 2020

Thank you so much! Worked fine on Poco F2 Pro

@lazyfrost
Copy link

lazyfrost commented Nov 21, 2020

redmi note 7 (lavender), miui12 latest stable eu, works fine and very simple. thanks!

@shaulreznik
Copy link

shaulreznik commented Nov 26, 2020

Thank you a lot! Xiaomi Redmi Note 5, worked like a charm.

@sysadminpower2019
Copy link

sysadminpower2019 commented Nov 27, 2020

why wouldn't it work ,its just a script that uses fastboot directly. MiUi apparently isnt doing anything special

@Gushigami
Copy link

Gushigami commented Feb 2, 2021

Worked as expected on a Mi9T EEA device. Thanks a lot !

@mssx86
Copy link

mssx86 commented Mar 29, 2021

works fine on xiaomi mi5 standard edition, thanks a bunch.

@Apihplays
Copy link

Apihplays commented May 15, 2021

works fine on my Redmi Note 10(sunny) device . thanks ! no sparse crc problem on linux , im glad now my device is no longer bootloop from flashing using win10

@sohilshannu
Copy link

sohilshannu commented Jun 2, 2021

Hi, I'm using Poco F1. Suddenly 2 days back, it went black. no led blinking or vibration while charging. Not Switching ON. when connected in pc, its showing as Qualcomm HS-USB QDLoader 9008 (COM5). I'm using stable rom miui till now. What to do? Please help

@Apihplays
Copy link

Apihplays commented Jun 16, 2021

Hi, I'm using Poco F1. Suddenly 2 days back, it went black. no led blinking or vibration while charging. Not Switching ON. when connected in pc, its showing as Qualcomm HS-USB QDLoader 9008 (COM5). I'm using stable rom miui till now. What to do? Please help

that mean you are in EDL mode , just use fastboot to flash the rom again , miui stable rom maybe i dont know what kind of rom u want so flash it using the script. hope its help you

@berkant
Copy link

berkant commented Jun 30, 2021

Does anyone know if one can relock the bootloader after flashing a global ROM to an international device (Snapdragon, not Chinese)? Asking because I would like to switch to Global to EEA.

@tidierush
Copy link

tidierush commented Jul 27, 2021

Still works on my Redmi Note 9 Por Global using Ubuntu 21.04. But some step I skip just use chmod then flash.

@Ellefly
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.

@Tash254-ke
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