summaryrefslogtreecommitdiff
path: root/drivers/fastboot/fb_fsl/fb_fsl_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/fastboot/fb_fsl/fb_fsl_command.c')
-rw-r--r--drivers/fastboot/fb_fsl/fb_fsl_command.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/fastboot/fb_fsl/fb_fsl_command.c b/drivers/fastboot/fb_fsl/fb_fsl_command.c
index 11224728a8..61b1a9d580 100644
--- a/drivers/fastboot/fb_fsl/fb_fsl_command.c
+++ b/drivers/fastboot/fb_fsl/fb_fsl_command.c
@@ -472,6 +472,16 @@ static bool endswith(char* s, char* subs) {
return true;
}
+static bool erase_uboot_env(void) {
+ FbLockState status;
+ status = fastboot_get_lock_stat();
+ if (status == FASTBOOT_LOCK) {
+ printf("can not erase env when device is in locked state\n");
+ return false;
+ } else
+ return env_erase() ? false : true;
+}
+
static void flashing(char *cmd, char *response)
{
FbLockState status;
@@ -726,7 +736,14 @@ static void flashing(char *cmd, char *response)
}
#endif /* !CONFIG_AVB_ATX */
#endif /* CONFIG_IMX_TRUSTY_OS */
- else if (endswith(cmd, "unlock_critical")) {
+ else if (endswith(cmd, ERASE_UBOOT_ENV)) {
+ if(erase_uboot_env())
+ strcpy(response, "OKAY");
+ else {
+ printf("ERROR erase uboot environment variable failed!");
+ strcpy(response, "FAILerase uboot environment variable failed!");
+ }
+ } else if (endswith(cmd, "unlock_critical")) {
strcpy(response, "OKAY");
} else if (endswith(cmd, "unlock")) {
printf("flashing unlock.\n");