fastboot: add FASTBOOT_OEM_UNLOCK option

This enables the following fastboot commands:
  fastboot oem unlock
  fastboot oem unlock_accept
  fastboot oem lock
  fastboot getvar oem-unlock

Android 8.1 need the oem unlock status attach to bootargs on boot.

Change-Id: Icc83451336a4dea2cbcf4927287de23bc8e28cb1
Signed-off-by: Jian Qiu <qiujian@rock-chips.com>
This commit is contained in:
Jian Qiu 2018-07-05 09:09:55 +08:00 committed by Kever Yang
parent f6d4196e0f
commit 65413a00f9
4 changed files with 15 additions and 6 deletions

View File

@ -41,7 +41,7 @@ static int do_boot_rockchip(cmd_tbl_t *cmdtp, int flag, int argc,
load_attestation_key(dev_desc, &misc_part_info);
#endif
#ifdef CONFIG_OPTEE_CLIENT
#ifdef CONFIG_FASTBOOT_OEM_UNLOCK
/* read oem unlock status and attach to bootargs */
uint8_t unlock = 0;
TEEC_Result result;

View File

@ -82,6 +82,15 @@ config FASTBOOT_FLASH_MMC_DEV
regarding the non-volatile storage device. Define this to
the eMMC device that fastboot should use to store the image.
config FASTBOOT_OEM_UNLOCK
bool "Enable FASTBOOT OEM UNLOCK command"
depends on OPTEE_CLIENT
help
This enables the command "fastboot oem unlock" the fastboot
oem unlock command requires tee security storage to store
unlock status. oem unlock status attach to bootargs on boot.
endif # USB_FUNCTION_FASTBOOT || UDP_FUNCTION_FASTBOOT
endif # FASTBOOT

View File

@ -582,7 +582,7 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
env_set_ulong("android_root_devnum", dev_desc->devnum);
env_set("android_slotsufix", slot_suffix);
#ifdef CONFIG_OPTEE_CLIENT
#ifdef CONFIG_FASTBOOT_OEM_UNLOCK
/* read oem unlock status and attach to bootargs */
uint8_t unlock = 0;
TEEC_Result result;

View File

@ -688,7 +688,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
strncat(response, part_size_str, chars_left);
}
} else if (!strncmp("oem-unlock", cmd, 10)) {
#ifdef CONFIG_OPTEE_CLIENT
#ifdef CONFIG_FASTBOOT_OEM_UNLOCK
#ifdef CONFIG_RK_AVB_LIBAVB_USER
fastboot_tx_write_str("FAILnot implemented");
return;
@ -1182,7 +1182,7 @@ static void cb_oem(struct usb_ep *ep, struct usb_request *req)
} else
#endif
if (strncmp("unlock", cmd + 4, 8) == 0) {
#ifdef CONFIG_OPTEE_CLIENT
#ifdef CONFIG_FASTBOOT_OEM_UNLOCK
#ifdef CONFIG_RK_AVB_LIBAVB_USER
fastboot_tx_write_str("FAILnot implemented");
return;
@ -1214,7 +1214,7 @@ static void cb_oem(struct usb_ep *ep, struct usb_request *req)
return;
#endif
} else if (strncmp("unlock_accept", cmd + 4, 13) == 0) {
#ifdef CONFIG_OPTEE_CLIENT
#ifdef CONFIG_FASTBOOT_OEM_UNLOCK
#ifdef CONFIG_RK_AVB_LIBAVB_USER
fastboot_tx_write_str("FAILnot implemented");
return;
@ -1271,7 +1271,7 @@ static void cb_oem(struct usb_ep *ep, struct usb_request *req)
return;
#endif
} else if (strncmp("lock", cmd + 4, 8) == 0) {
#ifdef CONFIG_OPTEE_CLIENT
#ifdef CONFIG_FASTBOOT_OEM_UNLOCK
#ifdef CONFIG_RK_AVB_LIBAVB_USER
fastboot_tx_write_str("FAILnot implemented");
return;