diff options
author | Justin Waters <justin.waters@timesys.com> | 2012-04-17 13:43:17 -0400 |
---|---|---|
committer | Justin Waters <justin.waters@timesys.com> | 2012-04-17 13:43:17 -0400 |
commit | 4f60d7e7027af17ceffc1a38e6dbe4e3e95c71ec (patch) | |
tree | dd33f3760e08226d5c05036d664d2d68fb3765dc /common/env_common.c | |
parent | b1af6f532e0d348b153d5c148369229d24af361a (diff) |
LogicPD Support for OMAP3/DM3/AM3 boards
From Logic BSP-2.0-5-01
Diffstat (limited to 'common/env_common.c')
-rw-r--r-- | common/env_common.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/common/env_common.c b/common/env_common.c index c3e6388ac0b..04a947e92ba 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -196,6 +196,14 @@ void set_default_env(const char *s) gd->flags |= GD_FLG_ENV_READY; } +int env_check_valid(const char *buf) +{ + env_t *ep = (env_t *)buf; + uint32_t crc; + + memcpy(&crc, &ep->crc, sizeof(crc)); + return crc32(0, ep->data, ENV_SIZE) == crc; +} /* * Check if CRC is valid and (if yes) import the environment. * Note that "buf" may or may not be aligned. @@ -205,11 +213,7 @@ int env_import(const char *buf, int check) env_t *ep = (env_t *)buf; if (check) { - uint32_t crc; - - memcpy(&crc, &ep->crc, sizeof(crc)); - - if (crc32(0, ep->data, ENV_SIZE) != crc) { + if (!env_check_valid(buf)) { set_default_env("!bad CRC"); return 0; } @@ -244,6 +248,9 @@ void env_relocate (void) } else { env_relocate_spec (); } +#ifdef CONFIG_TOUCHUP_ENV + touchup_env(); +#endif } #ifdef CONFIG_AUTO_COMPLETE |