I'm trying to make my first Kernel and I found a tutorial on it but cannot understand why this 1MB of data is initially sent to the bootloader in Linker.ld file. I've searched the internet but cannot find the answer. If you can, please help me out. Here's the Code:
ENTRY(start)
SECTIONS {
. = 1M;
.boot :
{
KEEP(*(.multiboot_header))
}
.text :
{
*(.text)
}
}
From the GNU LD manual:
The special linker variable dot `.' always contains the current output location counter. [...] Assigning a value to the . symbol will cause the location counter to be moved.
So . = 1M;
is setting the current location counter to 0x100000 before any sections are placed.
There's no data being "sent" to the bootloader. That line tells the linker to act as if the program exists starting at address 0x100000.