summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Ji <ji.luo@nxp.com>2018-07-13 19:32:23 +0800
committerLuo Ji <ji.luo@nxp.com>2018-07-16 10:10:29 +0800
commit2c5e14c80b63b001b68c8a008141afe83ead75ee (patch)
treeb4252074b53ddb199e44b99fdaf5817c36315161
parent8c9f2dbf90c7908c5df1ac3727e8c177c8809240 (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>
-rwxr-xr-xdrivers/usb/gadget/f_fastboot.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 95aab1e080..51a16a211d 100755
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -3532,24 +3532,19 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
fastboot_fail("no flash device defined");
#ifdef CONFIG_FSL_FASTBOOT
-#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