2

I have a Xiaomi Mi 6X which is the Chinese version of A2. There is a way to convert it into A2, but OTA updates won't work because 6X has only A partition. I'm not sure, but I've read, it is possible to create/delete partitions on an Android device.

So I want to create A/B partitions manually, but I have no idea how it looks like.

0
4

Android uses GUID Partition Table (GPT) as its partitioning system which is possible to modify using tools like parted and gdisk. But there are a few constraints I can think of, other than the OTA problem you have already mentioned:

  • Android devices with A/B partition scheme have many partitions in (_a/_b) pairs including system, vendor, aboot, sbl and modem. New partitions require space which obviously isn't available on flash memory (eMMC) and needs to be freed from your userdata partition. So you will get short on your /sdcard space.
  • Since all the partitions to be created aren't adjacent to userdata partition (which is usually the last one), you may need to delete and create dozens of partitions. Exact details depend on the order of partitions in your partition table. So there are bright chances of bricking your device. :)
  • Application bootloader (aboot) on A/B devices is different than on non-A/B devices. On A/B devices, there are two boot partitions and no recovery partition. So the process of making choice from where to boot the device is different than on non-A/B devices.
  • Also the other functionality of aboot that depends on partition names such as fastboot update will also break. And since bootloaders are closed source, you can't modify it to be compatible with your new partition table (unless you are lucky as well as an expert at hexediting binaries).

So it seems practically impossible to convert a non-A/B device to A/B device.

2
  • 1
    I recently analyzed some abl images and it's has a/b slot support even on a-only phone. But of course, it's very dangerous and needs to understand what you are doing. Qualcomm abl sources: source.codeaurora.org/quic/la/abl/tianocore/edk2/tree/…
    – Axifive
    Nov 1 '19 at 0:28
  • @Axifive interesting. Did you reverse engineer abl? If yes, were you able to find hard-coded addresses particularly for boot_[a|b]? Nov 1 '19 at 5:51
2

Xiaomi A2 has the same hardware as Mi 6X and actually, Mi 6X is the Chinese version of A2. Why not fully flashing Mi 6X with A2 ROM, including GPT structures from the firmware? The problem will be fastboot itself, as you can't write on GPT there or change the name of the partitions as it brokes the existing fastboot in the current ABL (Android BootLoader), but it should work if ABL itself is changed to the one in A2.

You will need to use EDL mode to fully write A2 ROM on Mi 6X with A2's partition table, or at least write both GPT structure and ABL.elf with other bootloader partitions like XBL.elf and then use fastboot (which will be flashed from A2 so it must recognize and respond to the name of the partitions from A2) to flash the remaining partitions.

This should be possible only if both devices are typically the same in hardware and SoC firmware and there isn't Secure Boot eFuse provided by Qualcomm in the Mi 6X SoC, as this will prevent a modified or different ABL (Android BootLoader) from being loaded in the first place (even if the bootloader is unlocked) which will bring you again to EDL mode with boot error. So first, check if you have secure boot enabled or not by something like fastboot oem SecureBoot GetFuseStatus if your device supports this command, or by directly flashing different A2 ROM with its GPT structures and see what will happen.

You should also know that what you do is risky and you have a pretty high chance of bricking your phone, so do it at your own risk.

0

The a/b partitioning scheme doesn't eat into internal storage—on a Google pixel 1, the a/b scheme takes only 320MiB more than the a-only scheme. Source:Android Developers https://source.android.com/devices/tech/ota/ab/ab_faqs

4
  • 1
    How does this answer the question? // How would you halve the size of the system partition without recompiling your ROM with changed source code? You need to be a ROM developer for that so that to create a customized OS to save space on /system_a by putting .odex files on /system_b and then move them to /data on first boot. But anyway, space is not the only problem. Other problems need more serious consideration. Feb 15 '20 at 12:12
  • can you also suggest any tools for creating AB partition on a smartphone? Feb 15 '20 at 12:13
  • @IrfanLatif there is already a ROM with A/B partition from Xiaomi A2. I'm wondering if I can create an A/B partition on a Mi 6X (which has the same hardware). Feb 15 '20 at 12:17
  • 1
    @ArayKarjauv you can use parted or gdisk for partitioning. // You won't lose much space if system on Mi 6X equals in size to system_a+system_b on A2. But as I said, the core problem is not space, but that the bootloader on Mi 6X must support A/B partitions. You can also try using A2's BL on Mi 6X but (among other requirements) bootloader must be signed by Xiaomi with the same key (which is highly unlikely). ABL won't boot if signature verification fails. Also the pre-ABL BLs (SBL, XBL etc.) and SoC firmware might also be different on both phones, so may not work with different ABL. Feb 15 '20 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.