[Xiaomi 11T Pro] bunta126:
I'm going to explain the complete process for getting up and running on a custom GSI ROM as the guides so far seem to either have only parts of information or incorrect information.

Following this process will wipe your data and alter your phone. I am not responsible for any bricked or damaged devices.

For the purpose of this thread I'm going to assume the installation of an Android 13 GSI image which you can get from the GSI images site. I like to use crDroid.

Make sure you read and understand all instructions before beginning!

1 - Unlock the bootloader

Important things to note:

One Xiaomi account can unlock one device per month. If you need to unlock multiple devices create an account for each one.

Unlocking the bootloader requires a wait time of 1 week after adding your Xiaomi account to the device before it can be unlocked

Create a Xiaomi account to use during this process here: https://account.xiaomi.com

Download the MI Unlock tool from here: https://en.miui.com/unlock/download_en.html

Procedure:

Ensure a SIM card is in with mobile data working and disable Wifi (required when associating your device with your Xiaomi account)

Enable developer mode by going into "About Phone" and tapping on the MIUI Version until it unlocks the setting

In Settings go to Additional Settings > Developer Options

Enable "OEM Unlocking" option

Select the "Add Account" option and enter your Xiaomi account details to link your device to your account

Open the Mi Unlock tool on your PC and log in with your Xiaomi account

If you get asked for a phone number when you log in the tool may get stuck as it doesn't allow you to click on the country code drop down correctly.

To avoid this, use the QR code icon on the first sign in page and from your phone go into the Xiaomi Account settings and click the scan icon on the top right

Log your account in with your phone to set the phone number there and you should be able to log in through the Mi Unlock tool next time without a problem.

Boot your phone into fastboot mode by holding Volume Down & Power buttons

Connect your phone to your PC with a USB cable

Click Unlock on the Mi Unlock tool and it should check your device and then give you a wait timer (generally 168 hours)

After that time is up (you can use your phone normally while waiting but don't mess with the Xiaomi Account settings) connect your phone in fastboot mode again and click Unlock in the Mi Unlock tool to unlock the bootloader.

2 - Install TWRP Recovery (or alternative)

Important things to note:

This phone does not have a dedicated recovery partition, the recovery is a ramdisk that resides within the boot partition

You cannot flash a recovery partition directly to the boot partition as it will then fail to boot

Make sure you use a current version of fastboot: https://provider.xiaomi.eu/tools/fastboot.zip

All commands written below are to be used without the apostrophes within a command prompt (powershell will require .\ placed in front of the command)

Download a TWRP image from here: https://sourceforge.net/projects/recovery-for-xiaomi-devices/files/vili/ Use the A13 image for Android 13 ROMs.

Procedure:

Boot your phone into fastboot mode by holding Volume Down & Power buttons

Connect your phone to your PC with a USB cable

Run command "fastboot boot twrp.img" to reboot phone into TWRP recovery

If this is the first time using TWRP it will likely be in Chinese language. Click the 2nd to last button on the right side of the menu, then the globe icon on the top right to change language.

Go to Advanced and choose Flash Current TWRP to install TWRP into the boot image

Choose Reboot to Recovery to test the image is installed

3 - Install Latest Xiaomi.eu ROM (optional)

Important things to note:

I like to use the xiaomi.eu ROM as a base before installing a GSI image as it seems to be more stable and functional afterwards

This step is optional as you can continue with the global ROM base instead

Additionally, you can stop after this step if you would prefer to use a MIUI based ROM instead of a custom GSI image

The Xiaomi.eu ROM can be downloaded from here: https://xiaomi.eu/community/threads/miui-14-stable-release.67685/

The bootloader must be unlocked and TWRP recovery installed

Procedure:

Boot your phone into TWRP recovery by holding Volume Up & Power buttons

Click the Wipe button and then Format Data. Enter yes to wipe the data partition. (This will erase all data as well as the internal storage)

Connect your phone to PC and copy the xiaomi.eu ROM onto the phone

Click the Install button on the main menu in TWRP and select the ROM zip file to install

Go to Advanced and choose Flash Current TWRP to install TWRP back into the boot image

4 - Install Custom GSI Image

Important things to note:

This phone has a Super partition which dynamically contains system, system_ext and vendor partitions

This means that you cannot flash a GSI image directly to the system partition from TWRP so it must be installed via fastbootd

fastbootd is an enhanced version of fastboot that works with the dynamic Super partition

fastbootd mode looks like TWRP but it will say "Entered fastboot mode..." on the screen

Make sure you use a current version of fastboot: https://provider.xiaomi.eu/tools/fastboot.zip

All commands written below are to be used without the apostrophes within a command prompt (powershell will require .\ placed in front of the command)

Extract vbmeta.img file from the Xiaomi.eu ROM (or global ROM if using that) and place it in same folder as fastboot

Download your custom GSI image of choice from here or other source: https://github.com/phhusson/treble_experimentations/wiki/Generic-System-Image-(GSI)-list

Extract the GSI image, rename it system.img and place it in the same folder as fastboot

Procedure:

Enter fastbootd mode on your phone using one of the following methods:

boot phone into fastboot mode and from your PC run command "fastboot reboot fastboot"

boot phone into TWRP and choose Reboot and then Fastboot

From your PC run the command "fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img" to disable the boot image hash checks to avoid boot loops

Run the command "fastboot erase system" to wipe the existing system image

Run the command "fastboot flash system system.img" to install your custom GSI image

NOTE: If you get an error saying "Not enough space to resize partition" run the command "fastboot delete-logical-partition product_a" and repeat the install again

5 - Install Magisk and Root

Important things to note:

Using the TWRP installation method by renaming the magisk apk to zip is not very reliable and the lastest versions require installation to be performed from within the OS

Download the lastest magisk from here: https://github.com/topjohnwu/Magisk/releases

We use a backup of the installed boot image rather than one from the xiaomi ROM as it has TWRP recovery installed in the ramdisk

Procedure:

Boot your phone into TWRP recovery

Enter the Backup menu, select the boot partition and run the backup

Copy the boot.emmc.win file out of the TWRP backup folder into the Download folder on your phone and rename it boot.img

Reboot your phone into System

Install the magisk apk file

Open magisk and click Install on the top right (in the Magisk section, not the App section)

For the Method choose Select and Patch a File then click Lets Go

Find the boot.img backup file copied to the Download folder and select it (after patching it will tell you the filename of the patched image)

Reboot your phone into TWRP recovery

Choose Install, then Install Image, select the file Magisk created above, select the Boot partition and then swipe to flash

Reboot to system and check in Magisk that it shows as installed (you may also want to reboot to recovery to ensure TWRP is still installed)

6 - Fixing Safetynet

Important things to Note:

The Shamiko magisk module is used to hide root status from apps that detect root/magisk. This can be used to make any app work that fails due to root status.

Shamiko uses the Denylist in Magisk settings to block root settings for those apps enabled but you should NOT have the denylist enforced in Magisk settings

You can find the Shamiko module here: https://github.com/LSPosed/LSPosed.github.io/releases

The default Universal Safetynet Fix can be found here however due to problems in a previous phone, I used the modded version from here (I'm not sure if that's still required for A13)

Procedure:

In Magisk settings choose to hide the magisk app to reinstall it with a different name and app id

In Magisk settings enable Zygisk and reboot phone

In Magisk settings choose Configure Denylist, show system apps from the top menu and enable Google Play Services, Google Play Store & Google Service Framework

In Magisk install the following modules: Shamiko, Universal Safetynet Fix

Install a Safetynet Checker from Google Play (SafetyNet Device Check) and verify safetynet tests pass successfully

7 - Post installation Fixes

Below are some fixes to common problems after installing a custom ROM.

Phh Settings Tweaks:

Qualcomm features - Use alternate audio policy -> fix audio in whatsapp

Qualcomm features - Disable soundvolume -> fix broken audio

Xiaomi features - Enable DT2W -> to enable double tap to wake

Misc features - Force alternative backlight scale -> fix auto brightness

IMS Features - Install IMS APK for Qualcomm -> allows SMS to work