Step 1: Unlock Bootloader
Read the guide to unlock bootloader here.
Step 2: Boot to TWRP Recovery
- Download the latest TWRP from the XDA thread linked here . NOTE: There are two types of file, one is a .img file and other one is a .zip file. Both of them are necessary to install TWRP recovery permanently on your device.
- Copy the downloaded TWRP.img file to the ADB directory present in C: drive.
- Inside the folder, right click and select “Open command window here” or “Open Powershell window here”.
- Turn off your phone. Press and hold “Vol -” + “Power” buttons together for 3-4 seconds to boot into fastboot mode.
- Then connect your phone to PC.
- In command window, type fastboot boot twrp-recovery-file-name.img
Step 3: Download and Install any Custom ROM
- Head over to the XDA Forums and click on link of any ROM thread displayed there.
- Navigate to the Downloads section of the respective ROM and download it.
- Now that you have downloaded the ROM, you need to download Opengapps package from here [Platform-ARM64 | Android-8.1/7.0(according to your ROM’s android version) | Variant-pico/micro/nano] in case you want to use Google Apps on your device. NOTE: Without Opengapps installed google apps won’t work on your device.
- Download magisk from the xda thread linked here if you need root access.
- Connect your device to PC and transfer TWRP’s .zip file, ROM .zip, magisk .zip file as well as opengapps .zip file to your device’s internal storage.
- As you had already booted to TWRP in step 2, goto Wipe -> Advanced Wipe -> Select system, data,dalvik cache and Internal Storage(Internal storage need not to be wiped if you are already on any other custom ROM). Swipe to wipe.
- Now goto Install -> Select your ROM zip file -> Swipe to confirm flash.
- Again navigate to home, Select Reboot -> Slot B (If your current slot is A) or slot A (If your current slot is B).
- Go back to home, Install -> TWRP.zip file -> Swipe to Flash. (This flashes TWRP permanently on your device and can be accessed by pressing and holding Vol up + Power buttons together for 5-6 seconds) NOTE: This step needs to be repeated every time you flash a ROM.
- Goto Reboot -> Recovery -> Swipe to Reboot.
- Then goto Install and select opengapps zip file -> Swipe to Flash. ( Optional step if you want to install google apps )
- Install -> Magisk zip file -> Swipe to confirm flash. ( Optional step if you need root access )
- Finally select Reboot -> System.
- That’s it. You have successfully flashed a custom ROM in your Xiaomi Mi A1.