MA-17541-1 Support virtual A/B update
authorJi Luo <ji.luo@nxp.com>
Wed, 22 Jul 2020 11:03:32 +0000 (19:03 +0800)
committerJi Luo <ji.luo@nxp.com>
Thu, 13 May 2021 01:49:18 +0000 (09:49 +0800)
commit97495e9189afc4a26e6e03fd8ac7389f445c590e
tree5a73b72ffb6c9dd020925a4f744f045aa552ac8b
parent881f5a44e3eb80ac2b3c1ba08c7bf544330c0039
MA-17541-1 Support virtual A/B update

A 'misc_virtual_ab_message' struct will be stored at the 32kB offset
in misc partition, which will be used to record the virtual A/B update
status.

Bootloader should take care of this status, some operations must be
restricted. This commit will:
    1. Restrict erase/flash operations to "misc", "userdata" or
       "metadata" partitions if the merge status are "SNAPSHOTTED" or
       "MERGING".
    2. Restrict slot switch if the merge status is "MERGING".
    3. Output a warning in slot switch if the merge status is "SNAPSHOTTED".
    4. Set the merge status as "CANCELLED" if image flash happen.

Test: 1. fastboot erase/flash "userdata", "misc", "metadata" after virtual
        A/B update
      2. slot switch after virtual A/B update

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I33f0041c5e76913d3970d943cad52353e0ac5f2d
(cherry picked from commit 30df087bfc5e31413473f85dfefaa7176bc394a8)
(cherry picked from commit 7fd03bcc8f1fc094362c11d71cf740ac9b5724c1)
drivers/fastboot/fb_fsl/Makefile
drivers/fastboot/fb_fsl/fb_fsl_command.c
drivers/fastboot/fb_fsl/fb_fsl_virtual_ab.c [new file with mode: 0644]
drivers/fastboot/fb_fsl/fb_fsl_virtual_ab.h [new file with mode: 0644]
include/android_bootloader_message.h
lib/Kconfig