Firmware TWRP via Fastboot on Xiaomi: detailed instructions with unlocking the bootloader

Installing custom TWRP on Xiaomi smartphones gives you access to advanced features: backup creation, custom software firmware, root rights, and even repairing brick-and-brick devices. However, the process requires care β€” a mistake at any stage can turn a phone into a brick. In this article, we will analyze the step-by-step instructions for TWRP firmware through Fastboot, including unlocking the bootloader, preparing tools and solving typical problems.

It’s important to understand that Xiaomi actively blocks the installation of unofficial firmware, so with each update to MIUI, the process becomes more complicated. For example, new models (for example, Xiaomi 13/14 or Redmi Note 12) may require additional disabling of Anti-Rollback or the use of special versions of TWRP. We will take into account these nuances and provide relevant solutions for 2026.

1.Preparation: What you will need before the firmware

Before you start, make sure you have everything you need, and without proper preparation, the risk of error increases dramatically.

  • πŸ“± Xiaomi smartphone with unlocked bootloader (instruction below). Supported models from Redmi 4X Xiaomi 14 Ultra, but new devices (2023–2026) may require additional steps.
  • πŸ’» Computer on Windows 10/11, macOS or Linux. On Windows, be sure to turn off driver signature verification (spoiler instruction).
  • πŸ”Œ Cable USB (Cheap cables can cause fastboot errors due to poor contact.
  • πŸ“ Firmware Files: Official Fastboot ROM For your model (downloaded from Xiaomi site). Latest version TWRP For your device (see twrp.me or XDA Developers. Tools ADB Fastboot (you can download it as part of Platform Tools).

Also check:

  • πŸ”‹ The battery charge of the smartphone is at least 70%, interruption of the process due to discharge is almost guaranteed to lead to "brickingΒ».
  • πŸ“‘ Stable Internet connection (if you download files in the process).
  • πŸ“ Backup of important data. TWRP It does not erase data by itself, but unlocking the bootloader will reset the device to factory settings.
How to disable driver signature verification on Windows

1. Press Win + X β†’ select Command Prompt (Administrator).

2. Enter the command:

bcdedit /set nointegritychecks on

3. Restart the computer. After installing the drivers, return the settings with the command:

bcdedit /set nointegritychecks off

Warning: If you use Xiaomi with a MediaTek processor (such as the Redmi Note 11 or POCO M4 Pro), the bootloader unlocking process may be different. These devices require a dedicated MTK Client or SP Flash Tool.

2. Unlock the bootloader on Xiaomi

Without unlocking the loader, flash TWRP Xiaomi requires official permission to unlock through the Mi Account, which takes up to 72 hours (on new devices) or is instantaneous (on older models).

  1. Link Mi Account to your device: Go to Settings β†’ Xiaomi Account. Sign in (if not, sign up). Activate Settings β†’ Additional β†’ Unlock OEM (may be called OEM Unlocking). Enable USB Debugging in Settings β†’ About Phone β†’ MIUI Version (click 7 times on the line with the version, then return to Settings β†’ Additional β†’ For Developers).
  2. Download and install Mi Unlock Tool on your computer.
  3. Connect your phone to your PC in Fastboot mode: Turn off the device. Press Volume down + Power before the Fastboot logo appears.

Launch the Mi Unlock Tool, log in to the same Mi Account as the phone, and follow the instructions. If a Couldn't unlock or Wait 72 hours message appears, wait for the specified time.

πŸ“Š What Xiaomi model are you using?
Redmi Note 10/11/12
POCO F/X
Xiaomi 11/12/13
Another model

Attention: On devices with MIUI 14+ and new processors (Snapdragon) 8 Gen 2/3) You may need to turn off the anti-rollback protection, and you need to flash a special anti-rollback patch through the TWRP... But how do you set it up if TWRP The solution is to use a temporary solution. TWRP In fastboot boot mode (more on this in the next section).

3. Install ADB and Fastboot: Step-by-step customization

The ADB (Android Debug Bridge) and Fastboot tools are required to communicate with the device via the command line, and can be installed in two ways:

  • πŸ“¦ Download Platform Tools from Google (recommended): Download the archive from the official website. Unpack to the root of the disk C:\platform-tools (Path without spaces!) Add a folder to the environment variables: Open the Control Panel β†’ System system β†’ Additional system parameters β†’ In the Path section, add a path to the platform-tools folder.

Installation through Android Studio

  • Download Android Studio.
  • Select SDK Manager β†’ SDK Tools β†’ Android SDK Platform-Tools.

Check the operation of the tools:

  1. Open the Command Prompt (Win + R β†’ enter cmd).
  2. Enter the command: fastboot devices If the device is connected in Fastboot mode, you will see its serial number. If not, check the drivers (download Mi USB Driver).

πŸ’‘

If the fastboot command is not recognized, try running the command prompt on behalf of the administrator or specify the full path to the file, for example:

C:\platform-tools\fastboot devices

4. TWRP firmware via Fastboot: step-by-step instruction

Now, we move on to the most important step - firmware TWRP. Follow the instructions carefully, as an error in this step can lead to data loss or "bricking" the device.

β˜‘οΈ Firmware preparation TWRP

0

Downloaded file TWRP for your model (for example, twrp-3.7.0_12-raphael.img)|Device in Fastboot mode (bunny logo)|Drivers. ADB/Fastboot fixed|Backup copy of data created

Step 1. Check the connection

Connect your phone to your PC and execute the command:

fastboot devices

If the device is identified (a serial number appears), move on. If not, check the cable, USB port or drivers.

Step 2. TWRP firmware

Move a TWRP file (such as twrp.img) to the platform-tools folder and do:

fastboot flash recovery twrp.img

For some models (Xiaomi) 12/13, Redmi K50) may need to be sewn TWRP slot-in (recovery_a and recovery_b):

fastboot flash recovery_a twrp.img


fastboot flash recovery_b twrp.img

Step 3: Banning TWRP overwriting

By default, MIUI overwrites TWRP with standard recaps on the first boot. To avoid this, immediately after the firmware, do:

fastboot boot twrp.img

The device will load into a temporary TWRP.

  1. Go to Advanced β†’ Flash Current TWRP (if you have one).
  2. Or manually flash a zip file from TWRP (downloaded separately from twrp.me).

Step 4: Reboot

After successful firmware, restart the device to TWRP:

fastboot reboot recovery

πŸ’‘

If you are in a standard reboot MIUI, signifier TWRP It was overwritten. 3 or disable_forced_encryption.zip (encryption-based FBE).

5. Solving Typical Firmware Errors in TWRP

Even if you follow the instructions accurately, you can get errors, and let's look at the most common ones and how to fix them.

Mistake.Reason.Decision
fastboot: error: cannot load 'twrp.img'TWRP file not found or corruptedCheck the path to the file or download it again. Use the full path, for example: fastboot flash recovery C:\twrp\twrp.img
FAILED (remote: 'Flashing is not allowed in Lock State')The bootloader is not unlockedRepeat the unlocking process through the Mi Unlock Tool. If you wait 72 hours, wait.
Invalid sparse file format at header magicIncompatible version of TWRP or corrupted fileDownload TWRP from the official website for your model. Newer devices (Xiaomi 13) may require.img.tar TWRP.
The device is loaded into MIUI Recovery, not TWRPMIUI re-recorded TWRP when downloadedPlease. disable_dm-verity_forceencrypt.zip temporary TWRP (Get the fastboot boot command twrp.img).

Note: If the device does not turn on after TWRP firmware (black screen, vibration without logo), there is likely an error when unlocking the bootloader or firmware Anti-Rollback.

  1. Try booting up to Fastboot (Loudness Down + Power).
  2. Sweep through the official firmware via the Mi Flash Tool (select the clean all option).
  3. If it doesn’t help, contact the service center (you may need to sell EMMC).
What if the Mi Unlock Tool can’t see the device?

1. Check that the phone is in Fastboot mode (the rabbit logo).

2. Install Mi USB Driver drivers manually through Device Manager.

3. Try another one. USB-port (preferably) USB 2.0).

4. disable the antivirus (it can block the Mi Unlock Tool).

5. Use another computer (some Windows 11 PCs have compatibility issues).

6. Additional settings after installing TWRP

After a successful firmware TWRP, it is recommended to perform several actions for stable operation:

  • πŸ” Turn off forced encryption (if enabled): Download disable_dm-verity_forceencrypt.zip (So, for example, from here. TWRP (Install β†’ Select a file β†’ Swipe to Confirm).
  • πŸ“± Create a backup: In TWRP Go to Backup. Select the Boot, System, Data (optional) sections EFS For models with MediaTek, save the backup to SD-card.
  • πŸ”„ Set up autoload in TWRP (for devices where MIUI Recapitalizes Recovery: Install the module TWRP A/B Retainer (available on XDA). Or patch it. no_verity_opt_encrypt.zip.

On dynamic partitions devices like the Xiaomi 12T or POCO F4, the standard backup in TWRP may not work, and use alternative tools like OrangeFox Recovery or PitchBlack Recovery.

7. Firmware custom software through TWRP

Now that TWRP is installed, you can flash custom firmware (like LineageOS, Pixel Experience) or get root rights through Magisk.

  • πŸ“Œ Check firmware compatibility with your model. For example, the firmware for the Redmi Note 10 Pro (sweet) will not work for the Redmi Note 10 (mojito).
  • πŸ”„ Drop it. Dalvik/Cache after firmware (in) TWRP: Wipe β†’ Advanced Wipe β†’ Dalvik/ART Cache, Cache).
  • πŸ›‘οΈ Turn off signature verification (if you are running unofficial software): fastboot flashing unlock_critical Warning: This command can lead to loss of warranty and increase the risk of brickingΒ»!

Example of Magisk firmware for root rights:

  1. Download the latest version of Magisk from GitHub.
  2. Move the Magisk-v26.4.zip file to your phone.
  3. In TWRP, select Install β†’ Specify the Magisk β†’ Swipe to Confirm file.
  4. Reset the device.

Note: On devices with MIUI 14+ and 5.10+ core (e.g. Xiaomi 13 Ultra), Magisk may not work due to System-as-Root (SAR) protection, in which case use alternative rooting methods, such as through boot.img patch.

8.Restore the device after a failed firmware

If something goes wrong and the phone stops turning on, don't panic. In most cases, the device can be restored.

  • πŸ”§ Method 1: Download the official software via Mi Flash Tool download Fastboot ROM Unpack the archive into a folder without spaces (e.g, C:\Xiaomi\ROM). Connect your phone in Fastboot mode. Launch the Mi Flash Tool, point the way to the folder with the ROM and press Refresh. Select the clean all option and click Flash.

Method 2: Recovery through EDL-mode (for advanced)

  • Suitable for devices with damaged bootloader.
  • An EDL cable or short circuit of test points on the board is required.
  • Mi Flash Pro or QFil (for Qualcomm) is used.

Warning: Firmware over EDL may cause IMEI loss or NFC/Wi-Fi module problems on some models (e.g. Redmi Note 9 Pro).Be sure to have a backup of modem and EFS partitions before using this method.

πŸ’‘

If after firmware is installed through the Mi Flash Tool, the device is loaded into the MIUI Recovery with this error MIUI version cannot be installed on this device, so you have flashed the software with the lower version of Anti-Rollback. MIUI.

FAQ: Frequent questions about the firmware TWRP on Xiaomi

❓ Can I stitch it? TWRP loader-free?
No, it's impossible. Xiaomi blocks the recovery entry on locked devices. Any attempts to circumvent this restriction (e.g., through exploits) result in data loss or bricking. The only legal way is to officially unlock through the Mi Unlock Tool.
❓ Why after the firmware? TWRP phone out?
There are several reasons: Incompatible version of TWRP (for example, flashed the version for Redmi Note 10 on Redmi Note 10 Pro); error when unlocking the bootloader (for example, it didn’t wait for 72 hours); TWRP firmware on top of the custom core or Magisk. Solution: Swipe the official firmware through Fastboot (instruction in section 8).
❓ How to sew TWRP Xiaomi with MediaTek processor?
For devices on MediaTek (e.g. Redmi Note 11, POCO M4 Pro) process is different: Unlock the bootloader via Mi Unlock Tool (similar to Snapdragon). SP Flash Tool and firmware in Scatter format. SP Flash Tool select only the recovery partition and specify the file TWRP. Connect the phone that is off (no battery if it is removable) and press Download. SP Flash Tool can cause damage NAND-memory!
❓ Should I stitch? TWRP slot-in (A/B)?
Yes, on slot-divided devices (A/B Partitions – for example, Xiaomi 11/12/13, POCO F3/F4 β€” need to sew TWRP In both slots: fastboot flash recovery_a twrp.img fastboot flash recovery_b twrp.img After the update MIUI The Recovery will be re-recorded.
❓ Can I update you? MIUI post-installation TWRP?
Yes, but with caution: Update only through TWRP (Switch the zip file with MIUI). Don't use it. OTA-updates - they'll re-write TWRP Recovery may require a re-routing of Magisk or disable_dm-verity.