Limine Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Backports from limine-c-template)
No edit summary
Line 173: Line 173:
PHDRS
PHDRS
{
{
requests PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
requests PT_LOAD FLAGS(0x06); /* Write + Read */
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
text PT_LOAD FLAGS(0x05); /* Execute + Read */
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */
rodata PT_LOAD FLAGS(0x04); /* Read only */
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
data PT_LOAD FLAGS(0x06); /* Write + Read */
dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ; /* Dynamic PHDR for relocations */
dynamic PT_DYNAMIC FLAGS(0x06); /* Dynamic PHDR for relocations */
}
}


SECTIONS
SECTIONS
{
{
/* The bootloader will relocate relocatable kernels with a base address of 0 */
/* We wanna be placed in the topmost 2GiB of the address space, for optimisations */
/* and because that is what the Limine spec mandates. */
/* to or above the address 0xffffffff80000000, which marks the beginning of */
/* the top-most 2GiB region of virtual address space. */
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
/* Marking the base address as 0 also makes the GNU linker (ld.bfd) emit an ELF */
/* that is the beginning of the region. */
. = 0xffffffff80000000;
/* file of type ET_DYN, which is what we want. */
. = 0;


/* Define a section to contain the Limine requests and assign it to its own PHDR */
/* Define a section to contain the Limine requests and assign it to its own PHDR */
Line 321: Line 320:
-m elf_x86_64 \
-m elf_x86_64 \
-nostdlib \
-nostdlib \
-static \
-pie \
-pie \
--no-dynamic-linker \
-z text \
-z text \
-z max-page-size=0x1000 \
-z max-page-size=0x1000 \
Line 383: Line 380:


# The entry name that will be displayed in the boot menu.
# The entry name that will be displayed in the boot menu.
:myOS (KASLR on)
:myOS
# We use the Limine boot protocol.
# We use the Limine boot protocol.
PROTOCOL=limine
PROTOCOL=limine

# Disable KASLR (it is enabled by default for relocatable kernels)
KASLR=no


# Path to the kernel to boot. boot:/// represents the partition on which limine.cfg is located.
# Path to the kernel to boot. boot:/// represents the partition on which limine.cfg is located.
KERNEL_PATH=boot:///boot/myos
KERNEL_PATH=boot:///boot/myos


# Same thing, but without KASLR.
# Same thing, but with KASLR.
:myOS (KASLR off)
:myOS (with KASLR)
PROTOCOL=limine
PROTOCOL=limine

# Disable KASLR (it is enabled by default for relocatable kernels)
KASLR=no


KERNEL_PATH=boot:///boot/myos
KERNEL_PATH=boot:///boot/myos