env: fix endian ordering in crc table
PATCH 1/1 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.
--- lib_generic/crc32.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib_generic/crc32.c +0 -0
@@ -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)
Signature · 6 lines
1.6.3.3 -- Jeff Angielski The PTR Group www.theptrgroup.com
PATCH 1/1 env: fix endian ordering in crc table
Jeff Angielski <[email protected]> wrote on 2010/03/18 02:14:19:
Quoted 7 lines
From: Jeff Angielski <[email protected]>
To: u-boot at lists.denx.de
Cc: Joakim Tjernlund <[email protected]>
Date: 2010/03/18 02:14
Subject: [PATCH] env: fix endian ordering in crc table
Quoted 5 lines
The crc table was being built as little endian for big endian targets. This would cause
fw_printenvto always fail with "Warning: Bad CRC, using default environment" messages.Signed-off-by Jeff Angielski <[email protected]>
Quoted 26 lines
--- lib_generic/crc32.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)lib_generic/crc32.c +0
-0@@ -163,7 +163,7 @@ const uint32_t * ZEXPORT get_crc_table()#endif /* ========================================================================= */
lib_generic/crc32.c +1
-2-# 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