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
error 13
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:error 13
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
i tell ld to link it as an elf but when i do readelf on it it says it has the wrong magic bytes
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:error 13
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 ?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:error 13
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
http://www.osdev.org/osfaq2/index.php/G ... s-Compiler
Re:error 13
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?
*edit*
ok, i got mingw so i did this, but my kernel is in asm, does this really matter?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:error 13
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.
objdump yourkernel.elf will show much valueable info.