From: Jeff Angielski <jeff@theptrgroup.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] cross compiling fw_printenv on big endian
Date: Wed, 17 Mar 2010 11:10:50 -0400 [thread overview]
Message-ID: <4BA0F0FA.8030701@theptrgroup.com> (raw)
In-Reply-To: <OF58804F61.5F4988C4-ONC12576E9.004ED2BA-C12576E9.004EF355@transmode.se>
Joakim Tjernlund wrote:
>
> Wolfgang Denk <wd@denx.de> wrote on 2010/03/17 12:57:31:
>> Dear Joakim Tjernlund,
>>
>> In message <OFF4AB0804.BE309218-ONC12576E9.003A69DF-C12576E9.
>> 003B4D86 at transmode.se> you wrote:
>>> hmm, I recently discovered that normal user space headers always define
>>> both __LITTLE_ENDIAN and __BIG_ENDIAN so therefore a
>>> # ifdef __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)
>>> # endif
>>>
>>> Wont work. One have to use
>>> #if __BYTE_ORDER == __LITTLE_ENDIAN
>>> instead.
>> Wenn...
>
>> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
>>
>>
>> Looks as if this were your very own commit. Do you have a fix in the
>> works?
>
> I know, but I don't have anything ATM. I am too busy debugging serious
> customer problems.
>
> Jocke
This appears to work for me on my big endian PowerPC target. Perhaps
somebody with a little endian target can verify it does not break their
env tools.
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)
Jeff Angielski
The PTR Group
www.theptrgroup.com
next prev parent reply other threads:[~2010-03-17 15:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 19:17 [U-Boot] cross compiling fw_printenv on big endian Jeff Angielski
2010-03-17 10:34 ` Detlev Zundel
2010-03-17 10:47 ` Joakim Tjernlund
2010-03-17 11:57 ` Wolfgang Denk
2010-03-17 14:22 ` Joakim Tjernlund
2010-03-17 15:10 ` Jeff Angielski [this message]
2010-03-17 17:09 ` Joakim Tjernlund
2010-03-17 19:18 ` Jeff Angielski
2010-03-21 19:29 ` 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=4BA0F0FA.8030701@theptrgroup.com \
--to=jeff@theptrgroup.com \
--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