diff options
author | Ji Luo <ji.luo@nxp.com> | 2018-08-23 19:12:45 +0800 |
---|---|---|
committer | faqiang.zhu <faqiang.zhu@nxp.com> | 2018-11-12 09:18:37 +0800 |
commit | c14e9d4e276c408db200a632029a8193944348f3 (patch) | |
tree | 92582988f4a35fa40766fd34842436d91feb9e72 /drivers/usb/gadget | |
parent | d4a0dbd9a467984d7f4a4861213298e2b95a3327 (diff) |
[iot] Support lock vboot for Android Things
Supoort "fastboot oem at-lock-vboot" command for Android
Things, this command can only be called after perm-attr
have been fused.
Test: build and boot ok on imx7d_pico and AIY.
Change-Id: Ifcfeb2a38d88c5d12b46a1d9ea61b182ae2e7bcb
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 0a185156f1..4a2cde2bfd 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -2014,9 +2014,14 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { /* check lock state */ FbLockState lock_status = fastboot_get_lock_stat(); if (lock_status == FASTBOOT_LOCK_ERROR) { +#ifdef CONFIG_AVB_ATX + printf("In boota get fastboot lock status error, enter fastboot mode.\n"); + goto fail; +#else printf("In boota get fastboot lock status error. Set lock status\n"); fastboot_set_lock_stat(FASTBOOT_LOCK); lock_status = FASTBOOT_LOCK; +#endif } bool allow_fail = (lock_status == FASTBOOT_UNLOCK ? true : false); avb_metric = get_timer(0); @@ -3342,6 +3347,15 @@ static void cb_flashing(struct usb_ep *ep, struct usb_request *req) #ifdef CONFIG_AT_AUTHENTICATE_UNLOCK } #endif + } else if (endswith(cmd, FASTBOOT_AT_LOCK_VBOOT)) { + if (perm_attr_are_fused()) { + status = do_fastboot_lock(); + if (status != FASTBOOT_LOCK_ERROR) + strcpy(response, "OKAY"); + else + strcpy(response, "FAILlock device failed."); + } else + strcpy(response, "FAILpermanent attributes not fused!"); } #endif /* CONFIG_AVB_ATX */ #ifdef CONFIG_ANDROID_THINGS_SUPPORT @@ -3401,12 +3415,19 @@ static void cb_flashing(struct usb_ep *ep, struct usb_request *req) strcpy(response, "FAILunlock device failed."); #endif } else if (endswith(cmd, "lock")) { +#ifdef CONFIG_AVB_ATX + /* We should do nothing here For Android Things which + * enables the at-lock-vboot feature. + */ + strcpy(response, "OKAY"); +#else printf("flashing lock.\n"); status = do_fastboot_lock(); if (status != FASTBOOT_LOCK_ERROR) strcpy(response, "OKAY"); else strcpy(response, "FAILlock device failed."); +#endif } else if (endswith(cmd, "get_unlock_ability")) { result = fastboot_lock_enable(); if (result == FASTBOOT_UL_ENABLE) { |