I want to make a multiboot-compliant kernel. I decided to test it first with the sample kernel provided with the Multiboot Specification (http://www.mcc.ac.uk/grub/multiboot_4.html#SEC23), but I can't get it to work.
I'm using GNU GRUB v0.92(which came with Red Hat 8.0) to boot the machine. The kernel is supposed to be run in text mode, but when I tell GRUB to boot the kernel it just sits there at the Graphical Grub interface. I noticed that the kernel didn't specify a video mode, so I changed it to specify 80x25 text mode, but it still does the same thing. Of course the specification says that the loader can just ignore that if it feels like it (although the bit that you set for it seems to imply that it shouldn't), so maybe GRUB doesn't support that feature. I may also have made a mistake in compiling/linking it. This is my Makefile (using gcc v3.2):
mykernel: boot.S kernel.c multiboot.h
gcc -nostdinc -H -nostdlib -static -e _start boot.S kernel.c -o mykernel
Does anybody have any ideas on what could be wrong? If not, any ideas on a really simple way to tell if the kernel is even running?
Problems With Multiboot
-
carbonBased
RE:Problems With Multiboot
You could put a little beep function in there to test if the kernel is, in fact, running... or change your grub config to display the boot menu in standard text mode (the graphical bootup is a patch applied to the standard grub, and maybe isn't 100% bug-free, so I'd try without it, for now).
If nothing works with the above two, then I'd suggest that, probably, the multiboot header isn't completely correct.
If I recall correctly, GRUB will not load kernels below the 1MB mark, which means you must explicitly tell GCC to compile at or above this mark.
Try the following linker script, and see what happens:
SECTIONS {
.text 0x00100000 :{
*(.text)
}
textEnd = .;
.data :{
*(.data)
*(.rodata)
}
dataEnd = .;
.bss :{
*(.common)
*(.bss)
}
bssEnd = .;
}
If nothing works with the above two, then I'd suggest that, probably, the multiboot header isn't completely correct.
If I recall correctly, GRUB will not load kernels below the 1MB mark, which means you must explicitly tell GCC to compile at or above this mark.
Try the following linker script, and see what happens:
SECTIONS {
.text 0x00100000 :{
*(.text)
}
textEnd = .;
.data :{
*(.data)
*(.rodata)
}
dataEnd = .;
.bss :{
*(.common)
*(.bss)
}
bssEnd = .;
}
-
mikeleany
RE:Problems With Multiboot
Thanks. It worked fine, once I finally figured out how to switch GRUB to text mode. (Why can't people just make things intuitive?)