How to convert Xiaomi Mi A1 From Stock to Treble [Treblize Mi A1]

The Chinese smartphone manufacturer Xiaomi had launched Xiaomi Mi A1 with Android One Platform which runs on Stock Android out-of-the-box. The handset became so popular for its specifications, camera performance, and Stock Android UI at a very budget price tag. But that time the phone didn’t come with Project Treble support preloaded. Here in this article, we will share with you the proper step-by-step detailed guide on How to convert Xiaomi Mi A1 From Stock to Treble [Treblelize Mi A1].

Thanks to the XDA Senior member CosmicDan who has put a lot of his work on XDA along with this instruction to convert Xiaomi Mi A1 from Stock to Treble. The support for Treble was included in the Android Oreo 8.0 update, but Mi A1 didn’t get the support with that update. The Mi A1 users can get Android updates and GSI ports quite faster in Project Treble. Google’s Project Treble features a huge improvement in architecture for the OS framework to help out the smartphone manufacturers push their timely Android updates to devices easily.

Now, you may ask about Treble and why it’s so important for future Android devices as well. We have provided all the necessary guides in brief so that you can understand the process. Let’s get started……

What is Treble?

Treble is the short term of a new Android architecture model of splitting the system into two new partitions: System and Vendor.

  • System: Here Android OS goes, means System will take care of Android Operating System like Oreo/Pie
  • Vendor: Here the device-specific files go, like device drivers.

Before Treble architecture, both the Android OS and device-specific files would live together on the system. XDA Developers has given the full description of all which we’re going to elaborate.

What is Treblizing?

Treblizing is also known as Treble-enable. Treble-conversion or some variation of the system partitions called Treblizing. This is the process of converting a non-Treble device to a Treble-compatible device. In order to convert a non-Treble device to a Treble-compatible device, you need to change the partition map of the device. This involves shrinking an existing partition.

Treblizing is just the preparation stage – you still need an AIO installation (see AIO below) before you are actually able to use a Treble ROM.

How to convert Xiaomi Mi A1 From Stock to Treble [Treblize Mi A1]


The vendor is also known as Vendor Pack or Vendor Image. In terms of the Treble, this is a stand-alone vendor image (.zip or .img) that can be flashed to your Treble-enabled device to be compatible with a Treble system. These are similar to a kernel source in the way that they are flashed to its own partition on your device and are compatible with many Treble Systems.

Treble developers for the Xiaomi Mi A1 may release stand-alone ‘vendor.img’ file for other ROMs.


GSI stands for ‘Generic System Image’ file. This concept was introduced and developed by @phhusson to create a System image that is device-atheist. It’s a ROM that is designed to work with an existing Treble device, as long as the device has a GSI-compatible Vendor and kernel installation.


For the smartphones with official Treble support, the GSI developer introduced the GSI system for compatibility. Xiaomi Mi A1 didn’t come with in-built Treble support. That’s why XDA Developers (Mi A1 codenamed as Tissot) have taken the responsibility to make a Vendor/Kernel that is GSI-compatible.

AIO (All-In-One)

AIO stands for All-In-One. This is a Treble firmware that includes a Kernel, System, and a Vendor image in a single ROM zip file. This provides an all-in-one Treble experience through a device-specific Treble ROM. AIO’s are developed to work well with its own ROM but similarly, it would be compatible with a GSI as well.

A Chart of Key Terms Given Below: (Image)


How to convert Xiaomi Mi A1 From Stock to Treble [Treblize Mi A1]
Image Credit: XDA Developers

1. Restoring to Stock

In order to get a full consistency, we highly recommend everyone to revert to a clean stock ROM. This will ensure the flashing compatibility without any error. If you’re impatient or experienced, feel free to skip this process. But if you have any issues, try again from here.

This will also restore the ROM to the stock partition map, means before ‘Treblizing’.

1.1. Requirements

  • Your device should have unlocked bootloader and EDL access/drivers.

fastboot oem edl – Type this command and press enter to boot into EDL (Emergency Download Mode).

1.2. Full-device backup


Taking backup is highly recommended. TWRP Recovery Backup is suitable for these kinds of flashing. It will take all the system, vendor partitions backup easily and stable.

Also, backup your internal storage related files. The Treblizing process may delete your internal storage completely.

1.3. Stock restore process

  • Flash the latest firmware (V10.0.4.0.PDHMIXM Pie at the time of writing) in EDL mode with MiFlash. This will wipe your device Internal Storage and restore the stock partition map. This may take a while.
  • Optional Way: If Wi-Fi is not working on your device, then flash the tissot_images_V. zip file in MiFlash under EDL, attached. Just extract the zip file and browse to the folder in MiFlash. You can replace the persist.img from official V. or another ROM if you want to confirm that it’s genuine.
    • You have already backed up original persist.img in step 1, so there is no risk in it.
    • MiFlash in EDL is able to re-build a MAC address while flashing the persist. So, there is no confirmation on it.


2. Treblize (re-partition) the device

You will need to install an AIO ROM after this part. This is a One-Time-Process for getting Treble capability on your device.

  • Fastboot reboot to TWRP with mohancm’s recovery img (recovery-3.2.1-1) if you don’t have TWRP installed. Otherwise, proceed to the next line.
  • Install the latest TWRP with Treble Manager (v1.2 at the time of writing, but you can get the latest version also) then Reboot into Recovery to actually load it. You can read about TWRP with Treble Manager in that linked thread to understand how it works.
  • Format Data in Wipe option (to remove Stock encryption), then Reboot into Recovery again.
  • In TWRP, go to Advanced > Treble Manager and repartition the device by following the wizard.
    • Data shrink is recommended. Just try the Treble Manager and it will ask you one last time before re-partitioning so don’t worry about the wiping without warning.
  • After finishing the flash, it will reboot into TWRP. You are now ready for installing a Treble AIO and then a GSI. (Check if there is a known issue that you need to work around – otherwise, a bootloop will occur).


3. First Treble ROM Installation

Any failure to this will occur a bootloop.
  • Please note that the current slot is in the Reboot menu. If you followed this guide from Section 1, you should be in Slot A. If you’re not, just swap any mention of Slot A and Slot B in these steps.
  • Download a Treble AIO ROM (such as RR Treble Experimental) and flash in TWRP Recovery. (This is required even if you want to use a GSI since it has the required Vendor Pack and Kernel)
  • Immediately install TWRP with Treble Manager again to re-insert TWRP into the new ROM boot image.
  • Reboot Recovery again. [Not the System]
  • Confirm in Reboot menu that the device has successfully switched to Slot B. If it’s still stuck in Slot A, this is a one-time bug that must be solved now – if you don’t fix this then you will get a bootloop issue.
    • If it’s still stuck in Slot A, you must reboot to fastboot mode (make sure you have a current version, as explained in Requirements section) and manually run the command and pressing enter:

fastboot –set-active=b

    • After doing this for once, slot switching should work fine in TWRP again.
    • In case you didn’t know, all ROMs for seamless device actually install into the # other # slots that aren’t currently active. That’s why you always need to Reboot into Recovery mode for the first time before installing Magisk or GApps, etc.
    • It’s advised to the users that in order to keep an eye on their Slot switching whenever you install an AIO ROM to make sure it worked. If it happens again after these steps, that will be a bug. You need to report it to XDA Forum with all details, files, and screenshot images, if possible.

After following these steps, you should be able to flash Treble ROMs similar as you flash a normal ROM via TWRP.


4. Installing AIO, GSI, Vendor, and More

After installing the first Treble ROM and then Treble transformation, you’re now ready to flash AIO, GSI, Vendor, etc.

4.1. Install a Treble AIO

At the time of sharing this guide, the only Treble AIO is the RR Experimental build. If any other latest build comes, you can install it like normal ROMs. Let’s head over to the process:

  • Flash the AIO ROM in TWRP with Treble Manager 1.2+ (Don’t reboot)
  • Immediately flash TWRP with Treble Manager 1.2+ again to get the Treble-compatible TWRP back in the list.
  • Then perform the Factory Reset.
  • Take a note of which slot you are on right now to understand later.
  • Now, Reboot into recovery mode.
  • Make sure your device has now swapped to the other slot by checking the reboot menu.
    • If it has not shown the slot, you will need to repeat the fastboot –set=active step as explained in Section 3.
  • Now, the slot has changed. Therefore, you can install GApps, Magisk, etc.

4.2. Install a Treble GSI

You may remember from earlier that the Treble GSI is just System image that uses your existing Vendor and Kernel. We already have installed a Treble kernel and Vendor from an AIO (Section 3 or Section 4.1. above), so it’s quite simple:

  • Download any GSI/Phh-Treble ROMs from the Treble-Enabled Device Development section and copy the img file to your device.
  • Make sure your current slot is a Treble ROM slot (existing AIO or GSI working). Unlike AIO/ROM zip flashing, image flashing installs it to the Current slot.
  • Flash the img file to ‘System Image’ in TWRP with Treble Manager 1.2+ version.
  • Do a Factory Reset if you’re changing ROM by any mean.
  • Install any other mods like GApps, GSI-compatible Magisk, etc. You may need to boot the ROM once before installing any mods. This varies per GSI file. Some existing mods may also be outright incompatible with the GSI.
  • Reboot to Recovery.
Since this is only a System image, there is no need to re-install TWRP Recovery.

4.3. Install/update a Vendor Pack

While you’re on a current and working AIO or GSI slot, you can flash a vendor.img to update the driver/device level stuff for that ROM. This could be done to e.g. fix the Camera. This is useful if you’re running a GSI.

  • Download a vendor.img from your AIO or Vendor Pack provider (e.g. RR AIO Experimental) and copy the IMG to device
  • Make sure your current slot is a Treble ROM slot (existing AIO or GSI working). Unlike AIO/ROM zip flashing, image flashing installs it to the Current slot.
  • Take a TWRP backup of Vendor if you want more safety and time-saving. (Optional)
  • Flash the Image to Vendor Image in TWRP with Treble Manager 1.2+ version.
  • Reboot to recovery.
This is only a System image, there is no need to re-install TWRP Recovery or install any Mods like GApps, Magisk, etc. Unless it’s a Vendor mod (at the time of writing, no Vendor mods exist yet).

4.4. Install a Non-Treble ROM

This is simple, same as you’re used to before Treblizing. But do note that this is only possible if you chose to resize User data when repartitioning with Treble Manager.

  • Download the ROM on your device.
  • Make sure the active slot is one with a Treble AIO/GSI ROM already [remember that ROM ZIPs install to the OTHER slot, not the currently active one] so this way you can easily switch back to the Treble ROM by just doing a Factory Reset (or TWRP restore of Data) and slot switch. (Optional)
  • Perform a Factory Reset.
  • Install the ROM as per usual procedure (Install zip, re-flash TWRP with Treble Manager 1.2+, Reboot into Recovery to allow slot switch, install GApps/Magisk/Mods then reboot).

4.5. Restore a TWRP backup

There is nothing special about restoring a backup via TWRP Recovery. Even if your backup was from a non-Treble ROM, you can restore that backup on a Treblized device. Though, any Treble ROM backup can only be restored on a Treblized device.


5. Mods and Extras (GApps, Magisk, Custom Kernels)

After booting TWRP into the correct slot (Section 3) now, you’re ready to install other ROMs (Section 4) followed by mods.

  • Any usual GApps may work fine, just keep the slot correctly. Please Note: RR Camera (GCam) requires GApps to be installed. You can also use GApps Nano package as well.
    • Also, note that some GSI’s will require you to boot the system first before installing GApps.
  • Custom Kernels must be marked as Treble compatible for Xiaomi Mi A1 device. Info for kernel developers: this means adding a slot select flag to vendor entry in DTB and disabling dm-verity (so you can insert vendor changes to the system).
  • The standard Magisk will work in RR Treble ROM, but it doesn’t work on GSI. You need Magisk 16.4 beta or later for GSI’s.
  • Some other zip files might need updating for Treble compatibility. However, if you’re a developer or know what are you doing, you can experiment at your own risk.

For more details, Q&A, and forum support, you can check out the original article from here.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.