Page 1 of 1

GRUB Invalid executable program

Posted: Tue Dec 12, 2006 10:02 am
by ntfs
I 've decided to use GRUB so i made simple hello word-ish OS to test it. i wrote NASM file that includes multiboot header and made NASM output it with -f elf so GRUB can read it. Mbcheck reports file is multiboot compilant, file reports it's 32-bit elf but GRUB is still reporting invalid format.

Posted: Tue Dec 12, 2006 10:16 am
by Combuster
1: You don't need an ELF binary to be supported by GRUB. My own kernel is just a flat binary. Maybe it reads the ELF headers instead of the multiboot header.
2: You are trying to load your kernel below the 1M, or beyond physical memory. Check your multiboot header for this

Posted: Tue Dec 12, 2006 10:20 am
by ntfs
ELF is much more comfortable to use and I thing it's better(i was using flat binary with my own loader before). I am loading the kernel to load_addr of 1024*1024 which is exactly above 1m(hope i read the specs well). And i doubt it would print invalid executable format in this case. Can't be there some problem that the ELF have to be stripped etc?

Posted: Tue Dec 12, 2006 11:14 am
by ntfs
I reverted back to plain binary. BTW i've found nice multiboot example on NASM's page for download called minimultiboot example.