Preparing for Installation
Backup All Data using MIUI Backup
To prevent data loss during the installation, it's crucial to back up all your data. You can use the built-in MIUI Backup feature to create a full backup of your apps, settings, and data. Go to Settings > Additional Settings > Backup & Reset > Local backups > Backup to create the backup file. Copy this backup file to a safe place such as your computer.
Installing Platform-Tools (ADB and Fastboot)
You'll need ADB (Android Debug Bridge) and Fastboot tools on your computer to interact with your device during the installation. Additional information can be found online.
Unlocking the Bootloader
Use Mi Unlock in order to unlock the bootloader of your device. This requires using MIUI with a SIM card in the phone for a week.
Installing the ROM
Downloading the required files
Head over to the download page of the ROM you want to install. You'll need the following files:
• boot.img
• vbmeta.img (optional, only needed for first install)
• dtbo.img
• The flashable ZIP of the ROM (e.g. lineage-20.0-20230728-UNOFFICIAL-ruby.zip)
Flashing Recovery with Fastboot
Start by powering off your device. Then hold the Volume Down key along with the Power button. You should end up with the device saying "FASTBOOT" in the middle of the display.
Plug the phone into your computer and check fastboot devices to see if the device appears.
After you verify that your computer recognises your device in fastboot mode, flash the vbmeta from the ROM with the following command (do not add any additional parameters such as --disable-verity and --disable-verification, this will cause your phone to stop booting!)
fastboot flash vbmeta vbmeta.img
fastboot flash boot boot.img
Afterwards, flash the Recovery by writing the boot image to the device (we have Virtual A/B, which means the recovery is stored in the boot image).
fastboot flash boot boot.img
Once done, reboot the phone into recovery mode with:
Wait for the device to boot into Lineage Recovery, then immediately format the data of your device by tapping on Factory reset -> Format data/factory reset. When prompted confirm the format.
After the format is complete go back to the main menu. Now tap on Apply update -> Apply from ADB.
Now type the following command on your computer to sideload the ROM zip onto your device, replace <name of zip> to the path to the ROM zip which you downloaded:
adb sideload <name of zip>
It may take a while to send the ZIP over to your device, the installation should complete with no issues.
Once the sideload is complete, go back, and this time select Advanced -> Reboot to recovery. This is going to ensure that we are booted into the slot where we have flashed Lineage to install additional addons such as GApps and/or Magisk.
Repeat the same sideloading process (excluding the reboot to recovery step) to install addons. For example, if I wanted to install GApps, I would go to Apply from ADB again, and on my computer type:
adb sideload <name of GApps zip>
Wait for the installation to finish. Once you are done flashing ZIPs, you are free to go back, and select "Reboot to system".
Finishing up
If everything has went well, you should be presented with the boot animation of your ROM. Wait for the device to boot and enjoy!