public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Laudney Ren <bren@sjtu.edu.cn>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH]: tools/envcrc.c
Date: Wed, 15 Jan 2003 20:49:07 +0800	[thread overview]
Message-ID: <3E2558C3.3080205@sjtu.edu.cn> (raw)

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.

             reply	other threads:[~2003-01-15 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-15 12:49 Laudney Ren [this message]
2003-03-02 15:20 ` [U-Boot-Users] [PATCH]: tools/envcrc.c Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E2558C3.3080205@sjtu.edu.cn \
    --to=bren@sjtu.edu.cn \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox