How to make GRUB1 load a 64-bit kernel
Posted: Fri Jul 06, 2012 2:33 am
Hello Everone:
I've started to develop an OS.I'm developing a 64-bit OS.Using GRUB1 for loader.It seems that GRUB1 do not support flt64 files so I have to link 64-bit code to elf32. However the wayes on google don't work.I have on idea how to do it now. Can who show me how to do it?
PS:I'm really no a good writer in English. Forgive me.
the asm code
kernel.asm
linker.ld
nasm -f elf64 -o kernel.o kernel.asm
ld -T linker.ld -o kernel.bin kernel.o -m elf_i386
NASM version 2.09.10
GNU ld (GNU Binutils for Ubuntu) 2.22
I've started to develop an OS.I'm developing a 64-bit OS.Using GRUB1 for loader.It seems that GRUB1 do not support flt64 files so I have to link 64-bit code to elf32. However the wayes on google don't work.I have on idea how to do it now. Can who show me how to do it?
PS:I'm really no a good writer in English. Forgive me.
the asm code
kernel.asm
Code: Select all
[org 0x100000]
[BITS 64]
[global _start]
start:
hlt
Code: Select all
OUTPUT_FORMAT(elf32-i386)
OUTPUT_ARCH(i386:x86-64)
ENTRY(start)
SECTIONS
{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
*(.rodata)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
ld -T linker.ld -o kernel.bin kernel.o -m elf_i386
NASM version 2.09.10
GNU ld (GNU Binutils for Ubuntu) 2.22