How to load a 64bit kernel in multiboot?
Posted: Wed Feb 11, 2015 6:54 am
Hello everyone.
I tried to create a 64bit kernel using resources from the flowings.
http://wiki.osdev.org/Bare_Bones_with_NASM
http://wiki.osdev.org/Setting_Up_Long_Mode
What I have done is basically copy the Bare Bones example and apply the code to go into long mode
But I have run into a issue that I can't either compile 64bit or load my kernel. When I add some 64bit code into my asm file. NASM give me this error
so, I set the output format from elf32 to elf64. But than ld give me this
Than, I set the output format of ld to elf_x86_64
but than GRUB2 faild to find the multiboot header.
How can I fix this?
EDIT:
btw, I tried to put 32bit and 64bit code in different files. But that does no help
Compile enviroment:
Host OS : Ubuntu 14.10 AMD64
GRUB:2.02 - beta2.15(copied from Ubuntu's boot folder)
Assembiler:nasm 2.11
thanks for any help
I tried to create a 64bit kernel using resources from the flowings.
http://wiki.osdev.org/Bare_Bones_with_NASM
http://wiki.osdev.org/Setting_Up_Long_Mode
What I have done is basically copy the Bare Bones example and apply the code to go into long mode
But I have run into a issue that I can't either compile 64bit or load my kernel. When I add some 64bit code into my asm file. NASM give me this error
Code: Select all
elf32 output format does not support 64-bit code
Code: Select all
i386:x86-64 architecture of input file `src/kernel.o' is incompatible with i386 output
but than GRUB2 faild to find the multiboot header.
How can I fix this?
EDIT:
btw, I tried to put 32bit and 64bit code in different files. But that does no help
Compile enviroment:
Host OS : Ubuntu 14.10 AMD64
GRUB:2.02 - beta2.15(copied from Ubuntu's boot folder)
Assembiler:nasm 2.11
thanks for any help