grub 13 error and crazy hex in my kernel

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
User avatar
casnix
Member
Member
Posts: 67
Joined: Fri Jan 14, 2011 7:24 pm

grub 13 error and crazy hex in my kernel

Post 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
You are a computer.
~ MCS ~
thomasloven
Member
Member
Posts: 89
Joined: Tue Feb 26, 2008 10:47 am
Location: Sweden

Re: grub 13 error and crazy hex in my kernel

Post 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.
User avatar
casnix
Member
Member
Posts: 67
Joined: Fri Jan 14, 2011 7:24 pm

Re: grub 13 error and crazy hex in my kernel

Post 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.
You are a computer.
~ MCS ~
thomasloven
Member
Member
Posts: 89
Joined: Tue Feb 26, 2008 10:47 am
Location: Sweden

Re: grub 13 error and crazy hex in my kernel

Post by thomasloven »

Objdump is included in binutils and is probably installed with your cross compiler environment.
User avatar
casnix
Member
Member
Posts: 67
Joined: Fri Jan 14, 2011 7:24 pm

Re: grub 13 error and crazy hex in my kernel

Post by casnix »

Okay! I didn't know that, thanks!
You are a computer.
~ MCS ~
Post Reply