GRUB Invalid executable program

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ntfs
Posts: 19
Joined: Tue Dec 12, 2006 9:55 am
Location: Czech Republic Prague

GRUB Invalid executable program

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
ntfs
Posts: 19
Joined: Tue Dec 12, 2006 9:55 am
Location: Czech Republic Prague

Post 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?
ntfs
Posts: 19
Joined: Tue Dec 12, 2006 9:55 am
Location: Czech Republic Prague

Post by ntfs »

I reverted back to plain binary. BTW i've found nice multiboot example on NASM's page for download called minimultiboot example.
Post Reply