Page 1 of 1

Grub Won't Boot My Kernel

Posted: Sun Jun 19, 2005 6:01 pm
by linguae
Hello. I got my kernel to compile (I'm referring to the kernel that I have posted here: http://www.mega-tokyo.com/forum/index.php?board=1, with some corrections). I installed a cross compiler for gcc and binutils (they're cross-compiled for i586-pc-elf.) However, I was unable to get Grub to boot my kernel. Here is what I did:

1. Compiled my kernel sources using nasm (for the assembly sources) and the gcc crosscompiler. All of them are in the elf binary format.
2. Checked to see if my kernel was multiboot compliant (it is, this is the following report):

Code: Select all

kernel.bin: The Multiboot header is found at the offset 3997.
kernel.bin: Page alignment is turned on.
kernel.bin: Memory information is turned on.
kernel.bin: Address fields is turned off.
kernel.bin: All checks passed.
3. Placed the resulting kernel binary into a GRUB floppy image.

Every time I try to boot the kernel, though, I get the following message:
Error 13: Invalid or unsupported executable format.

In case you are wondering, I'm using bochs as my tool for booting, and I developing the OS under FreeBSD 5.4. Thanks in advance.

Re:Grub Won't Boot My Kernel

Posted: Mon Jun 20, 2005 2:59 am
by distantvoices
1. you shouldn't have needed to build an elf cross compiler for free bsd. Doesn't it produce elf binaries per se or with a flag on freeBSD?

2. What does your menu.lst look like? Have you pointed grub to your kernel image?

Re:Grub Won't Boot My Kernel

Posted: Mon Jun 20, 2005 4:01 am
by Solar
1. ...but it doesn't hurt either. In the very least you don't get temted to #include parts of the standard library. ;)

2. Check out this thread and double-check you are actually using the cross-tools you have build.

Re:Grub Won't Boot My Kernel

Posted: Mon Jun 20, 2005 1:28 pm
by Kim
Your object is an elf relocatable object or an elf executable file.
GRUB doesn't boot reloc obj because it doesn't have a program header inside the elf file and the executable type isn't set.

Use readelf -a kernel.bin kernel.info

And post header information... if you need relocations in your executable file pass this param to LD --emit-relocs...