Grub amd64 load moudle question.
Posted: Sat Jul 07, 2007 2:20 pm
My question is can I just compile my regular 32bit kernel like this (listed below are all compiler/linker options I wish to try), and then compile a seperate kernel file to be my module and load it in grub using
# module (fd0)/kernel64.bin while in grub setup utility?
If this can be done, when I go to jump to my 64 bit code after getting all the data structures in place how would I go about calling that from C code? Or would I have to make a assembly instruction that does jmp 0x200000:start64 ?
Any input is apreciated ^^
Kernel 32 compile options(below this i put the kernel 64 compile options):
CFLAGS=-Wall -O -fstrength-reduce -finline-functions -nostdinc -fno-builtin -m32 --no-warn -I./
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata*)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
KERNEL 64 Compile options ? :(since long mode uses PSE and 2MB pages i figure loading the kernel at 2mb would be a good idea)
CFLAGS=-Wall -O -fstrength-reduce -finline-functions -nostdinc -fno-builtin -m64 --no-warn -I./
OUTPUT_FORMAT("elf64-x86_64")
ENTRY(start64)
phys = 0x00200000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata*)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
# module (fd0)/kernel64.bin while in grub setup utility?
If this can be done, when I go to jump to my 64 bit code after getting all the data structures in place how would I go about calling that from C code? Or would I have to make a assembly instruction that does jmp 0x200000:start64 ?
Any input is apreciated ^^
Kernel 32 compile options(below this i put the kernel 64 compile options):
CFLAGS=-Wall -O -fstrength-reduce -finline-functions -nostdinc -fno-builtin -m32 --no-warn -I./
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata*)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
KERNEL 64 Compile options ? :(since long mode uses PSE and 2MB pages i figure loading the kernel at 2mb would be a good idea)
CFLAGS=-Wall -O -fstrength-reduce -finline-functions -nostdinc -fno-builtin -m64 --no-warn -I./
OUTPUT_FORMAT("elf64-x86_64")
ENTRY(start64)
phys = 0x00200000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata*)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}