[U-Boot] [PATCH v4 4/4] [RFC] env: call env_erase twice if CONFIG_ENV_OFFSET_REDUND is set

Frank Wunderlich frank-w at public-files.de
Sun Apr 28 08:51:28 UTC 2019


erase also the redundant environment location if offset is defined

this is a possible implementation without adding additional parameter
to env erase command

Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
---
 cmd/nvedit.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 2071bcf443..f11972e8f1 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -766,8 +766,15 @@ U_BOOT_CMD(
 static int do_env_erase(cmd_tbl_t *cmdtp, int flag, int argc,
 			char * const argv[])
 {
-	return env_erase(false) ? 1 : 0;
+	int ret;
+
+	ret = env_erase(false) ? 1 : 0;
+	#ifdef CONFIG_ENV_OFFSET_REDUND
+		ret = ret || (env_erase(true) ? 1 : 0);
+	#endif
+	return ret;
 }
+
 U_BOOT_CMD(
 	eraseenv, 1, 0,	do_env_erase,
 	"erase environment variables from persistent storage",
--
2.17.1



More information about the U-Boot mailing list