[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Invalid or unsupported executable format

From: Peter Wiehe
Subject: Invalid or unsupported executable format
Date: Wed, 24 Sep 2003 20:59:09 +0200

I have written a (very!) minimal test kernel "testkern.asm" (for NASM), trying
to go really to the "sceleton" of multiboot.
The problem with this test kernel is: mbchk says okay. But GRUB bootloader

----------Error message of Grub bootloader:-------------
Error 13: Invalid or unsupported executable format.

--------------content of testkern.asm----------------
jmp     short $
dd      0x1BADB002, 0, -0x1BADB002
times 9 dd 0

I use Grub 0.91, Nasm 0.98, Linux/GNU, x86 (Pentium).
(Below are details about the build script and boot menu entry.)

What's wrong?
It's an ELF (not an application, only an object file, but it's still a
valid ELF).

The object file has only 512 bytes, so GRUB can find the multiboot header.

And Grub doesn't complain about missing the entry point, so that's not the
problem, too (or is this error hidden in that error message 13?).

I've written an equivalent of testkern.asm in C, compiled that with gcc, and
it got bootloaded well by Grub. [A global array of "long"s containing the
multiboot header and "x: goto x;" in main().]

If I split the multiboot header and the code in two NASM source files,
assemble them and then link them with ld, grub can boot it, too.

Is it a NASM bug?

In the grub and multiboot docu I couldn't find any restriction that isn't
fulfilled with my test kernel. For example no note, that the code entry point
in an ELF mustn't be before the multiboot header (only if the address fields
are used).

And mbchk should complain about it, if it's really an invalid/unsupported
format (as Grub reports)! That is what mbchk is for, or maybe I'm expecting
too much from mbchk?

-------Content of build script "build2":-------------
nasm testkern.asm -f elf -o /boot/testkern.o
mbchk /boot/testkern.o

-------Output of "build2":---------------------------
/boot/testkern.o: The Multiboot header is found at the offset 306.
/boot/testkern.o: Page alignment is turned off.
/boot/testkern.o: Memory information is turned off.
/boot/testkern.o: Address fields is turned off.
/boot/testkern.o: All checks passed.

----Content of /boot/grub/menu.lst (*** = ignore this):---
timeout ***

title ***
        kernel ***

title ***
        kernel ***

title ***
        kernel ***

title testkern.o
        kernel (hd0,2)/boot/testkern.o


Kind regards
Peter Wiehe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]