Android – Non-A/B vs A/B seamless OTA firmware update

What is A/B?

A/B refers to partition names. A is one partition and B is another partition.

What is Non-A/B update?

Android devices without A/B partitions have the following partitions, “boot, system, vendor, userdata, cache, recovery, misc“.

Lets have a look at the life cycle of Non-A/B system update.

  1. Devices perform checks with OTA servers and get notified of the availability of an update.
  2. Downloads OTA packages to a cache or data partition.
  3. Cryptographic signature is verified against the certificates in /system/etc/security. If everything looks fine, User is prompted to install the update.
  4. Device reboots into recovery mode.
  5. Recovery verifies the cryptographic signature of the package against the public keys in /res/keys(part of the RAM disk contained in the recovery partition).
  6. Extracts the package to update the boot, system, and/or vendor partitions as necessary.
  7. The system partition contains the contents for the new recovery partition(optional).
  8. Device reboots normally.
    1. The newly updated boot partition is loaded, and it mounts and starts executing binaries in the newly updated system partition.
    2. As part of normal startup, the system checks the contents of the recovery partition against the desired contents (which were previously stored as a file in /system). They are different, so the recovery partition is re-flashed with the desired contents from system partition. (On subsequent boots, the recovery partition already contains the new contents, so no re-flash is necessary.)

The system update is complete!

When non-A/B devices perform the above 8 steps for OTA upgrade their active partition or boot partition changes as shown in the picture below.

Non-A/B update

What is A/B seamless update?

A/B system updates, also known as seamless updates, ensures a boot able system and minimum downtime when performing a OTA update.

Seamless updates work by having two different system partitions on a device. When using a device that can perform seamless updates, all the transferring is done while one system partition is running, as things are copied and moved into the second partition. The way Android is divided into individual partitions means the data portion — where all the information you’ve entered about an app, things like address books or settings or game save progress — are stored in a separate spot outside of the place where the actual system files live. This is good for system security (the data partition can have its own set of file and folder permissions) and it makes things pretty convenient for seamless updates.

Once all this is done, you can reboot and use the new system partition. This is done without moving the partitions or renaming them because they are numbered. A configuration file used during the boot process is read that tells the kernel and boot process where each partition starts and stops. This file is changed to point to the new system partition instead of the current one(becomes inactive). The next time you update, the other system partition will be wiped and used. They swap back and forth seamlessly.

A/B seamless update

Seamless updates aren’t a requirement for manufacturers. Your existing device partitions may not be A/B partitioned and won’t be able to perform seamless updates.

A/B OTA updates use more space on your devices internal storage. It uses a complete second system partition. Expect a couple of gigabytes to be used and reserved for it.

A Quick comparison of A/B and Non A/B update

  Sl.No  Components  A/B Updates  Non A/B Updates
 1  Recovery Partition available  No  Yes
 2  OS  Partition A and Partition B  Only one Partition
 3  Downtime  Minimal  High
 4  Size  Requires High  Medium
 5  Bootloader changes  Yes  Yes

e-con systems™ has developed eSOMgears-OTA an OTA Firmware Upgrade solution that provides reliable & secure upgrades to your embedded devices, over-the-air (OTA). eSOMgears-OTA is a robust on-demand value added service to the customers who have built their products based on e-con’s eSOMiMX6.

Please visit https://www.e-consystems.com/OTA-software-linux-android-embedded-devices.asp for more information regarding eSOMgears-OTA.

Please refer https://www.e-consystems.com/blog/system-on-module-som/white-paper-design-firmware-update-solution-for-your-device/ for requirements and challenges while designing a solution for a device update.