Device Flashing Memo: Steps, Tools, and Precautions

Over the past few months, I've flashed many devices, and I often forget some things each time. So I wrote this article for reference during my next flashing session.

Disadvantages of Leaving MIUI

  • The camera will be limited to 12 million pixels, and there is currently no solution.
  • Some custom features may not be available, such as MIUI's "Dual Apps" feature, Dolby audio, and unlocking by pressing the power button.
  • Some devices may no longer be able to use access control cards.
  • Gaming performance may decline.

Unlocking the Bootloader

Unlocking the Bootloader comes with certain risks, including potential data leakage, so please be cautious.

  1. Download the unlocking tool from the official Xiaomi website.
  2. Connect your phone to the computer using a data cable (make sure it supports file transfer).
  3. Follow the prompts in the tool; you may need to wait for 7 days.
  4. After unlocking, you can check the unlock status in the developer options.

Rooting & Flashing Magisk

Magisk works by directly writing the API into the system's boot.img, and its installation method involves flashing a pre-hacked image. Once Magisk is successfully installed, you will also have root access.

  1. Extract the boot.img from the currently running system image and send it to your phone. Typically, the "line flash package" contains this file, while the "card flash package (with a .zip extension)" needs to be extracted using a tool.
  2. Install the Magisk APP on your phone. It is recommended to download the installation package from the official GitHub repository.
  3. Click "Install," select "Patch a file," and choose the previously extracted boot.img. After patching, the patched image will be placed in the /Download folder by default.
  4. Connect your phone to the computer using a data cable (make sure it supports file transfer).
  5. Copy the patched image from your phone to the computer.
  6. With the phone powered off, press and hold the volume down and power buttons simultaneously to enter Fastboot mode.
  7. Open the adb command line and execute fastboot flash boot <img_directory>.
  8. After flashing, execute fastboot reboot to restart the device. Done.

Flashing Official ROM

⚠ Please make sure to back up your device data, such as photos, contacts, messages, etc.

  1. Download the ROM and Miflash from the official Xiaomi website, and extract the ROM.
  2. With the device powered off, press and hold the volume down and power buttons simultaneously to enter Fastboot mode. Connect your phone to the computer using a data cable.
  3. Open Miflash and select the just-extracted ROM folder.
  4. Click "Load Device" and select the device you want to flash.
  5. Check "Clear all data" in the lower right corner.
  6. Click "Flash" and wait for the flashing process to complete. This may take 5-20 minutes.

Flashing Third-Party ROM

Please make sure to back up your device data, such as photos, contacts, messages, etc.

This is not a very complicated operation; please remain calm and composed.

  1. Ensure that the device is currently running an OS that meets the requirements of the third-party ROM, including: device codename, Android version, OS version, etc.
  2. Ensure that the Bootloader is unlocked. You can check the unlock status in the developer options.
  3. Download the third-party ROM and recommended Recovery (if available).
  4. With the device powered off, press and hold the volume down and power buttons simultaneously to enter Fastboot mode. Connect your phone to the computer using a data cable.
  5. Open the adb command line on the computer and execute fastboot boot <recovery_directory>. If everything goes well, the phone will enter Recovery.
  6. Once in Recovery, if the recovery supports sideload mode, you can directly enter sideload mode and execute adb sideload <rom_directory>; if it does not support sideload mode, you can choose to flash the zip package by executing adb push <rom_directory> /sdcard/Download, and then select the zip package to flash in Recovery.

Other Resources

System Enhancement Apps

These apps fill in some gaps in the near-native system or enhance its functionality.

  • Magisk Manager: Can run some apps in a sandbox and acts as "Dual Apps," such as WeChat, QQ, Alipay, etc.
  • Shizuku: Application permission management
  • Thanox: Background management
  • Scene4: Scene mode
  • Google Camera: The strongest camera on the Android platform
  • SD Maid SE: A long-standing junk cleaning software

Cleaning MIUI Bloatware

1adb uninstall -k --user 0 com.miui.analytics
2adb uninstall -k --user 0 com.miui.analytics.service
3adb uninstall -k --user 0 com.miui.bugreport
4# More package names can be checked in settings