I've read countless posts on the forums suggesting that this is the correct way to put your multiboot header at the beginning (assuming your multiboot header is in a section called .multiboot):
Code: Select all
KERNEL_LOW = 0x100000;
SECTIONS
{
. = KERNEL_LOW;
.multiboot ALIGN(4K) : AT (ADDR (.multiboot) - KERNEL_LOW)
{
KEEP(*(.multiboot))
}
.text ALIGN(4K) : AT (ADDR (.text) - KERNEL_LOW)
{
*(.text)
}
}
What I found does work is defining .multiboot in the same section as .text like this:
Code: Select all
KERNEL_LOW = 0x100000;
SECTIONS
{
. = KERNEL_LOW;
.text ALIGN(4K) : AT (ADDR (.text) - KERNEL_LOW)
{
KEEP(*(.multiboot))
*(.text)
}
}
Is the .text section always the first usable section at the lowest offset in an ELF file? If its not, how can I define the layout of the sections so that I can get a custom .multiboot section (like in my first example) at the beginning of my ELF. I've heard all forms of nonsense on how to get the multiboot section at the beginning of an ELF file on this forum and I want to set it straight here so no one has to go through this again.