diff options
author | Winter Wang <wente.wang@nxp.com> | 2016-11-21 18:21:07 +0800 |
---|---|---|
committer | Winter Wang <wente.wang@nxp.com> | 2016-11-21 18:31:49 +0800 |
commit | 244c4dbc04dec866eff912b0aea8d83eb07be0ee (patch) | |
tree | 173fe03daf8a531453999b6dac134fd9fa978dda /drivers | |
parent | 3197bfd7b43e6eda70116f6439cb0f1e346cf2d1 (diff) | |
download | u-boot-imx-244c4dbc04dec866eff912b0aea8d83eb07be0ee.zip u-boot-imx-244c4dbc04dec866eff912b0aea8d83eb07be0ee.tar.gz u-boot-imx-244c4dbc04dec866eff912b0aea8d83eb07be0ee.tar.bz2 |
libavb: fsl: use bootctl to select slot in UNLOCK
if avb verifies fail in UNLOCK, modify fsl_bootctl
to read a/b metadata, select curr slot based on
metadata.
Change-Id: Ic34a687bb4eb1f07bf58338ad7a995f241fdeec0
Signed-off-by: Winter Wang <wente.wang@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 586e38a..b1a4dbb 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -1912,16 +1912,23 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { } else { /* lock_status == FASTBOOT_UNLOCK && verify fail */ /* if in unlock state, log the verify state */ printf(" verify FAIL, state: UNLOCK\n"); - printf(" boot 'boot_a' still\n"); #endif /* if lock/unlock not enabled or verify fail * in unlock state, will try boot */ size_t num_read; hdr = &boothdr; + char bootimg[8]; + char *slot = select_slot(&fsl_avb_ops); + if (slot == NULL) { + printf("boota: no bootable slot\n"); + goto fail; + } + sprintf(bootimg, "boot%s", slot); + printf(" boot '%s' still\n", bootimg); /* maybe we should use bootctl to select a/b * but libavb doesn't export a/b select */ - if (fsl_avb_ops.read_from_partition(&fsl_avb_ops, "boot_a", + if (fsl_avb_ops.read_from_partition(&fsl_avb_ops, bootimg, 0, sizeof(boothdr), hdr, &num_read) != AVB_IO_RESULT_OK && num_read != sizeof(boothdr)) { printf("boota: read bootimage head error\n"); @@ -1932,7 +1939,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { goto fail; } image_size = android_image_get_end(hdr) - (ulong)hdr; - if (fsl_avb_ops.read_from_partition(&fsl_avb_ops, "boot_a", + if (fsl_avb_ops.read_from_partition(&fsl_avb_ops, bootimg, 0, image_size, (void *)load_addr, &num_read) != AVB_IO_RESULT_OK && num_read != image_size) { printf("boota: read boot image error\n"); |