From 0046a443476900c52dc8a524af8635c10bd68d94 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Wed, 5 Apr 2017 23:15:48 +0200 Subject: [PATCH] Clear env vars used in recovery script before and after running it Recovery script uses two variables: a button press time counter (cnt) and a flag (stop_boot) used later to decide if booting process should be interrupted. Clear their values before and after running recovery script as they could already exist in environment (could be accidentally saved). --- u-boot/common/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/u-boot/common/main.c b/u-boot/common/main.c index 6237d15..4a59988 100644 --- a/u-boot/common/main.c +++ b/u-boot/common/main.c @@ -162,14 +162,25 @@ void main_loop(void) gd->flags &= ~(GD_FLG_SILENT); #endif + /* + * Always clear values of variables used in recovery script + * as they could be accidentally saved before + */ + setenv("stop_boot", NULL); + setenv("cnt", NULL); + run_command("run recovery", 0); /* Should we stop booting after recovery mode? */ c = getenv("stop_boot"); stop_boot = c ? (int)simple_strtol(c, NULL, 10) : 0; - if (stop_boot) + if (stop_boot) { + setenv("stop_boot", NULL); bootcmd = NULL; + } + + setenv("cnt", NULL); } #endif /* CONFIG_RECOVERY_MODE */ -- 2.25.1