Does anyone know how could I get the size of the kernel loaded by GRUB (or any multiboot compliant boot loader) ?
Maybe I need to look in the ELF sections, but are all the ELF sections loaded by GRUB or only BITS|PROGBITS ?
[Multiboot/GRUB] Kernel size (solved)
Re: [Multiboot/GRUB] Kernel size (solved)
After reading the memory it seems that all the sections are loaded by GRUB.
So I juste need to add the last ELF section header and its size to get the end of kernel address.
So I juste need to add the last ELF section header and its size to get the end of kernel address.
Last edited by neil on Tue Mar 08, 2005 12:00 am, edited 1 time in total.
Re: [Multiboot/GRUB] Kernel size (solved)
Not solved for me. I've tried to declare a symbol in my linker script to hold the end-of-kernel address like so:
But whenever I link the symbol (KernelEnd) evaluates to zero.
What, did you want me to start a new topic?
Code: Select all
ENTRY(_start)
OUTPUT_FORMAT("elf32-i386")
SECTIONS
{
. = 0x00100000;
.text :
{
*(.text)
*(.rodata)
}
.data ALIGN (0x1000) :
{
*(.data)
}
.bss :
{
_sbss = .;
*(COMMON)
*(.bss)
_ebss = .;
}
KernelEnd = .;
}
What, did you want me to start a new topic?
Last edited by Crazed123 on Mon Jul 25, 2005 11:00 pm, edited 1 time in total.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: [Multiboot/GRUB] Kernel size (solved)
kernelEnd == 0
&kernelEnd == what you're looking for.
Linker symbols have no value, only addresses.
--Jeff
&kernelEnd == what you're looking for.
Linker symbols have no value, only addresses.
--Jeff
Re: [Multiboot/GRUB] Kernel size (solved)
And why is that?
Also, the same thing happens with the symbols I define in my assembler stub.
Also, the same thing happens with the symbols I define in my assembler stub.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: [Multiboot/GRUB] Kernel size (solved)
Because they're just symbols, not actual variables.
Think of them as labels, or pointers. You aren't creating a new variable, but rather pointing to an existing one (or location).
--Jeff
Think of them as labels, or pointers. You aren't creating a new variable, but rather pointing to an existing one (or location).
--Jeff