How to Flash Stock ROMs on Xiaomi, Redmi and POCO Without Mi Flash
Restore official MIUI or HyperOS fastboot firmware on Linux or macOS using global or portable Fastboot, with a guide to choosing the correct Xiaomi flash script.
Install custom ROMs without Mi Flash using ADB, Fastboot, recovery sideload and compatible Xiaomi.eu scripts on Linux and macOS.
Mi Flash is not the only way to install an operating system on a Xiaomi phone. Once an eligible device has an unlocked bootloader, Android's command-line tools can communicate with it directly from Linux or macOS. This is particularly useful when installing a custom ROM, where the installation procedure is normally defined by the ROM maintainer rather than Xiaomi's Windows flashing application.
This guide focuses on the Xiaomi, Redmi and POCO families. It covers setting up ADB and Fastboot, using them from an extracted folder or anywhere in a terminal, installing custom recovery-based ROMs, and running compatible Xiaomi.eu fastboot packages. If your goal is to restore official MIUI or HyperOS instead, follow the stock ROM flashing guide.
Flashing is not a data-recovery procedure. Unlocking and clean installation can permanently erase internal storage. Use only a device you own or have explicit permission to service, make a verified backup outside the phone, and confirm the exact model, firmware prerequisites and installation guide before writing anything. The device-specific examples below illustrate different installation procedures; they are not interchangeable.
| Tool or mode | Purpose |
|---|---|
| Mi Flash | Xiaomi's Windows-oriented utility for compatible official fastboot firmware packages |
| Mi Unlock | Xiaomi's separate bootloader authorization and unlocking utility |
| ADB | Communication with a running Android system or compatible recovery |
| Fastboot | Communication with a device in bootloader or userspace fastboot mode |
| Fastbootd | Userspace flashing interface used for logical partitions on supported devices |
| Custom recovery | A ROM-specific or compatible environment for installing update packages |
Mi Flash is unnecessary for many custom ROM installations. Mi Unlock is a different matter: if your phone is locked, Xiaomi's supported authorization workflow may still require Windows. Installing ADB and Fastboot does not grant permission to unlock the bootloader or bypass account restrictions.
The retail name alone is not a sufficient identifier. A Redmi Note model may have different 4G, 5G, regional or chipset variants. Identify the precise model number in Settings, then compare it with the ROM maintainer's supported-device list and codename.
For example, these are three separate device families:
| Phone | Codename | Example installation guide |
|---|---|---|
| Redmi Note 10 Pro (supported variant) | sweet | LineageOS for sweet |
| POCO F3 | alioth | LineageOS for alioth |
| Xiaomi Mi 11 | venus | LineageOS for venus |
These are examples of different partition layouts, not a compatibility list for every phone. Follow the current guide for the exact model and build. Check the required stock firmware version, supported region, known bugs, update procedure and whether additional images or packages are required. Download the ROM and recovery from the maintainer's official distribution page, not a random mirror.
Use a reliable USB data cable, a stable USB connection, sufficient disk space and a well-charged phone. Avoid USB disconnects during flashing. The commands below are for a Bash or Zsh shell; replace example paths and filenames with the actual ones on your computer.
Google distributes Android SDK Platform-Tools for Linux and macOS. Download the archive for the computer's operating system. The following examples assume that the archive was saved in Downloads.
Linux:
mkdir -p "$HOME/android-tools"
unzip "$HOME/Downloads/platform-tools-latest-linux.zip" -d "$HOME/android-tools"
cd "$HOME/android-tools/platform-tools"
./adb version
./fastboot --version
macOS:
mkdir -p "$HOME/android-tools"
unzip "$HOME/Downloads/platform-tools-latest-darwin.zip" -d "$HOME/android-tools"
cd "$HOME/android-tools/platform-tools"
./adb version
./fastboot --version
If the downloaded filename differs, use its actual filename. Do not mix the Linux and macOS executables. If the files lack execute permissions, restore permission only on the trusted downloaded binaries:
chmod u+x ./adb ./fastboot
The ./ prefix tells the shell to execute the binary in the current directory. This works without adding anything to the system PATH.
With an authorized phone connected in Android:
./adb devices -l
./adb reboot bootloader
./fastboot devices
ROM files can stay in a different directory. For example, when a compatible recovery is waiting in sideload mode:
./adb -d sideload "$HOME/Downloads/roms/rom.zip"
Here rom.zip is a placeholder for the correct, verified recovery-installable package, not an arbitrary ZIP.
On Kali, Debian and Ubuntu, use the distribution package manager:
sudo apt update
sudo apt install adb fastboot android-sdk-platform-tools-common
adb version
fastboot --version
On Arch Linux, the main tools are packaged as android-tools. Install appropriate Android udev rules as documented for your distribution if device permissions require them.
sudo pacman -S android-tools
Distribution packages can lag behind Google's release. If a ROM requires a more recent tool, use the official Platform-Tools download instead. Avoid mixing old ADB servers and newer client binaries.
With Homebrew already installed:
brew install --cask android-platform-tools
adb version
fastboot --version
Google's macOS Platform-Tools also work without Homebrew. Unlike Windows, macOS normally does not require a separate Android USB driver.
If you prefer Google's archive to a package manager, make it available in every terminal without copying files into system directories.
For the current Bash or Zsh session:
export PATH="$HOME/android-tools/platform-tools:$PATH"
command -v adb
command -v fastboot
To persist this, add the export PATH line once to ~/.bashrc for interactive Bash, or ~/.zshrc for Zsh. Open a new terminal or source the corresponding file. For instance, on the usual macOS Zsh setup:
source ~/.zshrc
adb version
fastboot --version
Kali may also use Zsh; choose the file for your actual shell. Run type -a adb fastboot to identify competing installations. The remaining examples use PATH-based commands. If you are using portable tools, run them from the Platform-Tools folder with ./adb and ./fastboot, or use absolute executable paths. Use absolute image and ROM paths when working outside the ROM directory.
If Linux sees the phone but ADB or Fastboot reports a permission problem, check the distribution's udev configuration. On Debian-family distributions with the plugdev group, install the rules and add your normal account to the group if required:
sudo apt install android-sdk-platform-tools-common
getent group plugdev
sudo usermod -aG plugdev "$USER"
sudo udevadm control --reload-rules
sudo udevadm trigger
Log out and back in, then reconnect the device. Use id to verify group membership. If the group or package does not exist on your distribution, follow that distribution's documented rules instead. Running the entire flashing workflow as root is not the preferred fix. See Google's hardware-device setup documentation.
Back up photos, documents, application exports, authenticator recovery codes and any other important data to an independent device. Verify the copies before continuing. Android's ordinary file-transfer access is not a complete backup of private application data.
While still on stock Android, test cellular service, SMS, Wi-Fi and other hardware. Remove your own Google account before a planned factory reset where the ROM guide requires this, and ensure you know your own Xiaomi and Google credentials.
Enable Developer options using the OS version entry in Settings, then enable USB debugging. For a locked phone, follow the Xiaomi bootloader unlock FAQ and the instructions applicable to its region and MIUI/HyperOS version. Eligibility, approval and waiting periods can vary. The official Mi Unlock desktop workflow may require Windows even though the subsequent flashing does not. Do not attempt to bypass account authorization, Factory Reset Protection or unlock waiting periods.
Unlocking normally wipes data; re-enable USB debugging after setting the phone up again. An unlocked bootloader changes the device's security posture. Some banking applications, DRM services or enterprise applications may no longer work as expected. Do not relock a bootloader while a custom or mismatched regional ROM is installed.
Start in a running Android system with USB debugging enabled. Authorize the computer on the phone only if it is your trusted machine.
adb devices -l
adb -d shell getprop ro.product.device
adb -d shell getprop ro.build.product
adb -d shell getprop ro.build.version.release
adb -d reboot bootloader
Alternatively, on many Xiaomi devices, power off and hold Volume Down and Power to enter Fastboot. The exact key combination is model-dependent.
In Fastboot:
fastboot devices
fastboot getvar product
fastboot getvar unlocked
fastboot getvar current-slot
fastboot getvar is-userspace
Not every bootloader implements every variable; an unsupported-variable error is not proof that a device is unlocked or that it lacks slots. Check the unlock state through the supported device method. Product properties can also differ from the commercial name, so compare them against the exact maintainer documentation. Fastboot normally writes variable output to standard error; this is not inherently a failure.
Disconnect other Android devices before flashing. When you need to explicitly target a device, use fastboot -s SERIAL ... with the actual serial shown by Fastboot. Avoid posting your device serial or complete diagnostic output publicly.
Compare the SHA-256 hash with the value published by the ROM maintainer, where available. A hash calculated locally without a trusted expected value cannot establish authenticity.
Linux:
sha256sum "$HOME/Downloads/roms/rom.zip"
macOS:
shasum -a 256 "$HOME/Downloads/roms/rom.zip"
Check the recovery and other required images separately. Retain the original filenames or deliberately rename them and use the renamed paths consistently. Do not disable signature or verification checks to get around a failed download.
| Package | Common installation method |
|---|---|
| LineageOS or another recovery-installable ZIP | Compatible recovery and ADB sideload, as directed by maintainer |
| Xiaomi.eu fastboot or hybrid ZIP | Extract and use the included platform-specific shell script when supported |
| Fastboot-update archive | fastboot update only when specifically documented by the ROM maintainer |
| Official Xiaomi fastboot TGZ | Extract and use the supplied compatible stock flashing script, if provided |
| Official recovery OTA ZIP | Supported stock update or recovery procedure, not generic Fastboot flashing |
An ordinary recovery ZIP is not a partition image. Do not use fastboot flash system rom.zip. Do not extract a payload.bin and guess which partitions to flash. It is the maintainer's installation procedure, not the filename extension by itself, that determines the correct method.
LineageOS illustrates why an installation guide cannot supply one universal recovery command for all Xiaomi devices. Use the maintainer's current instructions in full, including the exact firmware prerequisite and any additional images or slot-consistency steps. The following examples demonstrate differences in the recovery target, not complete interchangeable flashing recipes.
For the supported sweet variant and a release whose official installation instructions specify a dedicated recovery image, the recovery stage uses these commands. Download the appropriate recovery.img and matching ROM ZIP, then open the directory containing them. Verify the device and bootloader status before proceeding.
cd "$HOME/Downloads/roms/sweet"
fastboot devices
fastboot getvar product
Only when the model, release and firmware requirements match the guide:
fastboot flash recovery recovery.img
fastboot reboot recovery
Confirm the correct recovery appears before continuing. A successful Fastboot command alone does not prove that the image is compatible.
For the documented alioth installation, recovery is supplied in vendor_boot.img; the maintainer also specifies prerequisite boot.img and dtbo.img flashes and a slot-consistency procedure. For the documented venus installation, the recovery image is boot.img, with additional prerequisites in its guide. Do not substitute the Redmi example for these devices.
See the POCO F3 installation guide and Xiaomi Mi 11 installation guide for the exact sequence. These details can change between ROM releases. Always use images from the matching build and complete the required preparatory steps before installing the ROM.
Once the maintainer's required recovery is running and every preparation step is complete, follow its clean-install procedure. For Lineage Recovery, first-time installation commonly requires formatting data from the recovery menu. This erases internal storage. Do not format on an ordinary update unless the guide says to do so.
After formatting as required, select the recovery option for applying an update over ADB. Then, on the computer:
adb devices
adb -d sideload "$HOME/Downloads/roms/rom.zip"
With downloaded tools that are not on PATH, run the same operation from their folder:
cd "$HOME/android-tools/platform-tools"
./adb -d sideload "$HOME/Downloads/roms/rom.zip"
Read the result on the recovery screen, not just the computer's percentage. Some successful LineageOS transfers stop around 47% on the host. A real recovery installation failure or invalid ROM signature is different; stop and investigate rather than rebooting into an incomplete installation.
If the ROM requires an add-on such as Google Apps, install only the version and architecture specified by the maintainer, at the stage the guide specifies. Some ROMs already bundle these applications. Complete required add-ons and recovery reboots before the first system boot. Once all required steps have succeeded, select the recovery's system-reboot option.
Xiaomi.eu is a community-modified Xiaomi-based ROM, distinct from official Xiaomi firmware and AOSP-derived ROMs. Some builds include host-specific installation scripts. This route is particularly useful when the build explicitly supports installing directly from Fastboot without a separate custom recovery.
Download the correct package from the Xiaomi.eu community. Read the release and device instructions, verify compatibility and unlock status, and back up the phone. Some packages have additional regional or modem requirements. The MIUIPolska device guide documents examples of these Linux and macOS scripts and illustrates why regional instructions matter.
Extract the fastboot-capable package into a new directory:
mkdir -p "$HOME/Downloads/roms/xiaomi-eu"
unzip "$HOME/Downloads/roms/xiaomi-eu.zip" -d "$HOME/Downloads/roms/xiaomi-eu"
cd "$HOME/Downloads/roms/xiaomi-eu"
ls -la
find . -maxdepth 2 -name '*.sh' -print
If the archive created another enclosing directory, enter it. Inspect the supplied script before execution, check which host executable it calls, and retain the original folder layout. Some scripts use a bundled Fastboot binary rather than the global installation. Do not download individual binaries from unrelated sites or remove the script's device checks.
Older packages may use these clean-install script names (choose only your computer's OS and only the filename present in your package):
# Linux example; erases data
bash ./linux_fastboot_first_install_with_data_format.sh
# macOS example; erases data
bash ./macos_fastboot_first_install_with_data_format.sh
Newer packages may instead supply:
# Linux example; erases data
bash ./linux_install_and_format_data.sh
# macOS example; erases data
bash ./macos_install_and_format_data.sh
Use the launch method prescribed by the release; where it expects direct execution, set the executable bit on that specific trusted script and run it with ./. Before executing, verify the phone is in Fastboot, the computer detects it, and you are using the correct clean-install or upgrade path. Read every prompt. Stop if a command fails, and do not unplug during a partition write.
Upgrade scripts may have names such as linux_fastboot_update_rom.sh or macos_install_upgrade.sh. They are only for supported upgrades of an existing compatible installation, not a way to avoid data formatting on the initial installation.
On many recent Android devices, logical partitions such as system and vendor reside in a dynamically allocated super partition. Bootloader Fastboot and userspace Fastbootd are not interchangeable. A ROM's official flashing process may switch between them automatically.
If the device-specific instructions require Fastbootd, the standard transition and check are:
fastboot reboot fastboot
fastboot getvar is-userspace
A yes response identifies userspace mode on a device implementing the variable. In Fastbootd, fastboot devices remains the relevant detection command. Do not manually erase, resize or recreate logical partitions to work around an error. See the Android fastbootd documentation and dynamic partition architecture.
If you decide to return to MIUI or HyperOS, use an official fastboot ROM matching the exact model, original region and supported firmware version. Returning from a custom ROM generally requires a clean installation. Do not assume a data-preserving script will retain encrypted data, or relock the bootloader during an unverified restoration.
The stock ROM flashing guide explains how to inspect Xiaomi's supplied scripts, choose the correct flashing mode and run them on Linux or macOS using global or portable Fastboot.
| Problem | What to check |
|---|---|
adb: command not found |
Use the extracted binary with ./ or fix PATH. |
unauthorized in ADB |
Unlock the screen and approve the trusted host. |
no permissions |
Correct Linux udev rules and group membership. |
| Fastboot device list is empty | Confirm bootloader mode, data cable and USB port. |
| Waiting for any device | Stop before writing; resolve USB detection and verify target. |
| Product mismatch | Stop; verify exact model and ROM. Never remove compatibility checks. |
| Flashing is not allowed | Check official unlock status and supported procedure. |
| Partition does not exist | Check model, image target and required Fastboot/Fastbootd mode. |
| Invalid sparse image or insufficient space | Verify download, tool version and maintainer instructions; do not delete partitions. |
| Recovery signature failure | Verify the official ROM and download; do not force installation. |
| Sideload percentage stalls | Read recovery's actual success/error result before proceeding. |
| Persistent boot loop | Review firmware, recovery, format and add-on requirements before attempting restoration. |
For USB troubleshooting, these commands are useful without writing to partitions:
adb kill-server
adb start-server
adb devices -l
fastboot devices
On Linux, lsusb can confirm whether the host sees a USB device. On macOS, system_profiler SPUSBDataType provides similar information. ADB and Fastboot normally detect the phone in different modes, not simultaneously.
If the phone no longer exposes a supported bootloader or recovery interface, stop experimenting with unrelated images. Emergency download or manufacturer service modes can require authorized repair access. Do not use untrusted loaders, test-point shortcuts or account-bypass utilities.
Before making the phone your primary device, verify calls, SMS, mobile data, Wi-Fi, Bluetooth, cameras, audio, charging, fingerprint recognition, GPS and storage. Check the security patch level, update mechanism, encryption status and application compatibility. Keep the correct stock recovery resources and a copy of your installed ROM. Disable USB debugging when it is no longer needed, and keep the device physically secure.
Linux and macOS provide the tools needed for these installation methods without Mi Flash. The ROM, firmware prerequisites and partition layout still depend on the device, so use the matching maintainer instructions for each installation.