Limine Bare Bones: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content added Content deleted
(Misc updates for Limine 5.x) |
(Make PIE kernel) |
||
Line 152: | Line 152: | ||
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */ |
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */ |
||
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */ |
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */ |
||
dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ; /* Dynamic PHDR for relocations */ |
|||
} |
} |
||
Line 179: | Line 180: | ||
*(.data .data.*) |
*(.data .data.*) |
||
} :data |
} :data |
||
/* Dynamic section for relocations, both in its own PHDR and inside data PHDR */ |
|||
.dynamic : { |
|||
*(.dynamic) |
|||
} :data :dynamic |
|||
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */ |
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */ |
||
Line 259: | Line 265: | ||
-fno-stack-check \ |
-fno-stack-check \ |
||
-fno-lto \ |
-fno-lto \ |
||
- |
-fPIE \ |
||
⚫ | |||
-m64 \ |
-m64 \ |
||
-march=x86-64 \ |
-march=x86-64 \ |
||
Line 268: | Line 273: | ||
-mno-sse \ |
-mno-sse \ |
||
-mno-sse2 \ |
-mno-sse2 \ |
||
-mno-red-zone |
-mno-red-zone |
||
-mcmodel=kernel |
|||
# Internal C preprocessor flags that should not be changed by the user. |
# Internal C preprocessor flags that should not be changed by the user. |
||
Line 280: | Line 284: | ||
# Internal linker flags that should not be changed by the user. |
# Internal linker flags that should not be changed by the user. |
||
override LDFLAGS += \ |
override LDFLAGS += \ |
||
-m elf_x86_64 \ |
|||
-nostdlib \ |
-nostdlib \ |
||
-static \ |
-static \ |
||
- |
-pie \ |
||
--no-dynamic-linker \ |
|||
⚫ | |||
-z max-page-size=0x1000 \ |
-z max-page-size=0x1000 \ |
||
-T linker.ld |
-T linker.ld |
||
# Check if the linker supports -no-pie and enable it if it does. |
|||
ifeq ($(shell $(LD) --help 2>&1 | grep 'no-pie' >/dev/null 2>&1; echo $$?),0) |
|||
override LDFLAGS += -no-pie |
|||
endif |
|||
# Internal nasm flags that should not be changed by the user. |
# Internal nasm flags that should not be changed by the user. |
||
Line 342: | Line 344: | ||
# The entry name that will be displayed in the boot menu. |
# The entry name that will be displayed in the boot menu. |
||
:myOS |
:myOS (KASLR off) |
||
# 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:///myos.elf |
|||
# Same thing, but with KASLR. |
|||
:myOS (KASLR on) |
|||
PROTOCOL=limine |
|||
KERNEL_PATH=boot:///myos.elf |
KERNEL_PATH=boot:///myos.elf |
||
</source> |
</source> |