Creating a multiboot ELF image
Posted: Sat Dec 01, 2001 7:06 am
I'm new to the forum, HI ALL!
I'm starting some kernel stuff, just for fun ;D I've been at the FAQ but I didn't find answers to my questions. So, here they go:
I don't know how to compile an elf-multiboot kernel image. I've created a little head.asm file with a silly multiboot header and a main.c file that just contains an endless main() function (with a 'for' inside).
I assemble head.asm with:
nasm -f elf head.as head.o
I compile main.c with:
gcc -o main.o -c main.c
Then, I join them with the following command:
ld -Ttext 0x100000 -e start --oformat elf32-i386 boot/head.o kernel/main.o -o mykernel.o
But when trying to load the image file with GRUB, it says that it is invalid.
Are these commands valid for the compilation??
My silly multiboot header is now:
align 32
dd 0x1BADB002 ; Magic
dd 0 ; Flags...
dd 0 ; What here?
Am I supposed to create a valid Multiboot header inside the file? Where can I get good info about this? And an (clear) example?
Thanks a lot!!
PS: Maybe this should go to the FAQ, isn't it? ;)
I'm starting some kernel stuff, just for fun ;D I've been at the FAQ but I didn't find answers to my questions. So, here they go:
I don't know how to compile an elf-multiboot kernel image. I've created a little head.asm file with a silly multiboot header and a main.c file that just contains an endless main() function (with a 'for' inside).
I assemble head.asm with:
nasm -f elf head.as head.o
I compile main.c with:
gcc -o main.o -c main.c
Then, I join them with the following command:
ld -Ttext 0x100000 -e start --oformat elf32-i386 boot/head.o kernel/main.o -o mykernel.o
But when trying to load the image file with GRUB, it says that it is invalid.
Are these commands valid for the compilation??
My silly multiboot header is now:
align 32
dd 0x1BADB002 ; Magic
dd 0 ; Flags...
dd 0 ; What here?
Am I supposed to create a valid Multiboot header inside the file? Where can I get good info about this? And an (clear) example?
Thanks a lot!!
PS: Maybe this should go to the FAQ, isn't it? ;)