Page 1 of 1

error 13

Posted: Fri Aug 20, 2004 10:36 am
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

Re:error 13

Posted: Fri Aug 20, 2004 10:58 am
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.

Re:error 13

Posted: Fri Aug 20, 2004 11:23 am
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

Re:error 13

Posted: Fri Aug 20, 2004 11:34 am
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 ?

Re:error 13

Posted: Fri Aug 20, 2004 11:37 am
by jka913
im running cygwin on windows, 'file kernel.elf' doesn't do anything

Re:error 13

Posted: Fri Aug 20, 2004 4:53 pm
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

Re:error 13

Posted: Fri Aug 20, 2004 7:22 pm
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?

Re:error 13

Posted: Sat Aug 21, 2004 3:33 am
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.

Re:error 13

Posted: Sun Aug 22, 2004 12:48 pm
by jka913
i finally got it to boot using john fine's bootloader, thanks for the help