From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Angielski Date: Wed, 17 Mar 2010 21:14:19 -0400 Subject: [U-Boot] [PATCH] env: fix endian ordering in crc table Message-ID: <4BA17E6B.9030503@theptrgroup.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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