android_ab.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: BSD-2-Clause */
  2. /*
  3. * Copyright (C) 2017 The Android Open Source Project
  4. */
  5. #ifndef __ANDROID_AB_H
  6. #define __ANDROID_AB_H
  7. struct blk_desc;
  8. struct disk_partition;
  9. /* Android standard boot slot names are 'a', 'b', 'c', ... */
  10. #define BOOT_SLOT_NAME(slot_num) ('a' + (slot_num))
  11. /* Number of slots */
  12. #define NUM_SLOTS 2
  13. /**
  14. * Select the slot where to boot from.
  15. *
  16. * On Android devices with more than one boot slot (multiple copies of the
  17. * kernel and system images) selects which slot should be used to boot from and
  18. * registers the boot attempt. This is used in by the new A/B update model where
  19. * one slot is updated in the background while running from the other slot. If
  20. * the selected slot did not successfully boot in the past, a boot attempt is
  21. * registered before returning from this function so it isn't selected
  22. * indefinitely.
  23. *
  24. * @param[in] dev_desc Place to store the device description pointer
  25. * @param[in] part_info Place to store the partition information
  26. * @return The slot number (>= 0) on success, or a negative on error
  27. */
  28. int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info);
  29. #endif /* __ANDROID_AB_H */