[Guide] CyanogenMod 13 on Xiaomi Mi 4 (cancro)

This guide helps you upgrade your Xiaomi Mi 4 (and Mi 3, which are both codenamed by CyanogenMod as “cancro”) from the stock ROM or CyanogenMod 12 (based on Android “Lollipop” 5.0.x) to CyanogenMod 13 (based on Android “Marshmallow” 6.0.x) without data loss.

A and B are preparatory measures,  before the actual installation process can take palce in steps 1 to 6.

A. Install fastboot

In Arch Linux, install the following package from AUR:

android-sdk-platform-tools

Find further information on fastboot in the CyanogenMod documentation, including how you can install it on other operating systems.

Now boot the device into bootloader (fastboot) mode by rebooting and simultaneously pressing “volume down” and “power”. Connect the phone to your computer with a USB cable.

Check whether fastboot detects your device by running as root or with sudo:

$ sudo fastboot devices 
34a3456b fastboot

If the command returns a device ID and no error message, you are good to go.

 

B. Download Files

Optionally, you may choose to root your device and/or install Google Apps, which are not shipped with the basic CyanogenMod image:

  • SuperSU root manager: It is recommended to get a stable release.
  • Open GApps: Depending on your preference as to what you want to be included, select pico (minimal Google Play functionality), nano, micro, mini, full, stock or super (all Google Apps).

Copy (or download directly) the CM13, SuperSU and gapps zip files to your device, as they will be installed from recovery.
In my experience, adb did not work. It is therefore easier to simply download the files to the device or transfer them via USB or FTP (i.e. File Manager from Cheetah Mobile).

 

1. Install TWRP

TWRP will be flashed with fastboot to the device. Connect your device to the computer in fastboot mode, then run:

$ sudo fastboot flash recovery twrp-3.0.2-0-cancro.img

Boot into TWRP:

$ sudo fastboot boot twrp-3.0.2-0-cancro.img

 

2. Upgrade Baseband

CM 13 needs a different baseband (4.x) than CM 12 (3.x) or the Lollipop based stock ROM.
Flashing a Marshmallow based ROM with baseband 3.x will not work!
Check your version under Settings > About phone > Baseband version

Connect your device to the computer in fastboot mode, then run the following script from the extracted cm13Upgrade.zip file:

$ sudo sh flash_all.sh

 

3. Install CyanogenMod from recovery

Boot your device to TRWP recovery mode by rebooting and simultaneously pressing “volume up” and “power”. Wipe only the cache and Dalvik/ART (select Advanced Wipe). A factory reset, as described in the official guide, is not required, if you want to keep your data and apps!
Navigate to Install and select the CM13 image file you copied/downloaded to your device.

If you want to install GApps and/or TRWP, DO NOT BOOT YET!

 

4. Root the device

In TRWP, navigate to Install and select the SuperSU image file you copied/downloaded to your device.

If you want to install GApps, DO NOT BOOT YET!

 

5. Flash GApps

In TRWP, navigate to Install and select the GApps image file you copied/downloaded to your device.

 

6. Reboot

Reboot to the system and enjoy your beautiful CM 13!
During startup, you will see the notification “optimizing apps”

photo38979895274088936

 

Troubleshooting

After booting into your shiny new ROM, you might encounter the pop-up “unfortunately google play services has stopped”. This is annoying, as it virtually renders your installation useless.
This may happen if you use an unstable nightly ROM, or, most probably you didn’t wipe /data, /cache and /system partitions when upgrading to a new Android version (as from CM13 to CM14), or

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: