Page 1 of 1

GRUB Error 13 problem

Posted: Thu Sep 28, 2006 10:46 pm
by satyajit
Building a special-purpose OS kernel to support inhouse work.
Development platform is a AMD 1900+ machine running Redhat 9 with 0.93 Grub. Using Gnu gcc compiler, programming in C and in gas assembler.

Got GDT and IDT up and running OK, but as we added ISRs, etc., the Grub boot-loader became increasingly more reluctant to boot the new kernel. Continually get Grub "Error 13: Invalid or unsupported executable format." The new kernel is multiboot-compliant; so that's not the problem, (Magic number etc. OK.) Have gone through the code in detail and can find nothing wrong, and the code compiles without a single warning. Have isolated troubling code; fixed it; and got Grub to accept it. Then added one more line of simple code, and we get Error 13 again. The problem is just getting worse as we continue. It just won't take the IRQ routines.

Have upgraded Grub 0.93 to Grub 2, but that did no good at all. Same problem. Would truly appreciated help on this. We are at our wits-end on this thing.

Some details:
grub.conf is as follows (Amrita.0.2 is kernel under development):

default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-8)
root (hd0,0)
kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
initrd /initrd-2.4.20-8.img
title Amrita.0.2
root (hd0,0)
kernel /Amrita.0.2

Posted: Fri Sep 29, 2006 6:42 am
by intel_breaker
Most typicaly problem... asm file where you have multiboot magic and init function must be linked as first. for example ld --start-group init.S main.c ..... --end-group.
This should helps.

Regards
Greg

GRUB Errot 13 problem

Posted: Sat Sep 30, 2006 2:23 am
by satyajit
Thanks, Greg.

You were right. The problem was indeed in the makefile, but not the ld command. Turns out that Grub, for some reason, did not like the way we were assemblling boot.S. So to keep it simple, we just changed it to a boot.s and multiboot.asm. That works fine.

Appreciate you pointing us in the direction of the makefile. We were focusing, incorrectly, on the code. Thanks again.

Regards,
satyajit