Page 1 of 1
[Multiboot/GRUB] Kernel size (solved)
Posted: Tue Mar 08, 2005 12:00 am
by neil
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 ?
Re: [Multiboot/GRUB] Kernel size (solved)
Posted: Tue Mar 08, 2005 12:00 am
by neil
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.
Re: [Multiboot/GRUB] Kernel size (solved)
Posted: Mon Jul 25, 2005 11:00 pm
by Crazed123
Not solved for me. I've tried to declare a symbol in my linker script to hold the end-of-kernel address like so:
Code: Select all
ENTRY(_start)
OUTPUT_FORMAT("elf32-i386")
SECTIONS
{
. = 0x00100000;
.text :
{
*(.text)
*(.rodata)
}
.data ALIGN (0x1000) :
{
*(.data)
}
.bss :
{
_sbss = .;
*(COMMON)
*(.bss)
_ebss = .;
}
KernelEnd = .;
}
But whenever I link the symbol (KernelEnd) evaluates to zero.
What, did you want me to start a new topic?
Re: [Multiboot/GRUB] Kernel size (solved)
Posted: Fri Aug 05, 2005 11:00 pm
by carbonBased
kernelEnd == 0
&kernelEnd == what you're looking for.
Linker symbols have no value, only addresses.
--Jeff
Re: [Multiboot/GRUB] Kernel size (solved)
Posted: Sun Aug 14, 2005 11:00 pm
by Crazed123
And why is that?
Also, the same thing happens with the symbols I define in my assembler stub.
Re: [Multiboot/GRUB] Kernel size (solved)
Posted: Sun Aug 14, 2005 11:00 pm
by carbonBased
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