Agreed. To figure this out, I modified insmod to break up this conditional, and it is the f->header.e_ident[EI_DATA] != ELFDATAM check that fails. (ELFDATAM was 2)

The problem is what I mentioned below.

busybox insmod does the following to check endianess:

#if BB_LITTLE_ENDIAN

# define ELFDATAM ELFDATA2LSB

#else

# define ELFDATAM ELFDATA2MSB <- this is "2"

#endif

but platform.h does not even define "BB_LITTLE_ENDIAN" in busybox 1.1.1:

#ifdef __BIG_ENDIAN__

#define BB_BIG_ENDIAN 1

#elif __BYTE_ORDER == __BIG_ENDIAN

#define BB_BIG_ENDIAN 1

#else

#define BB_BIG_ENDIAN 0

#endif

This was fixed in the svn check in mentioned. It's now:

#ifdef __BIG_ENDIAN__

#define BB_BIG_ENDIAN 1

# define BB_LITTLE_ENDIAN 0

#elif __BYTE_ORDER == __BIG_ENDIAN

#define BB_BIG_ENDIAN 1

# define BB_LITTLE_ENDIAN 0

#else

#define BB_BIG_ENDIAN 0

# define BB_LITTLE_ENDIAN 1

#endif

On Wednesday 02 August 2006 09:56, Andrea Righi wrote:

> Matt,

>

> if you're using i386 RPMs busybox is compiled in a i386 arch and you're

> installing an i386 machine, so endianess should be the same...

>

> Moreover looking in the busybox code it seems that it fails here:

>

> if (f->header.e_ident[EI_CLASS] != ELFCLASSM

> || f->header.e_ident[EI_DATA] != ELFDATAM

> || f->header.e_ident[EI_VERSION] != EV_CURRENT

> || !MATCH_MACHINE(f->header.e_machine)) {

> bb_error_msg("ELF file not for this architecture");

> return NULL;

> }

>

> The correct macros should be the follwing:

>

> /* x86 */

> #if defined(__i386__)

> #ifndef EM_486

> #define MATCH_MACHINE(x) (x == EM_386)

> #else

> #define MATCH_MACHINE(x) (x == EM_386 || x == EM_486)

> #endif

> #define SHT_RELM SHT_REL

> #define Elf32_RelM Elf32_Rel

> #define ELFCLASSM ELFCLASS32

> #define CONFIG_USE_GOT_ENTRIES

> #define CONFIG_GOT_ENTRY_SIZE 4

> #define CONFIG_USE_SINGLE

> #endif

>

> So one of the conditions above is false. But looking at one of your

> modules (found in the initrd you posted) all seems correct:

>

> # readelf -h ext3.o

> ELF Header:

> Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

> Class: ELF32

> Data: 2's complement, little endian

> Version: 1 (current)

> OS/ABI: UNIX - System V

> ABI Version: 0

> Type: REL (Relocatable file)

> Machine: Intel 80386

> Version: 0x1

> Entry point address: 0x0

> Start of program headers: 0 (bytes into file)

> Start of section headers: 114152 (bytes into file)

> Flags: 0x0

> Size of this header: 52 (bytes)

> Size of program headers: 0 (bytes)

> Number of program headers: 0

> Size of section headers: 40 (bytes)

> Number of section headers: 22

> Section header string table index: 21

>

> I mean:

>

> - magic is ok

> - elf class is ELF32

> - elf data is 2's complement, little endian (so endianess seems ok)

> - elf version is current (ok)

> - and MATCH_MACHINE seems ok, since it is Intel 80386

>

> Have you found other details to verify that the problem is really in the

> endianess?

>

> Regards,

> -Andrea

>

> Matt Jamison wrote:

> > No, I'm not installing on x86_64, but I do think I have this problem beat :)

> >

> > The errors I've previously posted are due to Big Endian Little Endian

> > detection in Busy Box 1.1.1.

> >

> > The problem is/was in the endian detection macros in platform.h. A lot of the

> > binaries (insmod etc) in busy box check a #define "BB_LITTLE_ENDIAN" to

> > decide Endianess at compile time. The issue is that BB_LITTLE_ENDIAN was

> > never being defined in busybox 1.1.1.

> >

> > I did find the svn check in that fixed this issue the same way I did, and it

> > is correct in the latest busy box versions:

> >

> > http://www.busybox.net/cgi-bin/viewcvs.cgi?rev=14654&view=rev

> >

> > Author: landley

> > Date: Fri Mar 24 19:01:59 2006 PST (4 months, 1 week ago)

> >

> > Log Message:

> > Define both big endian and little endian macros.

> >

> >

> > Seems like the most appropriate fix is to upgrade to the latest busy box. Why

> > this doesn't cause the same issues with 2.6 kernels, I'm not sure yet.

> >

> > Thanks,

> >

> > Matt

>

> -------------------------------------------------------------------------

> Take Surveys. Earn Cash. Influence the Future of IT

> Join SourceForge.net's Techsay panel and you'll get the chance to share your

> opinions on IT & business topics through brief surveys -- and earn cash

> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

> _______________________________________________

> Sisuite-users mailing list

> [email protected]

> https://lists.sourceforge.net/lists/listinfo/sisuite-users

>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to