big-endian sandbox issue

Antony Pavlov antonynpavlov at gmail.com
Tue Jun 30 21:55:05 PDT 2015


Hi!

I have tried to build barebox on big-endian MIPS CPU running Debian 8.
It fails because of unconditional <linux/byteorder/little_endian.h> inclusion.

At the first glance this can help:

--- a/arch/sandbox/include/asm/byteorder.h
+++ b/arch/sandbox/include/asm/byteorder.h
@@ -3,6 +3,12 @@

 #include <asm/types.h>

+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#include <linux/byteorder/big_endian.h>
+#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #include <linux/byteorder/little_endian.h>
+#else
+#error "__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ and __BYTE_ORDER__ !=
__ORDER_LITTLE_ENDIAN__"
+#endif

 #endif /* _I386_BYTEORDER_H */

But some warning appears:

In file included from common/filetype.c:21:0:
/barebox.git/arch/sandbox/include/asm/unaligned.h:11:21: warning:
"__LITTLE_ENDIAN" is not defined [-Wundef]
 #if __BYTE_ORDER == __LITTLE_ENDIAN

System-wide <endian.h> can fix the situation, but we use -nostdinc, so
the error occurs:

barebox.git/arch/sandbox/include/asm/byteorder.h:7:20: fatal error:
endian.h: No such file or directory
 #include <endian.h>
                    ^
compilation terminated.

Moreover AFAIR <endian.h> isn't available on BSD, so '#if
defined(__linux__)' has to be used.


Any suggestions?

-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list