From 34b97acac3d8935fc9b1ee47c6ed0fc177ec762d Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin Date: Fri, 7 Jan 2022 15:45:29 +0300 Subject: [PATCH] [Uboot] Fix (I hope) fw_setenv and write /etc/fw_env.config to avoid detection on each query --- .../0011-env-partition-autosearch.patch | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/general/package/fwprintenv-openipc/0011-env-partition-autosearch.patch b/general/package/fwprintenv-openipc/0011-env-partition-autosearch.patch index 91ebbf4e..79aa0eec 100644 --- a/general/package/fwprintenv-openipc/0011-env-partition-autosearch.patch +++ b/general/package/fwprintenv-openipc/0011-env-partition-autosearch.patch @@ -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;