Skip to content

Instantly share code, notes, and snippets.

@j-jith
Last active April 9, 2025 00:21
Show Gist options
  • Save j-jith/0c4950e8020d9bed0c3104608b07a49d to your computer and use it in GitHub Desktop.
Save j-jith/0c4950e8020d9bed0c3104608b07a49d to your computer and use it in GitHub Desktop.
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.
@Tash254-ke
Copy link

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.

@rezamqds
Copy link

Perfect, redmi k20 (davinci) worked fine

@anasomar1
Copy link

Saved my phone, MiFlash didn't work on my Windows PC, I went to my Linux laptop and followed your steps and managed to access my phone again. I really appreciate the help.

@ldm021
Copy link

ldm021 commented Sep 30, 2022

worked perfectly for Xiaomi Poco F3

@animaldaydream
Copy link

Thank you. I'll treasure this in my brain.

Had I known there was just a script in the archive I wouldn't have searched everywhere how to do it for 15 minutes. Would have been easier to extract it and see for myself. You shouldn't exactly run a flashing tool on a VM... (I'm on Linux.)

@tariqhawis
Copy link

confirmed working on Redmi Note 10s (rosemary)

@araafroyall
Copy link

Is this method work on locked bootloader

@shaulreznik
Copy link

Is this method work on locked bootloader

No

@ouzbirki
Copy link

I can confirm this method works on Redmi Note 10S (rosemary) device.

@BerryJoe
Copy link

BerryJoe commented Dec 21, 2023

Works on Mxlinux 21.3. uncompress the ROM (from xiaomi.eu). Open a terminal in it and run ./linux_fastboot_first_install_with_data_format.sh (for me)
No brainer on MI 10t Pro.
Thanks!

@KiraTheCoder
Copy link

Worked on Poco m4 pro 5g

@manishsencha
Copy link

I tried flashing my Poco F5 and encountered an error:

sending 'cust' (2097152 kb) failed (remote: 'requested download size is more than max allowed')

The script stopped due to this error, but I executed the remaining commands manually. It worked, but I'm concerned if there will be any issues later on. Can anyone enlighten me?

@Ahlexyz
Copy link

Ahlexyz commented Oct 8, 2024

HELP PLS!
I use a Redmi 13C and followed the steps in the guide to: "image"
WhatsApp Image 2024-10-08 at 14 23 53

Where does it give me a message that I don't recognize, I don't know how to use adb either and it's the 1st time I try a root

@sourcezax
Copy link

I thank you so much.
confirmed working on my bricked (not anymore) poco M6 pro :-)

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