Skip to content

Commit

Permalink
common: android_ab: fix slot suffix for abc block
Browse files Browse the repository at this point in the history
To align with the official Android BCB (Bootloader Control Block)
specifications, it's important to note that the slot_suffix should start
with an underscore symbol.

For a comprehensive understanding of the expected slot_suffix format in
userspace, please refer to the provided reference [1].

Links:
[1] - https://source.android.com/docs/core/architecture/bootloader/updating#slots

Based-on: https://android-review.googlesource.com/c/platform/external/u-boot/+/1446439
Reviewed-by: Mattijs Korpershoek <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Tested-by: Guillaume La Roque <[email protected]>
Signed-off-by: Dmitry Rokosov <[email protected]>
Tested-by: Mattijs Korpershoek <[email protected]> # vim3_android
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mattijs Korpershoek <[email protected]>
  • Loading branch information
rockosov authored and makohoek committed Oct 24, 2024
1 parent a995084 commit 55c876c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions boot/android_ab.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static int ab_control_default(struct bootloader_control *abc)
if (!abc)
return -EFAULT;

memcpy(abc->slot_suffix, "a\0\0\0", 4);
memcpy(abc->slot_suffix, "_a\0\0", 4);
abc->magic = BOOT_CTRL_MAGIC;
abc->version = BOOT_CTRL_VERSION;
abc->nb_slot = NUM_SLOTS;
Expand Down Expand Up @@ -328,7 +328,8 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
* or the device tree.
*/
memset(slot_suffix, 0, sizeof(slot_suffix));
slot_suffix[0] = BOOT_SLOT_NAME(slot);
slot_suffix[0] = '_';
slot_suffix[1] = BOOT_SLOT_NAME(slot);
if (memcmp(abc->slot_suffix, slot_suffix,
sizeof(slot_suffix))) {
memcpy(abc->slot_suffix, slot_suffix,
Expand Down

0 comments on commit 55c876c

Please sign in to comment.