summaryrefslogtreecommitdiff
path: root/common/cmd_nvedit.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2013-04-08 10:32:50 +0000
committerTom Rini <trini@ti.com>2013-04-11 15:52:54 -0400
commita7eb1d66c704c884584bf00548cfdf68abfe68bb (patch)
tree30cfb70d331bbbeda6e1d13c6737e5d15951d341 /common/cmd_nvedit.c
parent147162dac6506d2ed96ba5869772f87fb1f49a0b (diff)
downloadu-boot-imx-a7eb1d66c704c884584bf00548cfdf68abfe68bb.zip
u-boot-imx-a7eb1d66c704c884584bf00548cfdf68abfe68bb.tar.gz
u-boot-imx-a7eb1d66c704c884584bf00548cfdf68abfe68bb.tar.bz2
mtd: Make mtdparts work with pre-reloc env
The env in UBI needs to look up the mtd partition as part of relocation, which happens before relocation. Make the mtdparts code capable of working on the default env to start with. The code tries to set values in the env as well, but again, the env isn't there yet, so add a check to setenv to not allow sets before the env is relocated. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'common/cmd_nvedit.c')
-rw-r--r--common/cmd_nvedit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 947d6c4..fab8694 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -273,6 +273,10 @@ int setenv(const char *varname, const char *varvalue)
{
const char * const argv[4] = { "setenv", varname, varvalue, NULL };
+ /* before import into hashtable */
+ if (!(gd->flags & GD_FLG_ENV_READY))
+ return 1;
+
if (varvalue == NULL || varvalue[0] == '\0')
return _do_env_set(0, 2, (char * const *)argv);
else