How to flash Xiaomi Redmi 5A through your computer: a complete guide with photos

Xiaomi Redmi 5A (codename riva is one of the most popular budget smartphones of the brand, but even it requires periodic firmware updates. MIUI, So if you go to custom firmware like LineageOS, or if you repair your phone after a crash, it's the most reliable way to run it through your computer. OTA-This method gives full control over the process, minimizes the risks of "bricking" and allows you to choose a specific version of the software.

But the process has nuances, from unlocking the bootloader to choosing the right tool (Mi Flash Tool, Fastboot or SP Flash Tool), and in this article, weโ€™ll look at everything from PC preparation to the final phone reboot, and also warn against the typical mistakes that will turn your Redmi 5A into a โ€œbrick.โ€ If youโ€™ve never flashed a Xiaomi smartphone before, start with an introductory section about the types of firmware and their differences.

Types of firmware for Redmi 5A: which one to choose?

Before you download files, decide on the purpose of the firmware.

  • ๐Ÿ“ฅ Official. MIUI โ€” stable and beta versions from Xiaomi. Suitable for recovery or upgrade to the latest firmware. Available in formats: Fastboot - for firmware through Mi Flash Tool (recommended for beginners), Recovery - for installation through stock recovery (limited functionality).
  • ๐Ÿ› ๏ธ Custom firmware - LineageOS, Pixel Experience, Havoc-OS. Give advanced settings, current software (for example, Android 12 instead of stock Android 7.1), but require an unlocked bootloader and TWRP.
  • ๐Ÿ”„ Unlock firmware โ€“ special builds (e.g. EDL-mode) that are used to recover the phone after a failed manipulation.

The following official versions of MIUI (as of 2026) are relevant for the Redmi 5A:

Type of firmwareAndroid versionThe latest version of MIUIDownload link
A stable global7.1.2 (Nougat)MIUI 12.5.3Official website
Stable Chinese7.1.2MIUI 12.5.6Miui.com
Castomic (LineageOS)11.018.1 (informal)XDA Developers

Important: Firmware of the Chinese version of MIUI on the global model (and vice versa) will lead to broken Google services or problems with IMEI. Check the region of your phone in Settings โ†’ About Phone โ†’ MIUI version.

๐Ÿ“Š Why are you using Redmi? 5A?
Update to the new version of MIUI
Installation of custom firmware
Recovery after failure
Unlocking the loader
Another option

Preparation of the computer and telephone

Incorrect preparation is the cause of 80% of firmware failures. Follow the checklist to avoid errors:

Install Xiaomi drivers (Qualcomm + ADB)

Download the firmware for your model (riva)

Charge your phone at least 60%

Create a backup copy of data (photos, contacts, SMS)

Disable the antivirus (it can block the Mi Flash Tool)

Prepare. USB-cable (original or high quality)

-->

First, install the drivers. Without them, the PC won't recognize the phone in Fastboot or EDL mode:

  1. Download the Qualcomm driver and ADB/Fastboot.
  2. Unpack the archives in the folder C:\adb.
  3. Connect your phone to your PC in Fastboot mode (clip Volume Down + Power when your phone is off).
  4. In Device Manager, update the driver for the Android Bootloader Interface device, indicating the path to the unpacked files.

To run through the Mi Flash Tool, you will also need:

  • ๐Ÿ–ฅ๏ธ Windows 7/10/11 (64-bit). Nana macOS/Linux Use alternatives like fastboot in the terminal.
  • ๐Ÿ”Œ Original. USB-Cheap cables can interrupt data transmission.
  • ๐Ÿ“ Firmware folder unpacked into the path without Cyrillic (for example, C:\MIUI\fastboot_riva_global).

๐Ÿ’ก

If the Mi Flash Tool doesnโ€™t see the phone, try connecting it to a USB 2.0 port (usually black) โ€“ USB 3.0 ports (blue) sometimes cause driver problems.

3. Unlocking the bootloader (Bootloader)

Without unlocking the bootloader, you can flash only the official MIUI through the Mi Flash Tool. For custom firmware or TWRP, unlocking is mandatory.

Xiaomi allows unlocking, but the process requires confirmation through the Mi Account:

  1. Link Mi Account to your phone in Settings โ†’ Xiaomi Account.
  2. Enable OEM Unlock in Settings โ†’ For developers (if there is no item, activate the developer mode by clicking 7 times on the Build Number in About Phone).
  3. Download Mi Unlock Tool and log in to the program.
  4. Connect your phone in Fastboot mode and follow the instructions in the program. Usually, it takes 72-360 hours to unlock (depending on Xiaomi policy).

โš ๏ธ Attention: Unlocking the bootloader will reset the phone to factory settings. Xiaomi can also block the ability to unlock if the phone was bought from unofficial sellers (check Settings). โ†’ The phone. โ†’ Status of device).

If the Mi Unlock Tool is running a "Couldn't unlock" error, try it.

  • ๐Ÿ”„ Reconnect the phone to another USB-port.
  • ๐Ÿ“ฑ Make sure that SIM-map inserted (sometimes required to confirm region).
  • ๐Ÿ•’ Wait 1-2 weeks and try again (Xiaomi limits the frequency of requests).

4. firmware via Mi Flash Tool (official MIUI)

Mi Flash Tool is Xiaomiโ€™s official Fastboot firmware tool, suitable for installing stock MIUI (including downgrade) and recovering the phone after crashes.

Step-by-step:

  1. Download and install the Mi Flash Tool.
  2. Unpack the Fastboot firmware into a folder (for example, C:\MIUI\riva_global_images_...).
  3. Run the Mi Flash Tool on behalf of the administrator.
  4. Connect the phone to the PC, keeping Volume down + Power (Fastboot mode).
  5. In the program, click Select and specify the path to the folder with the firmware.
  6. Select firmware mode: Clean all - complete cleaning (recommended when changing the version of MIUI), Clean all and lock - cleaning + lock bootloader (only for official firmware), Save user data - data storage (not always stable).

Flash

If the process is stuck on Waiting for device, check:

  • ๐Ÿ”Œ Connection USB (Try another cable/port).
  • ๐Ÿ–ฅ๏ธ Drivers installed (Device Manager should display Android Bootloader Interface).
  • ๐Ÿ“ The path to firmware does not contain Cyrillic or gaps.
What to do if the Mi Flash Tool is an error "flash_all_lock.bat"
This error occurs when you try to flash the locked bootloader. Solutions: 1. Unlock the bootloader through the Mi Unlock Tool (see section 3). 2. If the phone is already unlocked, download the firmware without the prefix " lock" in the file name. 3. Use the command manually via fastboot: fastboot flash all (indicating the path to the firmware file).

5. custom firmware (TWRP + Custom ROM)

Installing LineageOS, Pixel Experience or other custom firmware requires TWRP, an alternative recovery process that is more complex than the Mi Flash Tool, but provides more features.

Steps to install TWRP and custom firmware:

  1. Unlock the bootloader (see Section 3).
  2. Download. TWRP for Redmi 5A (file twrp-3.7.0_9-0-riva.img).
  3. Open the command line in the folder with fastboot and execute: fastboot flash recovery twrp-3.7.0_9-0-riva.img fastboot boot twrp-3.7.0_9-0-riva.img
  4. In TWRP, make a backup of the NVRAM partition (saves IMEI!).
  5. Download custom firmware (like LineageOS) and GApps (if you need Google services).
  6. In TWRP, run Wipe โ†’ Advanced Wipe (mark Dalvik, Cache, System, Data).
  7. Install firmware and GApps via Install.
  8. Reboot (Reboot โ†’ System)

โš ๏ธ Note: After installing custom firmware may stop working: ๐Ÿ“ถ Communication modules (IMEI, Wi-Fi, Bluetooth โ€“ if not saved NVRAM. ๐Ÿ”‹ Battery optimization (castomy cores sometimes increase consumption). ๐ŸŽฎ Xiaomi services (such as Mi Cloud or Game Turbo). Before checking firmware reviews on the build XDA Developers.

๐Ÿ’ก

Custom firmware requires manual adjustment after installation: often you have to manually calibrate the battery, configure root (Magisk) rights, and install camera patches.

6. Firmware in EDL mode (emergency recovery)

EDL (Emergency Download Mode) is used when the phone is not turned on, not detected in Fastboot, or after a failed firmware. This method works at the level of the Qualcomm processor and requires special tools.

You'll need:

  • ๐Ÿ–ฅ๏ธ Mi Flash Pro or QFilm.
  • ๐Ÿ“ Firmware in.mbn or.elf format (for example, an archive with firmware).
  • ๐Ÿ”ง Debugging cable or testpoint (for forced transfer to the EDL).

Instructions for Mi Flash Pro:

  1. Connect the phone to the PC, holding Volume up + Volume down + Power (if the phone doesn't respond, you'll need to close the testpoint).
  2. Device Manager should appear Qualcomm HS-USB QDLoader 9008.
  3. In Mi Flash Pro, select firmware and press Flash.
  4. Wait until the process is completed (it can take up to 30 minutes).

Critical: Firmware in EDL without the right firmware can damage the Communications Module (IMEI).Always check file compatibility with the Redmi 5A (riva) model.

7.Typical errors and their solutions

Even when you follow the instructions, you can get errors, and here are the most common ways to correct them:

Mistake.Reason.Decision
Waiting for device in Mi FlashNot installed drivers or phone not in Fastboot modeCheck the connection, reinstall the drivers, try another USB-port
Invalid sparse file format at headerA damaged firmware fileDownload the firmware again, check the checksum (MD5)
The phone is stuck on the Mi logoIncompatible firmware or incomplete cleaningFlush back with full wipe (Clean all in Mi Flash)
This MIUI version cannot be installed on this deviceFirmware for another regionDownload the firmware for your region (global/eea/ru)
No network after firmwareDamaged by NVRAM (IMEI)Restore the NVRAM backup or run the original modemst1.stock.tar.gz

If the phone stops turning on after the firmware:

  1. Try going to Fastboot (Loudness Down + Nutrition).
  2. If it does not respond, transfer to EDL (see section 6).
  3. In extreme cases, contact the service center (a programmer may be required to restore the IMEI).

FAQ: Frequent questions about Redmi firmware 5A

โ“ Can I get Redmi to flash? 5A loader-free?
Yes, but only official MIUI via Mi Flash Tool in Fastboot mode. For custom firmware or TWRP, unlocking is mandatory.
โ“ How to return stock firmware after custom?
Download the Fastboot firmware for your model from the official website and swipe through the Mi Flash Tool with the Clean all and lock option. This will block the bootloader back.
โ“ Why the camera doesnโ€™t work after the firmware?
Custom firmware often lacks proprietary drivers for Xiaomi's camera. Solutions: Install the ANX Camera or GCam patch. Sweep stock firmware with the Save user data option (if the camera has worked before).
โ“ How to check if the bootloader is unlocked?
Turn off your phone and press Volume Down + Power. If you see Unlocked at the bottom of the screen and a yellow icon, the bootloader is unlocked. If Locked is locked.
โ“ Can I get Redmi to flash? 5A recover?
Technically, yes, but Xiaomi's stock Recovery only supports official.zip updates without changing the Android version. TWRP.