public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH]: tools/envcrc.c
@ 2003-01-15 12:49 Laudney Ren
  2003-03-02 15:20 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Laudney Ren @ 2003-01-15 12:49 UTC (permalink / raw)
  To: u-boot

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) ;



-- 
An expert is one who knows more and more about less and less
until he knows absolutely everything about nothing.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot-Users] [PATCH]: tools/envcrc.c
  2003-01-15 12:49 [U-Boot-Users] [PATCH]: tools/envcrc.c Laudney Ren
@ 2003-03-02 15:20 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2003-03-02 15:20 UTC (permalink / raw)
  To: u-boot

In message <3E2558C3.3080205@sjtu.edu.cn> 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

-- 
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-02 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-15 12:49 [U-Boot-Users] [PATCH]: tools/envcrc.c Laudney Ren
2003-03-02 15:20 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox