: tools/envcrc.c
PATCH 1/1 : tools/envcrc.c
Hi, all:
In u-boot-0.2.0, the file "tools/envcrc.c" failed to consider the difference between "normal env" and "redundand env". It is a very obvious error.
Here is the patch:
======================================================================
--- old/u-boot-0.2.0/tools/envcrc.c Tue Dec 24 18:52:15 2002
+++ new/u-boot-0.2.0/tools/envcrc.c Wed Jan 15 15:56:48 2003
@@ -36,15 +36,32 @@
# ifndef CFG_ENV_OFFSET # define CFG_ENV_OFFSET (CFG_ENV_ADDR - CFG_FLASH_BASE) # endif +# if !defined(CFG_ENV_ADDR_REDUND) && defined(CFG_ENV_OFFSET_REDUND) +# define CFG_ENV_ADDR_REDUND (CFG_FLASH_BASE + CFG_ENV_OFFSET_REDUND) +# endif # ifndef CFG_ENV_SIZE # define CFG_ENV_SIZE CFG_ENV_SECT_SIZE # endif -# if ((CFG_ENV_ADDR >= CFG_MONITOR_BASE) && \ - ((CFG_ENV_ADDR+CFG_ENV_SIZE) <= (CFG_MONITOR_BASE + CFG_MONITOR_LEN))) -# define ENV_IS_EMBEDDED +# if defined(CFG_ENV_ADDR_REDUND) && !defined(CFG_ENV_SIZE_REDUND) +# define CFG_ENV_SIZE_REDUND CFG_ENV_SIZE +# endif +# if (CFG_ENV_ADDR >= CFG_MONITOR_BASE) && \ + (CFG_ENV_ADDR+CFG_ENV_SIZE) <= (CFG_MONITOR_BASE + CFG_MONITOR_LEN) +# define ENV_IS_EMBEDDED 1 +# endif +# if defined(CFG_ENV_ADDR_REDUND) || defined(CFG_ENV_OFFSET_REDUND) +# define CFG_REDUNDAND_ENVIRONMENT 1 # endif #endif /* CFG_ENV_IS_IN_FLASH */
+#ifdef CFG_REDUNDAND_ENVIRONMENT
+# define ENV_HEADER_SIZE (sizeof(unsigned long) + 1)
+#else
+# define ENV_HEADER_SIZE (sizeof(unsigned long))
+#endif
+
+#define ENV_SIZE (CFG_ENV_SIZE - ENV_HEADER_SIZE)
+
extern unsigned long crc32 (unsigned long, const unsigned char *,
unsigned int);
#ifdef ENV_IS_EMBEDDED
@@ -57,8 +74,8 @@
#ifdef ENV_IS_EMBEDDED
int crc ;
unsigned char *envptr = &environment,
-
*dataptr = envptr + sizeof(unsigned int) + 1; - unsigned int datasize = env_size - (dataptr - envptr) ; + *dataptr = envptr + ENV_HEADER_SIZE;
+ unsigned int datasize = ENV_SIZE ;
crc = crc32(0, dataptr, datasize) ;
Signature · 2 lines
An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.
PATCH 1/1 : tools/envcrc.c
Quoted 6 lines · In message <[email protected]> you wrote:
In u-boot-0.2.0, the file "
tools/envcrc.c" failed to consider the difference between "normal env" and "redundand env". It is a very obvious error.Here is the patch:
Thanks, added. Will show up on CVS soon. Sorry it took so long.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Systems programmers are the high priests of a low cult.
-- R.S. Barton