[Uboot] Fix (I hope) fw_setenv and write /etc/fw_env.config to avoid detection on each query

pull/144/head
Dmitry Ilyin 2022-01-07 15:45:29 +03:00
parent 107ff3a0b6
commit 34b97acac3
1 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 2a61a5d6f0..19f92e5cdd 100644
index 2a61a5d6f0..4a15a0b1cd 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -37,7 +37,11 @@
@ -114,7 +114,7 @@ index 2a61a5d6f0..19f92e5cdd 100644
+ DEVOFFSET(0) = off;
+ ENVSIZE(0) = env_len;
+ DEVESIZE(0) = mtd.erasesize;
+ ENVSECTORS(0) = mtd.size / mtd.erasesize;
+ ENVSECTORS(0) = env_len / mtd.erasesize;
+ res = 1;
+ break;
+ }
@ -130,7 +130,7 @@ index 2a61a5d6f0..19f92e5cdd 100644
static int parse_config(struct env_opts *opts)
{
int rc;
@@ -1735,9 +1839,11 @@ static int parse_config(struct env_opts *opts)
@@ -1735,9 +1839,17 @@ static int parse_config(struct env_opts *opts)
#if defined(CONFIG_FILE)
/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
if (get_config(opts->config_file)) {
@ -142,6 +142,12 @@ index 2a61a5d6f0..19f92e5cdd 100644
+ opts->config_file);
+ return -1;
+ }
+ FILE* f = fopen(opts->config_file, "wb");
+ fprintf(f, "%s\t%#llx\t%#lx\t%#lx\t%#lx\n",
+ DEVNAME(0),
+ DEVOFFSET(0),
+ ENVSIZE(0), DEVESIZE(0), ENVSECTORS(0));
+ fclose(f);
}
#else
DEVNAME(0) = DEVICE1_NAME;