GRUB Error: Invalid Or Unsupported Executable Format

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.
Locked
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

GRUB Error: Invalid Or Unsupported Executable Format

Post by Nathan »

Hello,
I've followed all the of this tutorial, the only thing that I've changed was before the ld linking, I've used objcopy to correct a PE error when using ld, but I've used objcopy like this:

Code: Select all

objcopy -I pe-i386 -O binary kernel.o kernel.bin
But when all was ok, GRUB booted and shown that menu to choose, as there was only one choice(myOS) I've selected and pressed enter, the I got this:
Image
Why I'm getting this? There is something I can do?

Best Regards,
Nathan Paulino Campos
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: GRUB Error: Invalid Or Unsupported Executable Format

Post by thepowersgang »

Ok, I would suggest running mbcheck on the binary to validate the multiboot header.
Make sure that the header is within the first 8196 bytes of the kernel. (Usually just linking the file with it first works)
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
gedd
Member
Member
Posts: 104
Joined: Thu Apr 10, 2008 1:47 am

Re: GRUB Error: Invalid Or Unsupported Executable Format

Post by gedd »

Nathan wrote: ... the only thing that I've changed was before the ld linking, I've used objcopy to correct a PE error when using ld, ...
You change executable format to PE too.
What was the error ? Can't use LD script with PE format or something like that ?
Even if use objcopy to produce a PE file after having produced a ELF with specific section with LD script, your specific section will not been reproduced in the PE file.
So goodby Multiboot header and welcome unsuported executable format.

Be carefull, most people on this forums are allergic on PE format !
[ Grub 2 | Visual Studio 2013 | PE File ]
The OsDev E.T.
Don't send OsDev MIB !
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:

Re: GRUB Error: Invalid Or Unsupported Executable Format

Post by Combuster »

I suggest you read properly before complaining. The mere fact that get messages about PE means that you didn't.
"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 ]
Locked