TechHow To

How to Flash a GSI on an Android Device

In 2017, Google’s Project Treble was introduced, bringing a substantial architectural change to Android. Specifically, it separated the Android operating system, which is the same for all devices, from the low-level software that is specific to each device. As a result, Android smartphone manufacturers (OEMs) and custom ROM developers can now process Android upgrades faster than before, on devices running Android 9 and above.

Project Treble also gave birth to GSIs. A GSI (Generic System Image) features a pure Android implementation and contains adjusted configurations to make it work on any Project-Treble-compliant device. With a GSI, you can experience a new Android version before your OEM releases the over-the-air upgrade on your phone.

Here, we’ll guide you on flashing a GSI on supported Android devices.

Prerequisites Before Flashing a GSI

Flashing a Generic System Image on an Android device is a simple process. But even so, there are a few points to check before starting. These prerequisites will guarantee you have a smooth experience, so don’t skip any of them:

Once everything is in check, you can proceed with the Android GSI installation below.

Step 1: Ensure Your Device Supports Project Treble

Before you do anything else, double-check that your Android device is Trebalized (Project Treble compatible). Google has made it a general rule of thumb that every device launching with Android 8 (Oreo) or later ships with Project Treble compatibility, but there is no harm in confirming this for your device.

Treble Info App Treble and VNDK Section Information

A simple way to do this is by downloading the Treble Info app from the Google Play Store. Launch the app, head over to the Treble and VNDK section, and if you see a green tick on the left, your Android device supports Project Treble. The summary provides more information, including the VNDK (Vendor Native Development Kit) veion number corresponding to your device’s Android version.

Step 2: Confirm the CPU Architecture and Partition Info

Android GSIs target several CPU architectures, including ARM, ARM64, x86, and x86-64. As such, make sure you obtain the correct GSI for your device’s CPU. To find your device’s CPU architecture, open the Treble Info app again. You’ll find the device’s CPU variant under the Architecture section.

Treble Info App Excerpt Showing Architecture, Seamless Upgrades, and Dynamic Partitions Info

Before closing the app, under the Dynamic Partitions section, check whether your device uses dynamic partitions. You’ll need this information to determine whether to flash the GSI in fastboot or fastbootd mode later.

Fastboot or Fastbootd mode is accessible when the Android OS isn’t running and helps you read or write to your phone’s flash memory. Exercise extreme caution when using any of these modes.

Step 3: Download a GSI

Now that you know your device’s CPU architecture information, head to Google’s GSI releases page on your PC to find an appropriate GSI. Remember to download a GSI that matches your Android version or higher.

If you want a GSI with Google Play Services, choose the one with gms in the file name. After a successful download, you’ll find system.img and vbmeta.img files in the GSI zip folder.

WinRAR App Showing Contents of a GSI zip File

Now, extract the system.img and vbmeta.img files and place them in the Platform Tools folder you set up in the prerequisites section above. Placing these files in the same folder as the Platform Tools guarantees that all the commands below will run successfully.

Step 4: Boot Into Fastboot or Fastbootd Mode

Before running any commands, you must connect your Android device to the Windows PC and enable USB Debugging. After that, open a Command Prompt window in the Platform Tools folder. A simple way to do this is to type the word cmd in the folder’s address bar and hit Enter on the keyboard.

Next up, type the following command in the resulting command prompt window and hit Enter to boot your Android device into Fastboot mode.

adb reboot bootloader
Windows Terminal Showing adb reboot bootloader Command

If you found that your device supports Dynamic Partitions in Step 2 above, you need to run the following extra command to boot the Android device into Fastbootd mode. Failure to do so will result in errors about missing partitions when you try to install the GSI. Skip this command if your device doesn’t have Dynamic Partitions.

fastboot reboot fastboot

At this point, your device is now ready to be flashed with the GSI files you extracted.

Step 5: Flash the Android GSI via Fastboot or Fastbootd

To avoid issues booting the GSI, you must disable AVB (Android Verified Boot) by executing the command below. OEMs use AVB to ensure the integrity and authenticity of the Android system running on your smartphone. Skip this command if your device doesn’t ship with AVB. You’ll know this if the command throws out an error that the partition does not exist on your device.

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
Windows Terminal Showing AVB Command

Next up, erase the system partition to remove the currently installed Android OS using the command below. Installing the GSI over the existing Android system will result in issues like endless boot loops where your device does not finish the boot process, no matter how long you wait.

fastboot erase system

Flash or install the downloaded GSI into the system partition using the following command. Remember that the flashing process may take a while to complete, so be patient.

fastboot flash system system.img
Windows Terminal Showing fastboot flash system Command

It’s now time to format or wipe user data to remove all the data associated with the previous system. If not wiped, this can cause booting issues or other problems. To factory reset your device, run the command below:

fastboot -w

You have now installed the GSI successfully. All that remains is to boot your device into the new Android OS by executing this quick command:

fastboot reboot

The first boot process after flashing a new Android OS usually takes some time. A successful boot means that you have installed the GSI as expected, and now you can explore all the goodies that come with the new GSI on your device.

Remember, a GSI aims to support as many devices as possible; therefore, device-specific features like the stock camera are unavailable. Luckily, you can mitigate some of these camera issues using popular workarounds like Google Camera ports.

GSIs in Custom ROMs

We have only linked Google’s GSI releases in this guide, but there are more. Thanks to Android custom ROM developers, you can usually get a GSI based on your favorite custom ROM, like LineageOS, Pixel Experience, /e/ OS, and more.

Therefore, besides experiencing new features or a pure Android experience via a GSI, you can also extend your device coverage for custom ROMs. Even better, when your OEM stops providing security patches or version upgrades, GSIs will still be there for you.

Muhabarishaji

๐Ÿงช |Medical Laboratory Scientist ๐Ÿฅ‡ | Mindset over Everything. โ€จ ๐Ÿค | Let's Grow Together.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button