error 13

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
jka913

error 13

Post by jka913 »

ok, I compiled and linked my kernel, made a grub disk, and put my kernel on it, but whenever I try to boot it either just returns to the menu or gives me an 'Error 13 - invalid or unsupported executable format'. Does anyone have any idea why this is happening?

thanks,
jka913
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:error 13

Post by Pype.Clicker »

well, GRUB doesn't like your kernel. Make sure it has the multiboot header and that you included the AOUT kludge if you're not using ELF as target binary format.
jka913

Re:error 13

Post by jka913 »

i tell ld to link it as an elf but when i do readelf on it it says it has the wrong magic bytes
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:error 13

Post by Pype.Clicker »

then probably your ELF is 'linkable' rather than "executable" ... or you made something nasty. Are you running linux ? what does "file your_kernel_elf_file" outputs ?
jka913

Re:error 13

Post by jka913 »

im running cygwin on windows, 'file kernel.elf' doesn't do anything
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:error 13

Post by Pype.Clicker »

under cygwin, that's not much surprising. Check your linker supports ELF format (should be listed in --help output), and if it doesn't (cygwin is initially designed for PE/COFF afaik), use instructions from the FAQ to set up a cross-compiler ...

http://www.osdev.org/osfaq2/index.php/G ... s-Compiler
jka913

Re:error 13

Post by jka913 »

I tried that before but I dont have a c compiler to compile gcc with

*edit*
ok, i got mingw so i did this, but my kernel is in asm, does this really matter?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:error 13

Post by Pype.Clicker »

well, if you use LD at some time (e.g. if you don't simply put all your kernel in one nasm invokation), having binutils supporting ELF is required. And having Objdump knowing ELF will help aswell

objdump yourkernel.elf will show much valueable info.
jka913

Re:error 13

Post by jka913 »

i finally got it to boot using john fine's bootloader, thanks for the help
Post Reply