[Xiaomi Mi 5 Guides, News, & Discussion] Phil_Smith:
Hey people,

this shall mainly be a fast way to navigate users to necessary steps for diverse situations.

Instead of repeating the procedures over and over in each thread, this can be cited.

I will suggest you what I always do, and what I find safe and what I have good experiences with.

Still, you do everything at your own risk! So don’t complain to me if you mess something up by following my steps.

This well known phrase also counts here: “YOU are choosing to make these modifications”.

*********************

Preparations

Recovery

Make sure you are on the latest TWRP version.

Currently this is 3.2.3-0.

Backups

Before any of these procedures you should make a backup of every partition and save it at an external place – an usb stick, your PC, but not on your phone! Also copy the content of your entire internal storage at such an external place.

This will not always be needed and I will add more details of what you will surely lose when applying each method, but sometimes things just go wrong and suddenly your whole storage may be lost out of nowhere (happened to me more than once already).

A nice app that helps you restoring your apps and app data in a very quick way is Titanium Backup (get it from the Play Store). If you use the Pro version, you can restore everything basically with one click, so think about this way of backing up things as well (external copies are also advised here for obvious reasons).

Firmware

Make sure you are on adequate firmware for your ROM. Which firmware that is, must be taken from the respective ROM thread.

Adequate firmware needs to be present at any time before the actual ROM installation,

otherwise installation will fail, as the ROM expects a certain minimum to be present.

You will not need to always flash firmware again, when installing other ROMs or ROM versions.

The one you flashed last time sticks until you flash another.

A nice alternative to always flashing whole MIUI Developer versions are the zips offered by the firmware updater tool (just search through the xda topics).

*********************

So here we go with methods you should know:

***************

* Dirty Flash *

***************

Note that:

This is not recommended if the ROM maintainer or developer suggested a clean flash

If you wanna solve weird issues, you may try this first, but a Clean Flash or a Complete Formatting will probably help better

Use-cases:

You wanna install an update for a ROM you are momentarily on​

Benefits:

Only takes a few minutes

You will not lose Gapps, settings, apps and app-data

Content on your internal storage will (/should) stay untouched

Procedure:

Wipe Dalvik and Cache

Flash ROM zip right on top of existing installation

(Optionally) Re-/flash root (re-flashing is not necessary for Magisk most of the time if you installed it before)

****************

* Clean Flash *

****************

Note that:

You will lose Gapps, settings, apps and app-data

Also recommended from time to time, even when a dirty flash would be sufficient

Some developers always prefer this method over a dirty flash

Use-cases:

You wanna flash a ROM from the same Android generation (e.g. both ROMs are from generation Nougat 7.1.2) you are currently on

You are experiencing issues after dirty flashing a ROM

Benefits:

Clean way of installation

Content on your internal storage will (/should) stay untouched

Procedure:

Wipe Dalvik, Cache, System, Data, (momentairly I also advise) Vendor

Flash ROM zip

(Optionally) Flash custom kernel

(Optionally) Flash Gapps package for Arm64*

(Optionally) Flash Gapps additions*

(Optionally) Flash root

***************************

* Complete Formatting *

***************************

Note that:

You will lose Gapps, settings, apps, app-data and the content on your internal storage – basically everything on your phone!​

Use-cases:

You wanna flash a ROM of a different Android generation (e.g. switch from Nougat to Oreo)

You are experiencing weird issues, even a clean flash doesn’t solve

Benefits:

Clean way of installation

Good problem solver

Procedure:

Wipe Dalvik, Cache, System, Data, (momentairly I also advise) Vendor

Format data (the one where you need to type “yes”)

Reboot to recovery to access the Data partition correctly again

Flash ROM zip

(Optionally) Flash custom kernel

(Optionally) Flash Gapps package for Arm64*

(Optionally) Flash Gapps additions*

(Optionally) Flash root

****************************************

* Solve unable to mount Data error *

****************************************

Note that:

You will lose Gapps, settings, apps, app-data and the content on your internal storage – basically everything on your phone!​

Use-cases:

TWRP suddenly shows the above error and even a Complete Formatting doesn’t help (or work)​

Procedure:

Re-flash latest TWRP via fastboot (not from within TWRP)

Perform a Complete Formatting

********************

* Gapps Re-flash *

********************

Use-cases:

You want to change your current Gapps setup, but keep your current ROM installation​

Benefits:

Only takes a few minutes

You will not lose settings, apps and app-data

Content on your internal storage will (/should) stay untouched

Procedure:

Wipe Dalvik, Cache and System

Flash ROM zip

Flash Gapps package for Arm64*

(Optionally) Flash Gapps additions*

(Optionally) Re-/flash root

********************

* Kernel Change *

********************

Note that:

This works for almost every kernel, but if the developer suggests another method, follow his​

Use-cases:

You want to change the kernel, but keep your current ROM installation​

Benefits:

Only takes a few minutes

You will not lose Gapps, settings, apps and app-data

Content on your internal storage will (/should) stay untouched

Procedure:

Extract the boot.img of your current ROM

Flash the boot.img by selecting “flash image” in TWRP

Reboot to System and let everything cool down for a minute or two

Reboot to TWRP

Flash new kernel

(Optionally) Re-/flash root

Wipe Dalvik and Cache

*******************************

* Stock Kernel Restoration *

*******************************

Use-cases:

You're on a custom kernel and want to switch back to stock one​

Benefits:

Only takes a few minutes

You will not lose Gapps, settings, apps and app-data

Content on your internal storage will (/should) stay untouched

Procedure:

Extract the boot.img of your current ROM

Flash the boot.img by selecting “flash image” in TWRP

(Optionally) Re-/flash root

Wipe Dalvik and Cache

********************************

* Splash Screen Restoration *

********************************

Note that:

A clean flash will not solve this​

Use-cases:

Some kernel's or ROM's splash screen sticks and you wanna get rid of it.​

Benefits:

Only takes a minute

You will not lose anything on your phone (except the splash screen ; ) )

Procedure:

Just re-flash your current firmware​

*I usually go for Pico Gapps from opengapps.org, as they don't include anything I don't need or like, and add a couple of things from deltadroid by flashing them right after the Pico Gapps package. Some stock apps can be overwritten this way, so you don't have two for the same purpose (e.g. stock calendar and google calendar) and it results in a nice minimal Gapps configuration.

I’m open for corrections, questions or doubts! Please leave a comment in these cases!

last updated: 2018-08-20