[General Questions and Answers] Vulkkan:
Method to root the Infinix Smart 5 X657C and/or install a custom OS

The following is a procedure to root this device and flash a GSI. I did this on the X657C model (on a PC), and the method to root should work on other models, as well as other similar Infinix/Tecno devices. To flash a GSI on other Infinix/Tecno devices, the device must have been shipped with Android 9 Pie or higher.

Remeber that I won't be held responsible for your actions. By reading this post in the first place I assume that you are an advanced user who has at least a basic understanding of rooting, custom ROMS & Generic System Images, the Command Line and some tech knowledge, so this won't be the most beginner-friendly. Proceed at your own risk!

This is a list of stuff you will need before you start messing with your phone:

1. Stock Firmware.

I got my device's complete ROM in a .zip format, which had to be extracted. And it must have the exact same model number as the phone, else a hardbrick!

2. Latest Platform Tools.

For running the commands that would do all the good stuff. Extract it to an easily accessible folder (I prefer to use C:\platform_tools)

3. Latest Magisk .apk

[You wouldn't ask what that's for, would you?]

4. Latest SP Flash tool

Finally, the Smartphone Flash Tool. This would come in handy if you eventually brick your phone 🙂

If you are looking to change the OS, you'd also need to download 2 additional things:

1. Treble Info checker app

2. The custom ROM (a GSI) you would install. It depends on the info you get from the Treble Info app above. I'll explain in details later on.

Let's start with the steps to root the device. I actually flashed the GSI before rooting with Magisk, and I'd rather you did that first if you want to get a rooted custom ROM.

In a nutshell, you would

1. Unlock the bootloader

2. Use magisk to patch the phone's boot image

3. Flash the patched boot image

Unlocking the bootloader

[This will erase all your data]

Go into your device's Settings > About Device > Build Number.

Tap on Build Number about 8 times to enable developer options.

Return to Settings > System > Developer Options.

In developer options, enable USB Debugging and OEM Unlocking.

Next, connect your device to your PC, open cmd in the platform tools folder and run the following commands (obviously without the '$', and you should understand the meanings of these commands!)

$ adb devices

Your device should show up

$ adb reboot bootloader

$ fastboot devices

Again, your device should show up before you continue.

$ fastboot flashing unlock

$ fastboot reboot

Your device comes up unlocked, and you go through the setup.

After that, re-enable Developer Options again as well as USB debugging and OEM Unlocking.

Using magisk to patch the phone's boot image

Install the Magisk.apk on your phone and copy your device's boot image from your stock ROM to your device's internal storage.

Open Magisk app on your phone, navigate to Install > Select and Patch a File > (Select the boot.img you copied).

Magisk patches the file and places it in your downloads folder.

Now it's time to place some files in the Platform Tools folder. The files will be:

1. Patched boot.img

Copy that patched file to your PC's Platform Tools folder and rename it to boot.img (pay attention to file extensions: not boot.img.img).

2. vbmeta files

Copy the vbmeta.img from your stock ROM into the Platform Tools folder. In my case, I had 3 files: vbmeta, vbmeta_system and vbmeta_vendor. I copied the 3 files.

Once you're done copying, connect your phone again to your PC, open up cmd in the platform tools folder and run the following commands:

$ adb devices

$ adb reboot bootloader

$ fastboot devices

Your device should show up before you proceed

Then you'd want to disable AVB

$ fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img

As I said, in my case I had 2 other vbmeta files so I flashed 'em all too

$ fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img

$ fastboot --disable-verity --disable-verification flash vbmeta_vendor vbmeta_vendor.img

Then you flash the patched image

$ fastboot flash boot boot.img

I'm not sure it was necessary, but I wiped data and cache just to be safe before rebooting

$ fastboot -w

$ fastboot reboot

Since I wiped data, I had to go through the process of setting up the phone and installing Magisk APK again. And ta-da, your phone would be rooted by now.

If for some reason the phone didn't boot up after wiping user data and cache, you can revert the changes by reflashing the stock boot.img.

To flash the GSI:

1. Make sure your device is Project Treble supported, and identify it's architecture all using the Treble Info app. As I stated earlier, if it it came with Android 9 Pie or higher it's probably certainly Project Treble supported.

2. The Treble Info app will also indicate the kind of GSI your device supports. In my case, it was an a64 vndk. So downloaded it and renamed it as 'system.img'.

You'd ensure you've unlocked your bootloader using the steps above.

After all that, place the system.img in the Platform Tools folder.

Connect your phone and start up cmd in the same folder and run the commands below to flash your new OS:

$ adb reboot bootloader

$ fastboot reboot fastboot

$ fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img

Disable AVB on vendor and system, if you have those:

$ fastboot --disable-verity --disable-verification flash vbmeta_vendor vbmeta_vendor.img

$ fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img

Boot into userspace fastboot

$ fastboot reboot fastboot

Delete product partition to free space

$ fastboot delete-logical-partition product

Wipe and flash the system partition with GSI

$ fastboot erase system

$ fastboot flash system system.img

Erase user data and cache, and reboot

$ fastboot -w

$ fastboot reboot

If anything goes wrong and it doesn't boot up, you can reflash the GSI again, or try another. I tested the Android 12 builds of LineageOS, AOSP and crDroid. I got a lotta issues with AOSP, and crDroid was a little heavy, so I stuck with Lineage OS and we remained happy ever after.

If you still get bootloops, flash the original system.img.

Else, you can now go ahead and root!

Give a thumbs up if this helps 😃 and Good luck!