Files
hardkernel-uboot/include/android_ab.h
Alex Deymo 180cc7c601 android: Implement A/B slot select.
The android_bootloader_control struct defined in bootloader_message.h
stored the A/B metadata used to decide which slot should we use to boot
the device. This patch implements the bootloader side of the slot
selection in a new "android_ab_select" command which decides the
current slot and updates the metadata as needed.

Bug: 32707546
Test: Booted a rpi3, updated to the other slot.
Change-Id: I9344ff5b76194160d2b466a50e84f4f423b1a98a
2017-11-14 10:55:46 +08:00

31 lines
1.1 KiB
C

/*
* Copyright (C) 2017 The Android Open Source Project
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#ifndef __ANDROID_AB_H
#define __ANDROID_AB_H
#include <common.h>
/* Android standard boot slot names are 'a', 'b', 'c', ... */
#define ANDROID_BOOT_SLOT_NAME(slot_num) ('a' + (slot_num))
/** android_ab_select - Select the slot where to boot from.
* On Android devices with more than one boot slot (multiple copies of the
* kernel and system images) selects which slot should be used to boot from and
* registers the boot attempt. This is used in by the new A/B update model where
* one slot is updated in the background while running from the other slot. If
* the selected slot did not successfully boot in the past, a boot attempt is
* registered before returning from this function so it isn't selected
* indefinitely.
*
* @dev_desc: Place to store the device description pointer.
* @part_info: Place to store the partition information.
* @return the slot number (0-based) on success, or -1 on error.
*/
int android_ab_select(struct blk_desc *dev_desc, disk_partition_t *part_info);
#endif