summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLuo Ji <ji.luo@nxp.com>2018-06-08 11:03:14 +0800
committerLuo Ji <ji.luo@nxp.com>2018-07-06 15:48:48 +0800
commit0e6c6d2e6480ae4ce2abff0bea2d856f642d0fda (patch)
tree4f7b2a7e349cf5575873e2cfe2c82fdb7c038085 /drivers
parent315674c6100bc2f97cd9f7e82031dee2e0e2f621 (diff)
[iot] Verify single slot in boota for dual bootloader
A/B switch logic will be moved to SPL stage if dual bootloader feature is enable, in such case, we just need to verify single slot which is selected in SPL stage. Test: verify and boot ok for imx8m. Change-Id: Iafe0d2d4aea1c178551940808416eec4a3547259 Signed-off-by: Luo Ji <ji.luo@nxp.com>
Diffstat (limited to 'drivers')
-rwxr-xr-xdrivers/usb/gadget/f_fastboot.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 06d3809f20..78a694ad53 100755
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -1941,6 +1941,8 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
}
bool allow_fail = (lock_status == FASTBOOT_UNLOCK ? true : false);
avb_metric = get_timer(0);
+ /* if in lock state, do avb verify */
+#ifndef CONFIG_DUAL_BOOTLOADER
/* For imx6 on Android, we don't have a/b slot and we want to verify
* boot/recovery with AVB. For imx8 and Android Things we don't have
* recovery and support a/b slot for boot */
@@ -1949,7 +1951,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
const char *requested_partitions[] = {"boot", 0};
avb_result = avb_ab_flow_fast(&fsl_avb_ab_ops, requested_partitions, allow_fail,
AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE, &avb_out_data);
-#else /* CONFIG_ANDROID_AB_SUPPORT */
+#else
if (!is_recovery_mode) {
const char *requested_partitions[] = {"boot", 0};
avb_result = avb_single_flow(&fsl_avb_ab_ops, requested_partitions, allow_fail,
@@ -1959,7 +1961,20 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
avb_result = avb_single_flow(&fsl_avb_ab_ops, requested_partitions, allow_fail,
AVB_HASHTREE_ERROR_MODE_RESTART, &avb_out_data);
}
-#endif /* CONFIG_ANDROID_AB_SUPPORT */
+#endif
+#else /* !CONFIG_DUAL_BOOTLOADER */
+ /* We will only verify single one slot which has been selected in SPL */
+ const char *requested_partitions[] = {"boot", 0};
+ avb_result = avb_flow_dual_uboot(&fsl_avb_ab_ops, requested_partitions, allow_fail,
+ AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE, &avb_out_data);
+
+ /* Goto fail early if current slot is not bootable. */
+ if (avb_result == AVB_AB_FLOW_RESULT_ERROR_NO_BOOTABLE_SLOTS) {
+ printf("boota: slot verify fail!\n");
+ goto fail;
+ }
+#endif /* !CONFIG_DUAL_BOOTLOADER */
+
/* get the duration of avb */
metrics.avb = get_timer(avb_metric);