Hi all, I am currently using grub to load my kernel at 1meg, I was wondering if it was possible to have grub load the kernel with a different virtual address (say 0xc0000000) but if i try having my linker use that as it's base address it get an error in grub, somthing along the lines of the binary cannot fit in memory.
I noticed that the Linux kernel is linked at 0xc0000000 and obviously boots just fine. Anyone have any experience with this?
proxy
having grub load with different virtual address?
-
frank
Re:having grub load with different virtual address?
Grub can not load at that high addresses.
(say 0xc0000000)
See: http://www.openbg.net/sto/os/xml/grub.html
-
proxy
Re:having grub load with different virtual address?
but in code listing 11 they have an example where virtual address is aexactly where i want it!...so what do i need to do? other OSes seem to do it...
proxy
proxy
-
bkilgore
Re:having grub load with different virtual address?
Did you follow the code listing 11 sample closely? You have to make sure you specify both the virtual address and the physical address.
Make sure you have the line that specifies that you want the virtual address to be 'virt' (or 0xC0000000) but the physical address to load to to be 'phys' (or 0x100000). Grub doesn't have anything to do with the virtual address, that should all be handled by your kernel while initially mapping your kernel into the virtual address space. Grub only takes the physical address from the .elf file and loads the code there.
Code: Select all
OUTPUT_FORMAT("elf32-i386")
ENTRY(entry)
virt = 0xC0000000; /* 3 gig */
phys = 0x100000; /* 1 meg */
SECTIONS
{ .text virt : AT(phys)
{ code = .;
*(.text)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{ data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{ bss = .;
*(.bss)
*(COMMON)
. = ALIGN(4096);
}
end = .;
}
Code: Select all
.text virt : AT(phys)-
proxy
Re:having grub load with different virtual address?
yea, i noticed i originally had a typo in my link script, it now loads 
Next step I have to have my initial setup code provide enough of a GDT to make the system think 0xc0000000 is 1 MEG
while i setup the rest of the system i suppose 
proxy
Next step I have to have my initial setup code provide enough of a GDT to make the system think 0xc0000000 is 1 MEG
proxy