summaryrefslogtreecommitdiff
path: root/common/env_nand.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2008-07-10 09:09:45 +0200
committerStefan Roese <sr@denx.de>2008-07-10 09:09:45 +0200
commitac5ba41c2234dd513ed2c879914e964cc05a0135 (patch)
treeeea25003c17267efc504264bc1faa419a355a138 /common/env_nand.c
parent7c6237b3e2f2ee0098897da39b79aff4642b8946 (diff)
parent4188f0491886b3b486164e819c0a83fdb97efd7d (diff)
Merge branch 'master' of /home/stefan/git/u-boot/u-boot
Diffstat (limited to 'common/env_nand.c')
-rw-r--r--common/env_nand.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/common/env_nand.c b/common/env_nand.c
index 8954017704..104f0856af 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -95,8 +95,8 @@ uchar env_get_char_spec (int index)
/* this is called before nand_init()
* so we can't read Nand to validate env data.
* Mark it OK for now. env_relocate() in env_common.c
- * will call our relocate function which will does
- * the real validation.
+ * will call our relocate function which does the real
+ * validation.
*
* When using a NAND boot image (like sequoia_nand), the environment
* can be embedded or attached to the U-Boot image in NAND flash. This way
@@ -246,7 +246,7 @@ int saveenv(void)
puts ("Writing to Nand... ");
total = CFG_ENV_SIZE;
- if (writeenv(CFG_ENV_OFFSET, env_ptr)) {
+ if (writeenv(CFG_ENV_OFFSET, (u_char *) env_ptr)) {
puts("FAILED!\n");
return 1;
}
@@ -349,7 +349,7 @@ void env_relocate_spec (void)
int ret;
total = CFG_ENV_SIZE;
- ret = readenv(CFG_ENV_OFFSET, env_ptr);
+ ret = readenv(CFG_ENV_OFFSET, (u_char *) env_ptr);
if (ret || total != CFG_ENV_SIZE)
return use_default();
@@ -363,19 +363,7 @@ void env_relocate_spec (void)
static void use_default()
{
puts ("*** Warning - bad CRC or NAND, using default environment\n\n");
-
- if (default_environment_size > CFG_ENV_SIZE){
- puts ("*** Error - default environment is too large\n\n");
- return;
- }
-
- memset (env_ptr, 0, sizeof(env_t));
- memcpy (env_ptr->data,
- default_environment,
- default_environment_size);
- env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE);
- gd->env_valid = 1;
-
+ set_default_env();
}
#endif