aboutsummaryrefslogtreecommitdiff
path: root/env/common.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-31 10:13:07 -0400
committerTom Rini <trini@konsulko.com>2020-07-31 10:13:07 -0400
commita2d051e7b6a8f87add1067d936bb0c805a47b0df (patch)
tree671af1a640f1fbb27f87a82685d8be9e632ee564 /env/common.c
parent719f42190d5f0238cb01ef2ffba8af2285f7bc7a (diff)
parentdb82015929aeff6b58982a22d61ab8c5b87752f3 (diff)
Merge branch '2020-07-31-more-env-updates'
- Fix EFI selftest to not force setting serial# environment (and also get the U-Boot prompt dynamically). - Support for append only environment and other related features. - Improved ext4 environment support - Fix the case of fw_setenv being used on flash devices that were not already locked.
Diffstat (limited to 'env/common.c')
-rw-r--r--env/common.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/env/common.c b/env/common.c
index 088b2aebb4..ed18378000 100644
--- a/env/common.c
+++ b/env/common.c
@@ -81,6 +81,7 @@ void env_set_default(const char *s, int flags)
debug("Using default environment\n");
}
+ flags |= H_DEFAULT;
if (himport_r(&env_htab, (char *)default_environment,
sizeof(default_environment), '\0', flags, 0,
0, NULL) == 0)
@@ -99,7 +100,7 @@ int env_set_default_vars(int nvars, char * const vars[], int flags)
* Special use-case: import from default environment
* (and use \0 as a separator)
*/
- flags |= H_NOCLEAR;
+ flags |= H_NOCLEAR | H_DEFAULT;
return himport_r(&env_htab, (const char *)default_environment,
sizeof(default_environment), '\0',
flags, 0, nvars, vars);
@@ -109,7 +110,7 @@ int env_set_default_vars(int nvars, char * const vars[], int flags)
* Check if CRC is valid and (if yes) import the environment.
* Note that "buf" may or may not be aligned.
*/
-int env_import(const char *buf, int check)
+int env_import(const char *buf, int check, int flags)
{
env_t *ep = (env_t *)buf;
@@ -124,7 +125,7 @@ int env_import(const char *buf, int check)
}
}
- if (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\0', 0, 0,
+ if (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\0', flags, 0,
0, NULL)) {
gd->flags |= GD_FLG_ENV_READY;
return 0;
@@ -141,7 +142,8 @@ int env_import(const char *buf, int check)
static unsigned char env_flags;
int env_import_redund(const char *buf1, int buf1_read_fail,
- const char *buf2, int buf2_read_fail)
+ const char *buf2, int buf2_read_fail,
+ int flags)
{
int crc1_ok, crc2_ok;
env_t *ep, *tmp_env1, *tmp_env2;
@@ -161,10 +163,10 @@ int env_import_redund(const char *buf1, int buf1_read_fail,
return -EIO;
} else if (!buf1_read_fail && buf2_read_fail) {
gd->env_valid = ENV_VALID;
- return env_import((char *)tmp_env1, 1);
+ return env_import((char *)tmp_env1, 1, flags);
} else if (buf1_read_fail && !buf2_read_fail) {
gd->env_valid = ENV_REDUND;
- return env_import((char *)tmp_env2, 1);
+ return env_import((char *)tmp_env2, 1, flags);
}
crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) ==
@@ -199,7 +201,7 @@ int env_import_redund(const char *buf1, int buf1_read_fail,
ep = tmp_env2;
env_flags = ep->flags;
- return env_import((char *)ep, 0);
+ return env_import((char *)ep, 0, flags);
}
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */