Grub - Error 13 - Invalid or unsupported executable format
Posted: Tue Feb 24, 2004 8:41 pm
I'm trying to right a simple kernel following
http://www.osdever.net/tutorials/basick ... ?the_id=12
I also am using grub as the bootloader. To enable this I need to make my kernel image multiboot. So rather than simply use the kernel_start.asm file in the tutorial I used the boot.S and multiheader.h files from grub.
in boot.S I changed the call to main to EXT_C(k_main) and then called hlt straight after that. Removing references to printf and stuff
I then compiled that with gcc
gcc -c boot.S -o ks.o
My kernel.c file is the same as in the tutorial so
gcc -c kernel.c -o kernel.o
I then use the tutorials linker script and go
ld -T link.ld -o kernel.bin ks.o kernel.o
I now have a kernel.bin file of about 20k or so
I downloaded the grub_disk.img file that has grub installed on it. I then prepared this as /dev/loop0 and mounted it under /mnt/temp
browsing into temp I can see the dir /boot. I copy my kernel.bin file into /mnt/temp/boot, unmount the image
I then setup Bochs and pointed its floppya and my image file,
it boots grub fine but when I select 'My Kernel' from the list it attempts to load but generates a
Error 13: Invalid or unsupported executable format
Is there something wrong that I am doing above or is there something else I need to do? I am assuming grub puts the computer into protected mode etc.. etc..
Thanks for any help
http://www.osdever.net/tutorials/basick ... ?the_id=12
I also am using grub as the bootloader. To enable this I need to make my kernel image multiboot. So rather than simply use the kernel_start.asm file in the tutorial I used the boot.S and multiheader.h files from grub.
in boot.S I changed the call to main to EXT_C(k_main) and then called hlt straight after that. Removing references to printf and stuff
I then compiled that with gcc
gcc -c boot.S -o ks.o
My kernel.c file is the same as in the tutorial so
gcc -c kernel.c -o kernel.o
I then use the tutorials linker script and go
ld -T link.ld -o kernel.bin ks.o kernel.o
I now have a kernel.bin file of about 20k or so
I downloaded the grub_disk.img file that has grub installed on it. I then prepared this as /dev/loop0 and mounted it under /mnt/temp
browsing into temp I can see the dir /boot. I copy my kernel.bin file into /mnt/temp/boot, unmount the image
I then setup Bochs and pointed its floppya and my image file,
it boots grub fine but when I select 'My Kernel' from the list it attempts to load but generates a
Error 13: Invalid or unsupported executable format
Is there something wrong that I am doing above or is there something else I need to do? I am assuming grub puts the computer into protected mode etc.. etc..
Thanks for any help