cmd: ab_select: Don't count boot-to-recovery as a boot attempt.
The slot rollback system is intended for normal boot failures after an OTA, and therefore, we should not attempt to change slots based on a failure to boot to recovery (or any other non-normal boot sequence). Signed-off-by: Ram Muthiah <rammuthiah@google.com> Link: https://android-review.googlesource.com/c/platform/external/u-boot/+/1446441 Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
This commit is contained in:
parent
71d043d5a8
commit
b7ab6e41f8
|
|
@ -26,7 +26,7 @@ static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ab_select_slot(dev_desc, &part_info);
|
ret = ab_select_slot(dev_desc, &part_info, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("Android boot failed, error %d.\n", ret);
|
printf("Android boot failed, error %d.\n", ret);
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,8 @@ static int ab_compare_slots(const struct slot_metadata *a,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info)
|
int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
|
||||||
|
bool normal_boot)
|
||||||
{
|
{
|
||||||
struct bootloader_control *abc = NULL;
|
struct bootloader_control *abc = NULL;
|
||||||
u32 crc32_le;
|
u32 crc32_le;
|
||||||
|
|
@ -268,7 +269,11 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slot >= 0 && !abc->slot_info[slot].successful_boot) {
|
/* Note that we only count the boot attempt as a valid try when performing
|
||||||
|
* normal boots to Android. Booting to recovery or fastboot does not count
|
||||||
|
* as a normal boot.
|
||||||
|
*/
|
||||||
|
if (slot >= 0 && !abc->slot_info[slot].successful_boot && normal_boot) {
|
||||||
log_err("ANDROID: Attempting slot %c, tries remaining %d\n",
|
log_err("ANDROID: Attempting slot %c, tries remaining %d\n",
|
||||||
BOOT_SLOT_NAME(slot),
|
BOOT_SLOT_NAME(slot),
|
||||||
abc->slot_info[slot].tries_remaining);
|
abc->slot_info[slot].tries_remaining);
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,11 @@ struct disk_partition;
|
||||||
*
|
*
|
||||||
* @param[in] dev_desc Place to store the device description pointer
|
* @param[in] dev_desc Place to store the device description pointer
|
||||||
* @param[in] part_info Place to store the partition information
|
* @param[in] part_info Place to store the partition information
|
||||||
|
* @param[in] normal_boot True if a normal boot, false if booting to recovery.
|
||||||
* @return The slot number (>= 0) on success, or a negative on error
|
* @return The slot number (>= 0) on success, or a negative on error
|
||||||
*/
|
*/
|
||||||
int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info);
|
int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
|
||||||
|
bool normal_boot);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __ANDROID_AB_H */
|
#endif /* __ANDROID_AB_H */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue