ab.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. Android A/B updates
  3. ===================
  4. Overview
  5. --------
  6. A/B system updates ensures modern approach for system update. This feature
  7. allows one to use two sets (or more) of partitions referred to as slots
  8. (normally slot A and slot B). The system runs from the current slot while the
  9. partitions in the unused slot can be updated [1]_.
  10. A/B enablement
  11. --------------
  12. The A/B updates support can be activated by specifying next options in
  13. your board configuration file::
  14. CONFIG_ANDROID_AB=y
  15. CONFIG_CMD_AB_SELECT=y
  16. The disk space on target device must be partitioned in a way so that each
  17. partition which needs to be updated has two or more instances. The name of
  18. each instance must be formed by adding suffixes: ``_a``, ``_b``, ``_c``, etc.
  19. For example: ``boot_a``, ``boot_b``, ``system_a``, ``system_b``, ``vendor_a``,
  20. ``vendor_b``.
  21. As a result you can use ``ab_select`` command to ensure A/B boot process in your
  22. boot script. This command analyzes and processes A/B metadata stored on a
  23. special partition (e.g. ``misc``) and determines which slot should be used for
  24. booting up.
  25. Command usage
  26. -------------
  27. .. code-block:: none
  28. ab_select <slot_var_name> <interface> <dev[:part_number|#part_name]>
  29. for example::
  30. => ab_select slot_name mmc 1:4
  31. or::
  32. => ab_select slot_name mmc 1#misc
  33. Result::
  34. => printenv slot_name
  35. slot_name=a
  36. Based on this slot information, the current boot partition should be defined,
  37. and next kernel command line parameters should be generated:
  38. * ``androidboot.slot_suffix=``
  39. * ``root=``
  40. For example::
  41. androidboot.slot_suffix=_a root=/dev/mmcblk1p12
  42. A/B metadata is organized according to AOSP reference [2]_. On the first system
  43. start with A/B enabled, when ``misc`` partition doesn't contain required data,
  44. the default A/B metadata will be created and written to ``misc`` partition.
  45. References
  46. ----------
  47. .. [1] https://source.android.com/devices/tech/ota/ab
  48. .. [2] https://android.googlesource.com/platform/bootable/recovery/+/refs/tags/android-10.0.0_r25/bootloader_message/include/bootloader_message/bootloader_message.h