diff options
author | Luo Ji <ji.luo@nxp.com> | 2018-07-13 19:32:23 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2018-08-20 21:31:58 +0800 |
commit | fd9c8a50279e9d87d2107ccb702e2559f2191d94 (patch) | |
tree | 8ebc03b718ba067fa12a0dc638495d9b434e45d2 /drivers | |
parent | 41b5389845b8912689288d52b8cfc9f71dc115e0 (diff) |
MA-12197 [Android] Unlock device after valid GPT is flashed
Unlocked device maybe locked when gpt overlay changed, unlock the device
after valid gpt is flashed, erase the userdata to ensure safety.
Test: device unlocked after valid gpt flashed.
Change-Id: I7b0306606c632b7dc5668ea1ff8aad63428f278f
Signed-off-by: Luo Ji <ji.luo@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index aa5a8faab5a..40db92d1eb3 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -3389,24 +3389,19 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req) #endif fastboot_fail("no flash device defined"); -#ifdef CONFIG_FASTBOOT_LOCK - int gpt_valid_pre = 0; - int gpt_valid_pst = 0; - if (strncmp(cmd, "gpt", 3) == 0) - gpt_valid_pre = partition_table_valid(); -#endif rx_process_flash(cmd); #ifdef CONFIG_FASTBOOT_LOCK if (strncmp(cmd, "gpt", 3) == 0) { - gpt_valid_pst = partition_table_valid(); + int gpt_valid = 0; + gpt_valid = partition_table_valid(); /* If gpt is valid, load partitons table into memory. So if the next command is "fastboot reboot bootloader", it can find the "misc" partition to r/w. */ - if(gpt_valid_pst) + if(gpt_valid) { _fastboot_load_partitions(); - /* If gpt invalid -> valid, write unlock status, also wipe data. */ - if ((gpt_valid_pre == 0) && (gpt_valid_pst == 1)) + /* Unlock device if the gpt is valid */ do_fastboot_unlock(true); + } } #endif |