Booting a 64bit kernel
Posted: Wed Dec 24, 2008 3:14 am
Hi!
Today I just tried to create a 64bit kernel executable and load it with GRUB. I followed the method described by AlexExtreme here: post
Here is how my multiboot header looks:
My linker script is the following:
And I compile the source files with the following GCC cmd line parameters:
After linking the object files together with the linker script to a kernel binary when I try to load it with grub (from a CD with stage2_eltorito) I got a message saying that my kernel is "invalid or unsupported executable format".
As I saw in the above linked thread this method works for others so I think I'm doing something wrong. If you have an idea what could be wrong please tell me
Thanks,
giszo
Today I just tried to create a 64bit kernel executable and load it with GRUB. I followed the method described by AlexExtreme here: post
Here is how my multiboot header looks:
Code: Select all
.section .multiboot_header
multiboot_header:
.long MB_HEADER_MAGIC /* magic */
.long ( MB_FLAG_ALIGN_MODULES | MB_FLAG_MEMORY_INFO | (1<<16) ) /* flags */
.long -( MB_HEADER_MAGIC + ( MB_FLAG_ALIGN_MODULES | MB_FLAG_MEMORY_INFO | (1<<16) ) ) /* checksum */
.long multiboot_header
.long __text_start
.long __data_end
.long __kernel_end
.long _start
Code: Select all
OUTPUT_FORMAT("elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SECTIONS {
. = 0x100000;
__text_start = .;
.text : {
*(.multiboot_header);
*(.text);
}
.data : {
. = ALIGN(0x1000);
*(.data);
}
__data_end = .;
.bss : {
. = ALIGN(0x1000);
*(.bss);
}
. = ALIGN(0x1000);
__kernel_end = .;
}
Code: Select all
-m64 -Wall -nostdinc -nostdlib -fno-builtin
As I saw in the above linked thread this method works for others so I think I'm doing something wrong. If you have an idea what could be wrong please tell me
Thanks,
giszo