public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] env: fix endian ordering in crc table
@ 2010-03-18  1:14 Jeff Angielski
  2010-03-18  6:55 ` Joakim Tjernlund
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Angielski @ 2010-03-18  1:14 UTC (permalink / raw)
  To: u-boot


The crc table was being built as little endian for big endian
targets.  This would cause fw_printenv to always fail with
"Warning: Bad CRC, using default environment" messages.

Signed-off-by: Jeff Angielski <jeff@theptrgroup.com>
---
  lib_generic/crc32.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib_generic/crc32.c b/lib_generic/crc32.c
index 468b397..27335a3 100644
--- a/lib_generic/crc32.c
+++ b/lib_generic/crc32.c
@@ -163,7 +163,7 @@ const uint32_t * ZEXPORT get_crc_table()
  #endif

  /* 
========================================================================= */
-# ifdef __LITTLE_ENDIAN
+# if __BYTE_ORDER == __LITTLE_ENDIAN
  #  define DO_CRC(x) crc = tab[(crc ^ (x)) & 255] ^ (crc >> 8)
  # else
  #  define DO_CRC(x) crc = tab[((crc >> 24) ^ (x)) & 255] ^ (crc << 8)
-- 
1.6.3.3

-- 
Jeff Angielski
The PTR Group
www.theptrgroup.com

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

* [U-Boot] [PATCH] env: fix endian ordering in crc table
  2010-03-18  1:14 [U-Boot] [PATCH] env: fix endian ordering in crc table Jeff Angielski
@ 2010-03-18  6:55 ` Joakim Tjernlund
  0 siblings, 0 replies; 2+ messages in thread
From: Joakim Tjernlund @ 2010-03-18  6:55 UTC (permalink / raw)
  To: u-boot

Jeff Angielski <jeff@theptrgroup.com> wrote on 2010/03/18 02:14:19:

> From: Jeff Angielski <jeff@theptrgroup.com>
> To: u-boot at lists.denx.de
> Cc: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> Date: 2010/03/18 02:14
> Subject: [PATCH] env: fix endian ordering in crc table
>
>
> The crc table was being built as little endian for big endian
> targets.  This would cause fw_printenv to always fail with
> "Warning: Bad CRC, using default environment" messages.
>
> Signed-off-by: Jeff Angielski <jeff@theptrgroup.com>

Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

> ---
>   lib_generic/crc32.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib_generic/crc32.c b/lib_generic/crc32.c
> index 468b397..27335a3 100644
> --- a/lib_generic/crc32.c
> +++ b/lib_generic/crc32.c
> @@ -163,7 +163,7 @@ const uint32_t * ZEXPORT get_crc_table()
>   #endif
>
>   /*
> ========================================================================= */
> -# ifdef __LITTLE_ENDIAN
> +# if __BYTE_ORDER == __LITTLE_ENDIAN
>   #  define DO_CRC(x) crc = tab[(crc ^ (x)) & 255] ^ (crc >> 8)
>   # else
>   #  define DO_CRC(x) crc = tab[((crc >> 24) ^ (x)) & 255] ^ (crc << 8)
> --
> 1.6.3.3
>
> --
> Jeff Angielski
> The PTR Group
> www.theptrgroup.com
>

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

end of thread, other threads:[~2010-03-18  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18  1:14 [U-Boot] [PATCH] env: fix endian ordering in crc table Jeff Angielski
2010-03-18  6:55 ` Joakim Tjernlund

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