Problem getting GRUB to load my kernel :(
Posted: Wed May 25, 2011 8:49 am
I had kind of left the whole OS devel side of programming for a while because its a little confusing when you are just starting out but I'm back with a cleared head
Okay, I have a simple (one assembly source file) kernel image for GRUB to boot, but it's telling me it's not a valid executable format! I'm compiling with NASM with an output of flat binary. I have a Multiboot header (just the required values). Here is my one assembly file
Of course, that doesn't do anything, but everything is stripped down just to get it booted.
Here is "grub.inc"
I compile with:
and then I mount my virtual hard disk using a loop back, and copy that image to "/boot/"
I use qemu to boot the hdd with this call:
The "$@" is because that is actually in a shell script. That way I can pass extra parameters to qemu if needed.
once in grub, I type "kernel /boot/kernel.bin" and I get this message:
Any help would be greatly appreciated!
Thanks,
Caleb
Okay, I have a simple (one assembly source file) kernel image for GRUB to boot, but it's telling me it's not a valid executable format! I'm compiling with NASM with an output of flat binary. I have a Multiboot header (just the required values). Here is my one assembly file
Code: Select all
[BITS 32]
%include "grub.inc"
start:
cli ; Block interrupts (they can awaken the CPU from halt!)
hlt ; Halt the CPU
ALIGN 4
mboot:
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
Here is "grub.inc"
Code: Select all
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
Code: Select all
nasm -f bin -o kernel.bin ./kernel_entry.asm
I use qemu to boot the hdd with this call:
Code: Select all
qemu -hda ./SimpleKernel.hdd -m 128 "$@"
once in grub, I type "kernel /boot/kernel.bin" and I get this message:
I am using grub v0.97 (yes I know, it's old, but I had it laying around, and it was simple to install )Error 13: Invalid or unsupported executable format
Any help would be greatly appreciated!
Thanks,
Caleb