[syslinux] Compilation on PPC/bigendian machine
Christian Schilmöller
Christian.Schilmoeller at gmx.de
Fri Jun 2 14:49:17 PDT 2006
Hi list!
Sometimes I need to make boot floppies for an i386 based Linux
router. Just for interest, I tried to use syslinux together with my
iMac G4 (PPC) with Yellow Dog Linux to create the floppy.
I know that this is generally difficult because it requires cross-
compiler and cross-assembler. Nevertheless, I tried it because I only
needed the disk installer, the loader binaries for i386 were already
there.
I've found out that the installer was intended to be portable, but in
fact wasn't due to some typos and missing typecasts in the file
libfat/ulint.h.
I was able to correct them and tested the installer successfully.
For the case that someone comes across the same problem (or maybe for
the next version), I'll attach the diff-file of my changes here.
Regards,
Christian
---------- cut here -------------------------------------
--- syslinux-3.11/libfat/ulint.h 2004-12-20 05:57:44.000000000 +0100
+++ syslinux-3.11-new/libfat/ulint.h 2006-06-02 20:45:47.350219424 +0200
@@ -79,35 +79,37 @@
{
uint16_t _v;
- _v = p[0];
- _v |= p[1] << 8;
+ _v = ((const uint8_t *)_p)[0];
+ _v |= ((const uint8_t *)_p)[1] << 8;
return _v;
}
static inline void
write16(le16_t *_p, uint16_t _v)
{
- _p[0] = _v & 0xFF;
- _p[1] = (_v >> 8) & 0xFF;
+ ((uint8_t *)_p)[0] = _v & 0xFF;
+ ((uint8_t *)_p)[1] = (_v >> 8) & 0xFF;
}
static inline unsigned int
read32(le32_t *_p)
{
- _v = _p[0];
- _v |= _p[1] << 8;
- _v |= _p[2] << 16;
- _v |= _p[3] << 24;
+ uint32_t _v;
+
+ _v = ((const uint8_t *)_p)[0];
+ _v |= ((const uint8_t *)_p)[1] << 8;
+ _v |= ((const uint8_t *)_p)[2] << 16;
+ _v |= ((const uint8_t *)_p)[3] << 24;
return _v;
}
static inline void
write32(le32_t *_p, uint32_t _v)
{
- _p[0] = _v & 0xFF;
- _p[1] = (_v >> 8) & 0xFF;
- _p[2] = (_v >> 16) & 0xFF;
- _p[3] = (_v >> 24) & 0xFF;
+ ((uint8_t *)_p)[0] = _v & 0xFF;
+ ((uint8_t *)_p)[1] = (_v >> 8) & 0xFF;
+ ((uint8_t *)_p)[2] = (_v >> 16) & 0xFF;
+ ((uint8_t *)_p)[3] = (_v >> 24) & 0xFF;
}
#endif
More information about the Syslinux
mailing list