Page 1 of 1

grub 13 error and crazy hex in my kernel

Posted: Wed Apr 20, 2011 7:01 pm
by casnix
My kernel compiles okay, but I get the infernal "error 13: invalid or unsupported executable"

So I took a look at the hex, and in big endian the multi-boot header is at the very end of the executable. Don't know if that's good. I'm using a cross compiler on my Mac, and I don't know how to find the location of the binary where something starts in my hex editor (HexFiend). Anyway, just before the multiboot starts, there's some crap about the netwide assembler being built on an apple computer. In the binary.

Is my binary @$$-backwards or just clogged by a bad assembler?

Please comment if you want the binary to look at it in your own hex editor.

...I need to learn how to get more info out of hex (any help would be greatly appreciated! ;) )

EDIT: Also, there are a hell of a lot of zero's inbetween each section of the binary (the contents of the object files)

Thanks,
Matt

Re: grub 13 error and crazy hex in my kernel

Posted: Thu Apr 21, 2011 2:07 am
by thomasloven
It sounds like you managed to get your multiboot header into the .rodata section of your executable (assuming it's an ELF file).
Try adding

Code: Select all

[section .text]
or something right before your multiboot header declaration.

It's all in the wiki. http://wiki.osdev.org/Grub_Error_13

Edit: Generally, I think you get more information from objdump than from a hex editor. Some people disagree.

Re: grub 13 error and crazy hex in my kernel

Posted: Thu Apr 21, 2011 11:15 am
by casnix
I'm on mac and wih Xcode comes an objdump work alike called otool, but apples got it so messed up that you have to have a compiled executable in mach-o format. Anyway, I will try this when I get home! Thank you.

Re: grub 13 error and crazy hex in my kernel

Posted: Thu Apr 21, 2011 12:17 pm
by thomasloven
Objdump is included in binutils and is probably installed with your cross compiler environment.

Re: grub 13 error and crazy hex in my kernel

Posted: Thu Apr 21, 2011 1:19 pm
by casnix
Okay! I didn't know that, thanks!