How to flash Xiaomi Mi4 through your computer: a detailed guide with nuances

The Xiaomi Mi4, released in 2014, is still popular with enthusiasts thanks to its powerful β€œstuffing” and custom firmware installation capabilities. However, over time, official support for the device has ceased, and users face performance problems, lack of security updates or the desire to install the latest version of Android.

Unlike modern Xiaomi models, where firmware is often run through OTA or built-in recovery, the Mi4 (codename cancro) requires a computer and special tools. In this article, we will discuss all the steps from preparing drivers to choosing the right firmware version to solving typical errors.

Preparation for firmware: what you need to know before you start

The Xiaomi Mi4 firmware is a process that can both revitalize the device and turn it into a brick if you neglect the preparation. The first thing you need to do is determine the current firmware version and the status of the bootloader.

  • πŸ“± Go to Settings. β†’ The phone. β†’ Version. MIUI And write down the assembly number.
  • πŸ” Find out the status of the bootloader: turn off the phone, press Volume down + Power and look at the screen. If you see this device is locked, unlock is mandatory.
  • πŸ’» Prepare your computer: install the Mi Unlock Tool (the official tool from Xiaomi) and drivers ADB/Fastboot.

Important: Xiaomi Mi4 It has two modifications: Cancro (LTE) and cancro_td (3G Installing firmware from another modification will result in a broken communication or a complete system failure.

⚠️ Attention: If yours Mi4 previously sifted informal assemblies, may have already installed custom loader (for example, TWRP). In this case, unlocking through the Mi Unlock Tool is not required, but the risk of errors when firmware increases.

Also note that after unlocking the bootloader, all data, including photos and apps, will be deleted from the device. We recommend backing up through the Mi PC Suite or manually copying files to your computer.

πŸ“Š What firmware you plan to install on Xiaomi Mi4?
Official MIUI
LineageOS or other caste
Stock Android (AOSP)
I don't know, looking for advice.

Firmware selection: official MIUI vs custom builds

Not only does the Mi4’s functionality depend on firmware selection, but it also depends on the stability of the work. Xiaomi’s official MIUI builds provide maximum compatibility with hardware, but often outdated (the latest version for the Mi4 is MIUI 10 based on Android 7.0). Castom firmware such as LineageOS or Pixel Experience offer up-to-date Android, but may have bugs with a camera or NFC module.

Type of firmwareAdvantagesDeficienciesRecommendation
Official MIUIStable work, full iron support, OTA-Updates (if available)An outdated version of Android, no new featuresFor everyday use without claims to relevance
LineageOSAndroid 11-13, minimalist interface, regular updatesMay not work: NFC, encryption, some sensorsFor enthusiasts ready for manual tuning
Pixel ExperiencePure Android with Google chips, good optimizationPossible lags, productivity problemsIf you need a stock Android without MIUI
Custom MIUIs (e.g. MIUI EU)Relevant MIUI functions, removed by BloatwareNo official support, possible bugsFor MIUI fans, but with improvements

Where to download firmware:

  • 🌍 Officially MIUI: Xiaomi website (select the version for cancro).
  • πŸ”§ Castomic assemblies: XDA Developers (Look for themes for Xiaomi) Mi4).
  • πŸ“¦ Firmware Updater (alternative source).

Critical: firmware should be in.tgz or.zip format for MiFlash, or.img format for Fastboot. Files with the.exe or.bat extension are scripts that can contain malicious code.

Unlocking the bootloader: a step without which you can not do

The Xiaomi Mi4 bootloader is locked by default, and unlocking it is a must for installing any unofficial firmware.The process takes between 3 and 720 hours (yes, it's not a typo) due to Xiaomi's policy, which requires waiting to "check your account." Here's how to do it correctly:

  1. Link your Mi Account to your device: πŸ“± Go to Settings. β†’ Mi Account β†’ Linking your account to your device. πŸ”‘ Make sure that your account has two-factor authentication enabled.
  2. Install the Mi Unlock Tool: πŸ’» Download the utility from the official website. πŸ”§ Launch it on behalf of the administrator and log in to your Mi Account.
  3. Connect your phone in Fastboot mode: πŸ”Œ Turn it off. Mi4, Hold the volume down + Food before the appearance of a hare in a hat-eared. πŸ–₯️ Connect the device to the PC through USB (Use the original cable!).
  4. Start unlocking: ⏳ In the utility, press Unlock and wait for a message about a successful unlock or waiting timer. πŸ•’ If you have a message, you can't unlock. XX Turn off the phone and try again at the specified time.

⚠️ Note: If you previously unlocked the bootloader on this device, but then flashed the official bootloader MIUI, The lock could have returned, and then you'll have to repeat the procedure.

Once successfully unlocked, the phone will automatically reset to factory settings. Don't be alarmed, that's okay. Now you can start the firmware.

πŸ’‘

If the Mi Unlock Tool doesn’t see the device, try disabling the driver signature in Windows: run the command prompt from the administrator and perform bcdedit/set nointegritychecks on, then restart the PC.

Install firmware through MiFlash: step-by-step instructions

MiFlash is Xiaomi’s official Fastboot firmware utility, suitable for both stock and custom firmware installations (if adapted to this tool).

Download and unpack firmware in a folder without Cyrillic|Install Qualcomm drivers (if MiFlash can’t see the device)|Disable the antivirus (it can block firmware files)|Charge your phone at least 60%|Connect the original USB-cable

-->

  1. Download and install MiFlash: The official version can be found on the Xiaomi website (Tools section).
  2. Unpack the firmware: Unpack the firmware file (usually.tgz or.zip) in a short-cut folder (e.g., file in a short-cut folder, C:\Mi4_firmware\). There should be a folder with.img files inside.
  3. Run MiFlash from the administrator: Right-to-Shortcut β†’ Launch on behalf of the administrator.
  4. Connect your phone in Fastboot mode: Turn off Mi4, press Volume Down + Power and connect to your PC. A device should appear in MiFlash (e.g., COM3 - Qualcomm HS-USB QDLoader 9008).
  5. Select the firmware folder: In MiFlash, click Select and specify the path to the unpacked firmware.
  6. Start firmware: Press Refresh (the device should appear), then select the firmware method: Clean all – complete cleaning (recommended for changing the Android version); Clean all and lock – cleaning + lock the bootloader (only for official firmware!); Save user data – saving data (not always working correctly).

After selecting, click Flash and wait until it is completed (usually 5-10 minutes).

If the process is successful, the phone will automatically restart. The first turn on can take up to 15 minutes - don't interrupt it!

What if MiFlash gives you a critical partition doesn’t exist?
This error occurs if the firmware folder does not contain critical files (e.g. boot.img or system.img). Solutions: 1. Re-download the firmware and check its integrity (compare the MD5 hashes). 2. Make sure that the archive is unpacked correctly (sometimes there is another.zip inside.tgz). 3. Try another version of MiFlash (e.g. MiFlash 2018 instead of the last one).

Fastboot Firmware: An Alternative Method

If MiFlash refuses to work, or if you want to install custom firmware that is not adapted for this utility, you can use manual Fastboot mode, which requires knowledge of commands, but gives you more control over the process.

You'll need:

  • πŸ’» Established ADB Fastboot (you can download it as part of Android) SDK).
  • πŸ“ Firmware in.img format (usually files) boot.img, system.img, recovery.img etc.).
  • πŸ”Œ Cable USB Data-enabled (not all cables are suitable for Fastboot!).

Instructions:

  1. Open the command line in the firmware folder: Place the firmware files in the folder (for example, C:\Mi4_fastboot\), Then enter cmd in the address bar of the conductor and press Enter.
  2. Check device connectivity: Enter the command: fastboot devices Should show the serial number of your Mi4. If not, check the drivers.
  3. Use commands such as: fastboot flash boot.img fastboot flash system.img fastboot flash recovery.img Some firmware may require an additional command: fastboot flash userdata userdata.img
  4. Clear the cache: Run: fastboot erase cache
  5. Reboot the device: Command: fastboot reboot

⚠️ Note: If the firmware contains a file persist.img, It also needs to be flashed by the fastboot flash persist command. persist.img. Missing this step can lead to problems with the IMEI or.

Once rebooted, the phone can think long on the Mi logo -- that's OK for a first run. If the device doesn't turn on for more than 20 minutes, it may not be the firmware for your Mi4 modification.

Typical errors and their solutions

Even with the exact following of the instructions, the Xiaomi Mi4 firmware process can be accompanied by errors.

Mistake.Reason.Decision
Remote: device is lockedThe bootloader is not unlockedUnlock the device using the Mi Unlock Tool (see section above)
Waiting for device in MiFlashDrivers are not installed or the cable is faultyReinstall Qualcomm drivers, try another USB-port (preferably) USB 2.0)
The phone does not turn on after the firmwareIncompatible firmware or interrupted processRepeat the firmware by selecting Clean all in MiFlash
Invalid sparse file format at headerThe file is damaged. system.imgDownload the firmware again, check the hash amount of the file
No network after firmwareThe firmware is not suitable for your modification (cancro vs. cancro_td)Install the correct firmware version or run modem.img and fsg.mbn modules separately

If the phone boots after firmware, but you have problems with the sensor, camera or sound, it's probably built with errors.

  • πŸ” Check out the reviews on the forum XDA or 4PDA.
  • πŸ”„ Try a different build (for example, go from LineageOS to Pixel Experience).
  • πŸ“ž If you have problems with communication, run the modem files separately and EFS stock-stack.

Critical: if after a failed firmware, the phone does not respond to buttons and is not determined by the computer, try entering EDL (Emergency Download Mode) mode. To do this, press Volume Up + Volume Down + Power for 10-15 seconds. In this mode, you can restore the device through MiFlash using special firmware for EDL.

What to do after firmware: setup and optimization

Successful firmware is only half the battle, and to keep the Xiaomi Mi4 running smoothly and quickly, follow a few additional steps:

  1. Initial setup: πŸ“± Go through the standard setup procedure (language selection, Wi-Fi connection). πŸ”’ Enable Developer Options (7 times click on the Build Number in the settings) and activate Debugging by USB.
  2. Audit of substantive functions: πŸ“ž Make sure that calls and mobile internet are working (check out) IMEI in *#06#). πŸ“· Test the camera (if it doesn’t work, install an open version of Google Camera). πŸ”Š Check the sound and microphone (record the voice message).
  3. Optimizing productivity: πŸš€ Disable animation: in the Developer Options set the scale of animation windows, transitions and animators on 0.5x. πŸ—‘οΈ Clean the cache through recovery (clip the volume up) + Power with the phone turned off).
  4. Installation of necessary applications: πŸ›‘οΈ Install Magisk (if root rights are needed) through custom recovery. πŸ”„ For custom firmware, we recommend Open GApps (if there are no Google services).

If you have custom firmware installed, keep an eye out for updates on the developer forum. Many builds (like LineageOS) are updated weekly, and installing fresh versions fixes bugs and improves performance.

πŸ’‘

After the firmware, take your time to restore data from the backup! First, make sure the system is stable. Restoring settings from the old firmware can cause conflicts.

FAQ: Answers to Frequent Questions

Can I flash Xiaomi Mi4 without unlocking the bootloader?
No, unlocking is mandatory for any unofficial firmware installation, except for an update via OTA or Recovery if you already have an official MIUI installed with the bootloader unlocked.
How to return the official MIUI after custom firmware?
Download the stock firmware for your model from Xiaomi, then run it through MiFlash with the Clean all and lock option, which will return the bootloader to a locked state.
Why does the touchscreen not work after the firmware?
This is a typical problem when installing incompatible firmware.Solutions: Scroll through the correct firmware version (for cancro or cancro_td). If the problem persists, install the kernel (boot.img) work-assembly.
Can I run Mi4 through TWRP?
Yes, but first you need to install custom recovery. To do this: Unlock the bootloader. Sweat TWRP through Fastboot with fastboot flash recovery twrp.img. Load to TWRP (Loudness up + Power) and install firmware in.zip format. Note: only a special version of TWRP (for example, from OrangeFox) is suitable for Mi4.
How to check if the bootloader is unlocked?
Turn off your phone, press Volume Down + Power. If you see this device is unlocked and the picture with the open lock, the bootloader is unlocked.