Installing Android 9 Pie on a Xiaomi Mi5

The Xiaomi Mi5 was introduced in February 2016 as a flagship phone with a Snapdragon 820 processor, 3 GB RAM (Pro edition 4GB) and 32GB (standard), 64GB (Prime) or128GB (Pro) of internal storage. Three years later the phone still offers a decent mid-range performance. The phone was initially released with Android 6.0 Marshmallow.

The user interface from Xiaomi is called MIUI. The latest available global ROM version is 10.2.2.0, based on MIUI 10 and Android 8.0 Oreo. Xiaomi has announced that Mi5 will cease to receive upgrades and there will be no official MIUI 11 upgrade for the Mi5.

At the moment the only possibility to install Android 9.0 Pie on a Xiaomi Mi5 is to use a third-party custom ROM. The widely used codename for Mi5 is “gemini”. You find almost all downloads (e.g. TWRP recovery ROM and custom ROMs) under this device codename.

The following guide contains instructions how to install a third-party ROM on your Mi5 device. The upgrade procedure for other Xiaomi devices is similar (each device has a different codename). Installing a custom ROM will void your warranty, which should be expired anyway for a more than two years old phone.

Overview:

  1. Required tools
  2. Choosing and downloading a custom ROM
  3. Downloading a GApps package
  4. Unlocking the phone (the official way)
  5. Downloading and installing TWRP recovery ROM
  6. Create a phone backup with TWRP (Optional)
  7. Installing a Custom ROM and Google Apps via TWRP recovery

Required tools

To complete all of the following steps you are going to need the following tools:

Choosing and downloading a custom ROM

There are many custom ROM solutions for the Mi5 on the internet. I am currently using Syberia OS. Here is a list of some open source ROM projects with Android 9 Pie for the Xiaomi Mi5. To go directly to the project’s download page for Xiaomi Mi5 (codename: gemini) click on “Download link”

Copy the downloaded file to the internal storage of your device or if you have a USB-C pen drive or a USB-C male to USB-A female adapter you can put it on a USB pen drive.

If you want to revert back to the official MIUI ROM you can download it from the official Mi5 MIUI ROM download page.

Downloading a GApps package

By default custom ROMs don’t include a GApps package. You need one to use Google Play and some other google functionality.

You can download Open GApps from the Open GApps Website. Please select the ARM64 platform and Android 9.0. I am using the “nano” package. A comparison of the various packages is on this wiki page.

Copy the downloaded file to the internal storage of your device or if you have a USB-C pen drive or a USB-C male to USB-A female adapter you can put it on a USB pen drive.

Unlocking a Xiaomi Mi5

This is the most time-consuming task, as you have to wait 72 hours after linking a Xiaomi account with your device.

Prerequisities:

Instructions:

  1. Create an account at Xiaomi using a phone number: https://account.xiaomi.com/pass/register (don’t forget to select “Create using a phone number”)
  2. Activate developer mode on your phone
    Settings->About phone->MIUI version – click multiple times until you see the message "You are now a developer"
  3. Enable OEM Unlocking
    Settings->Addional settings->Developer options->OEM unlocking
  4. Link phone to Xiaomi Account
    Settings->Addional settings->Mi Unlock status->Add account and device
  5. Wait 72 hours until your phone becomes unlockable
  6. Boot phone in fastboot mode
    (power down or reset, then press and hold the volume down key while booting until fastboot comes up)
  7. Install USB drivers, run “miflash_unlock.exe” (both drivers and the tool are part of the MI Unlock Tool package) and follow the instructions

Installing TWRP recovery ROM

TWRP is a great tool to manage backup, recovery and new firmware installation on your Mi5 phone. To install TWRP you need an unlocked phone.

Prerequisities:

  • Unlocked phone
  • Android SDK tools (SDK tools are already included in Android Studio)
    downloaded and extracted or installed
  • You need to be able to execute “fastboot” from the SDK tools. On Windows the command is “fastboot.exe”

Instructions:

  1. Download TWRP recovery ROM for Xiaomi Mi5. The suffix “-gemini” identifies that the rom is for the Mi5.
  2. Boot phone in fastboot mode (power down or reset, then press and hold the volume down key while booting). The phone should boot in fastboot mode (a fastboot logo appears).
  3. Verify that the phone is visible to fastboot:
    fastboot devices
  4. Flash the recovery image (I have tested version 3.3.1-0):
    fastboot flash recovery twrp-3.3.1-0-gemini.img
    Plase do not reboot your phone to normal ROM, otherwise recovery RPM will be replaced back to MIUI recovery.
  5. Reboot into recovery mode
    fastboot boot twrp-3.3.1-0-gemini.img
    (or press and hold the volume up key while booting)
  6. Follow the instructions and allow modifications to your phone from TWRP.

Crating a phone backup with TWRP

I recommend doing a full backup of the phone using TWRP. As the Mi5 has no SD-CARD slot, there are 2 backup options – you can backup to internal storage or you can backup to a USB device (e.g. USB pen drive). The Mi5 has enough power from the USB-C port to power a USB pen drive. You nedd a USB-C pen drive or an adapter from USB type C male to USB type A female.

Instructions:

  1. Boot into TWRP recovery mode
    (press and hold the volume up key and while booting. Alternatively you can use the fastboot alternative as in “Installing TWRP recovery ROM”)
  2. Select “Backup”
  3. Check all (or desired) backup options
    Under the menu “Storage” you can select if you want to backup to internal storage or USB pen drive if attached
  4. Run the backup (“Swipe to Backup”)

Installing a Custom ROM and Google Apps

To install the Custom ROM and Google Apps, you need a unlocked phone with TWRP recovery ROM.

Instructions:

  1. Boot into TWRP recovery mode
    (press and hold the volume up key while booting. Alternatively you can use the fastboot alternative as in “Installing TWRP recovery ROM”)
  2. Select “Wipe” to factory reset your phone. Do NOT select anything else, just “Swipe to Factory Reset”.
  3. Select “Install” and select the custom ROM zip file you have downloaded, then do “Install Image”. Then select “Add more Zips” and add the zip file for the GApps package. Afterwards you can “Swipe to confirm Flash”
  4. After successful flashing you can reboot to your new Android 9 Pie custom ROM
Syberia OS on Xiaomi Mi5

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>