Android Oreo came with a change to the Android architecture intended to make system updates easier: Project treble. This change in architecture came with an interesting side effect: install Android versions the “easy” way with GSI, or generic system images.
It’s been a few years since we first heard of Treble and while GSI images are still more of an experiment than the simple universal way, it is technically possible to use them to change the Android version or even install a few select ROMs. We will explain below what is a GSI, what are the requirements to install them and how are they installed.
What is a GSI image
Lets start by the beginning. GSI stands for Generic System Image and their name is quite descriptive: they are generic system images, based on AOSP and without any modification. That is, they are images of the AOSP system that are not intended for special hardware, but should be able to be installed on any recent Android mobile that meets the requirements that we will see in the next point.
GSI is a concept closely related to Treble, which involves a separation of the low-level implementation like the hardware drivers from the rest, so that new versions of the system only need to update the system without worrying about the support to review and update the drivers as well. GSI images take advantage of this separation, and can therefore be installed on different devices and hence the “generic” of their name.
In practice, GSIs They are mainly used in three ways. Google uses them during its terminal certification process to do different tests, developers can use them to be able to test their applications in future versions of Android without using an emulator or waiting for the official beta for the device and, moreover, lately the The ROM developer community is experimenting with releasing GSI versions of their ROMs, which are sometimes easier to install and more universal than traditional ones.
What you need to install a GSI image
Project Treble and the GSIs try to facilitate the installation of a different version of the system than the one that comes on mobile, but this is still a delicate and complicated process. There are many moving parts and, although Google promised us that they were working on a way to simplify the matter, the truth is that in 2020 it is still a not too intuitive process: a mobile must meet various requirements to be able to flash a GSI.
To begin with, the mobile must have released with support for Project Treble out of the box. There are several ways to check it, from applications until using the ADB command
adb shell getprop ro.treble.enabled. If the result is
false, the mobile is not supported. If the result is true, it is, although you should do an additional check to see the degree of compatibility.
After connect mobile using ADB, you will need to type the command
adb shell cat /system/etc/ld.config.version_API.txt | grep -A 20 "[vendor]", Changing version_API by version the API number of the installed version. For example, in Android 10 you should change it to 29, and in Android 11 to 30. The result will be a torrent of information like the following:
Below the section [vendor] you should look for the value of namespace.default.isolated. Yes it is
true, the mobile is fully compatible with Treble and you can install any version of Android through a GSI. If it isn’t, you can still install GSI images on a Treble-compatible mobile that meets the rest of the requirements, but it must be the same version of Android that is installed. For example, on a Samsung mobile with Android 10 and One UI, you could install an AOSP GSI with Android 10, but not Android 11.
This is the most important requirement, although not the only one. The mobile needs have the bootloader unlocked. You can check if it is your case in different ways. As a general rule, if in the developer options the option appears OEM unlock, it is possible to unlock it with the command the fastboot command
fastboot oem unlock. On Xiaomi mobiles, you can use this method.
How to flash a GSI on a mobile with Treble
Ok, your phone is compatible with Treble and GSI, now what? First of all, remember that flashing the mobile can brick it, cause loop reboots or other problems. Do not do it unless you are familiar with this type of process and have experience recovering the mobile from similar compromised situations. If you have important data on your mobile, it is essential make a full backup.
Of course you will need download GSI image you want to install. You can find the official Google here, and it is important that you download the appropriate one for the architecture of your mobile. Some ROMs, like LineageOS, are experiencing too with GSI.
Download the image on your PC, connect the mobile to the PC using a USB cable and restart the mobile in fastboot mode. The process varies from one mobile to another, but is generally achieved by turning on the mobile while holding down the volume up or down key and the power button. You can also do it with the ADB command
adb reboot bootloader.
You will then need to use fastboot (you can download it from here, without having to download all Android Studio) to perform a series of necessary processes. The first of all is wipe system partition. It’s the point of no return: think twice before proceeding.
Before flashing the GSI image, you will need to run another command to disable verified startupso that the new version of the operating system can boot. For this it is necessary to flash the image vbmeta.img, which is included in the GSI ZIP file downloaded from Google. To do it, you need to use this command:
fastboot --disable-verification flash vbmeta vbmeta.img
At this point, only the final flashing of the GSI in question. The process is exactly the same as before, only changing the command to include the name of the image file that we have downloaded (for example, system.img) and the name of the system partition. This is the command:
fastboot -w flash system nombre_de_la_imagen.img
If all goes well, the flashing process will begin and be ready in a few seconds. Then you can restart the mobile and hopefully start enjoying your GSI experiment. Keep in mind that the first start always takes longer than the successive ones.
Unfortunately, GSI flashing is still a complex, delicate and lengthy process, although we expect Google to simplify the process in the future. If you have a problem with your mobile after doing so – for example, if it loops or does not start – the best solution is download the original firmware and flash it via flashboot, usually with the file flash-all.bat that automates the process.
was originally published in