2025-05-10 21:49:39 +08:00

37 lines
1.3 KiB
Diff

From 64270967cb49d022d40977990f82f80abe631326 Mon Sep 17 00:00:00 2001
From: zmx <zhaomingxin@forlinx.com>
Date: Fri, 1 Dec 2023 10:38:55 +0800
Subject: [PATCH] env bug fix
---
tools/env/fw_env.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 2a61a5d6..0919c31f 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1463,7 +1463,8 @@ int fw_env_open(struct env_opts *opts)
if (!have_redund_env) {
if (!crc0_ok) {
fprintf(stderr,
- "Warning: Bad CRC, using default environment\n");
+ "Warning: Bad CRC, environment variable is empty, please write a valid environment variable to flash in uboot\n");
+ exit(-1);
memcpy(environment.data, default_environment,
sizeof(default_environment));
environment.dirty = 1;
@@ -1536,7 +1537,8 @@ int fw_env_open(struct env_opts *opts)
dev_current = 1;
} else if (!crc0_ok && !crc1_ok) {
fprintf(stderr,
- "Warning: Bad CRC, using default environment\n");
+ "Warning: Bad CRC, environment variable is empty, please write a valid environment variable to flash in uboot\n");
+ exit(-1);
memcpy(environment.data, default_environment,
sizeof(default_environment));
environment.dirty = 1;
--
2.25.1