mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
feat(kernel): update limine
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
0cc4d5096b
commit
c412a75f91
@ -25,33 +25,41 @@
|
|||||||
|
|
||||||
void InitLimine();
|
void InitLimine();
|
||||||
|
|
||||||
static volatile struct limine_entry_point_request EntryPointRequest = {
|
#define LIMREQ __attribute__((used, section(".limine_requests"))) static volatile
|
||||||
|
#define LIMREQ_S __attribute__((used, section(".limine_requests_start"))) static volatile
|
||||||
|
#define LIMREQ_E __attribute__((used, section(".limine_requests_end"))) static volatile
|
||||||
|
|
||||||
|
LIMREQ LIMINE_BASE_REVISION(3);
|
||||||
|
LIMREQ_S LIMINE_REQUESTS_START_MARKER;
|
||||||
|
LIMREQ_E LIMINE_REQUESTS_END_MARKER;
|
||||||
|
|
||||||
|
LIMREQ struct limine_entry_point_request EntryPointRequest = {
|
||||||
.id = LIMINE_ENTRY_POINT_REQUEST,
|
.id = LIMINE_ENTRY_POINT_REQUEST,
|
||||||
.revision = 0,
|
.revision = 0,
|
||||||
.response = NULL,
|
.response = NULL,
|
||||||
.entry = InitLimine};
|
.entry = InitLimine};
|
||||||
static volatile struct limine_bootloader_info_request BootloaderInfoRequest = {
|
LIMREQ struct limine_bootloader_info_request BootloaderInfoRequest = {
|
||||||
.id = LIMINE_BOOTLOADER_INFO_REQUEST,
|
.id = LIMINE_BOOTLOADER_INFO_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_framebuffer_request FramebufferRequest = {
|
LIMREQ struct limine_framebuffer_request FramebufferRequest = {
|
||||||
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_memmap_request MemmapRequest = {
|
LIMREQ struct limine_memmap_request MemmapRequest = {
|
||||||
.id = LIMINE_MEMMAP_REQUEST,
|
.id = LIMINE_MEMMAP_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_kernel_address_request KernelAddressRequest = {
|
LIMREQ struct limine_kernel_address_request KernelAddressRequest = {
|
||||||
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
|
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_rsdp_request RsdpRequest = {
|
LIMREQ struct limine_rsdp_request RsdpRequest = {
|
||||||
.id = LIMINE_RSDP_REQUEST,
|
.id = LIMINE_RSDP_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_kernel_file_request KernelFileRequest = {
|
LIMREQ struct limine_kernel_file_request KernelFileRequest = {
|
||||||
.id = LIMINE_KERNEL_FILE_REQUEST,
|
.id = LIMINE_KERNEL_FILE_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_module_request ModuleRequest = {
|
LIMREQ struct limine_module_request ModuleRequest = {
|
||||||
.id = LIMINE_MODULE_REQUEST,
|
.id = LIMINE_MODULE_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
static volatile struct limine_smbios_request SmbiosRequest = {
|
LIMREQ struct limine_smbios_request SmbiosRequest = {
|
||||||
.id = LIMINE_SMBIOS_REQUEST,
|
.id = LIMINE_SMBIOS_REQUEST,
|
||||||
.revision = 0};
|
.revision = 0};
|
||||||
|
|
||||||
|
@ -46,9 +46,17 @@ SECTIONS
|
|||||||
*(.bootstrap .bootstrap.*)
|
*(.bootstrap .bootstrap.*)
|
||||||
} :bootstrap
|
} :bootstrap
|
||||||
_bootstrap_end = ALIGN(CONSTANT(MAXPAGESIZE));
|
_bootstrap_end = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||||
|
|
||||||
. += KERNEL_VMA;
|
. += KERNEL_VMA;
|
||||||
|
|
||||||
|
/* . += KERNEL_VMA;
|
||||||
|
_bootstrap_start = .;
|
||||||
|
.limine_requests : {
|
||||||
|
KEEP(*(.limine_requests_start))
|
||||||
|
KEEP(*(.limine_requests))
|
||||||
|
KEEP(*(.limine_requests_end))
|
||||||
|
} :bootstrap
|
||||||
|
_bootstrap_end = ALIGN(CONSTANT(MAXPAGESIZE)); */
|
||||||
|
|
||||||
_kernel_start = ALIGN(CONSTANT(MAXPAGESIZE));
|
_kernel_start = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||||
_kernel_text_start = ALIGN(CONSTANT(MAXPAGESIZE));
|
_kernel_text_start = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||||
.text ALIGN(CONSTANT(MAXPAGESIZE)) : AT(ADDR(.text) - KERNEL_VMA)
|
.text ALIGN(CONSTANT(MAXPAGESIZE)) : AT(ADDR(.text) - KERNEL_VMA)
|
||||||
|
@ -267,22 +267,14 @@ extern CallPtr __fini_array_start[0], __fini_array_end[0];
|
|||||||
|
|
||||||
EXTERNC __no_stack_protector NIF cold void Entry(BootInfo *Info)
|
EXTERNC __no_stack_protector NIF cold void Entry(BootInfo *Info)
|
||||||
{
|
{
|
||||||
trace("Hello, World!");
|
|
||||||
|
|
||||||
if (strcmp(CPU::Hypervisor(), x86_CPUID_VENDOR_TCG) == 0)
|
|
||||||
{
|
|
||||||
info("\n\n----------------------------------------\nDEBUGGER DETECTED\n----------------------------------------\n\n");
|
|
||||||
DebuggerIsAttached = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&bInfo, Info, sizeof(BootInfo));
|
memcpy(&bInfo, Info, sizeof(BootInfo));
|
||||||
debug("BootInfo structure is at %p", &bInfo);
|
|
||||||
|
|
||||||
// https://wiki.osdev.org/Calling_Global_Constructors
|
// https://wiki.osdev.org/Calling_Global_Constructors
|
||||||
trace("There are %d constructors to call",
|
|
||||||
__init_array_end - __init_array_start);
|
|
||||||
for (CallPtr *fct = __init_array_start; fct != __init_array_end; fct++)
|
for (CallPtr *fct = __init_array_start; fct != __init_array_end; fct++)
|
||||||
(*fct)();
|
(*fct)();
|
||||||
|
trace("Total constructors called: %d", __init_array_end - __init_array_start);
|
||||||
|
if (strcmp(CPU::Hypervisor(), x86_CPUID_VENDOR_TCG) == 0)
|
||||||
|
DebuggerIsAttached = true;
|
||||||
|
|
||||||
#if defined(__amd64__) || defined(__i386__)
|
#if defined(__amd64__) || defined(__i386__)
|
||||||
if (!bInfo.SMBIOSPtr)
|
if (!bInfo.SMBIOSPtr)
|
||||||
|
26
Makefile
26
Makefile
@ -14,7 +14,6 @@ QEMUFLAGS := -display gtk
|
|||||||
|
|
||||||
ifeq ($(OSARCH), amd64)
|
ifeq ($(OSARCH), amd64)
|
||||||
QEMUFLAGS += -device vmware-svga -M q35 \
|
QEMUFLAGS += -device vmware-svga -M q35 \
|
||||||
-monitor pty \
|
|
||||||
-usb \
|
-usb \
|
||||||
-device qemu-xhci,id=xhci \
|
-device qemu-xhci,id=xhci \
|
||||||
-net user \
|
-net user \
|
||||||
@ -41,7 +40,6 @@ QEMUFLAGS += -device vmware-svga -M q35 \
|
|||||||
-acpitable file=tools/acpi/SSDT1.dat
|
-acpitable file=tools/acpi/SSDT1.dat
|
||||||
else ifeq ($(OSARCH), i386)
|
else ifeq ($(OSARCH), i386)
|
||||||
QEMUFLAGS += -M q35 \
|
QEMUFLAGS += -M q35 \
|
||||||
-monitor pty \
|
|
||||||
-usb \
|
-usb \
|
||||||
-device qemu-xhci,id=xhci \
|
-device qemu-xhci,id=xhci \
|
||||||
-device usb-mouse,bus=xhci.0,pcap=mousex.pcap \
|
-device usb-mouse,bus=xhci.0,pcap=mousex.pcap \
|
||||||
@ -68,7 +66,6 @@ QEMUFLAGS += -M q35 \
|
|||||||
-acpitable file=tools/acpi/SSDT1.dat
|
-acpitable file=tools/acpi/SSDT1.dat
|
||||||
else ifeq ($(OSARCH), arm)
|
else ifeq ($(OSARCH), arm)
|
||||||
QEMUFLAGS += -M raspi2b \
|
QEMUFLAGS += -M raspi2b \
|
||||||
-monitor pty \
|
|
||||||
-cpu cortex-a15 \
|
-cpu cortex-a15 \
|
||||||
-serial file:serial.log \
|
-serial file:serial.log \
|
||||||
-serial file:COM2.dmp \
|
-serial file:COM2.dmp \
|
||||||
@ -77,7 +74,6 @@ QEMUFLAGS += -M raspi2b \
|
|||||||
-kernel $(OSNAME).img
|
-kernel $(OSNAME).img
|
||||||
else ifeq ($(OSARCH), aarch64)
|
else ifeq ($(OSARCH), aarch64)
|
||||||
QEMUFLAGS += -M raspi4b \
|
QEMUFLAGS += -M raspi4b \
|
||||||
-monitor pty \
|
|
||||||
-cpu cortex-a72 \
|
-cpu cortex-a72 \
|
||||||
-serial file:serial.log \
|
-serial file:serial.log \
|
||||||
-serial file:COM2.dmp \
|
-serial file:COM2.dmp \
|
||||||
@ -260,17 +256,21 @@ endif
|
|||||||
cp Kernel/fennix.elf rootfs.tar \
|
cp Kernel/fennix.elf rootfs.tar \
|
||||||
iso_tmp_data/
|
iso_tmp_data/
|
||||||
ifeq ($(BOOTLOADER), limine)
|
ifeq ($(BOOTLOADER), limine)
|
||||||
cp tools/limine.cfg tools/limine/limine-bios.sys \
|
cp tools/limine.conf \
|
||||||
tools/limine/limine-bios-cd.bin \
|
tools/limine/limine-bios.sys \
|
||||||
tools/limine/limine-uefi-cd.bin \
|
tools/limine/limine-bios-cd.bin \
|
||||||
iso_tmp_data/
|
tools/limine/limine-uefi-cd.bin \
|
||||||
|
iso_tmp_data/
|
||||||
mkdir -p iso_tmp_data/EFI/BOOT
|
mkdir -p iso_tmp_data/EFI/BOOT
|
||||||
cp tools/limine/BOOTX64.EFI \
|
cp tools/limine/BOOTAA64.EFI \
|
||||||
tools/limine/BOOTIA32.EFI \
|
tools/limine/BOOTIA32.EFI \
|
||||||
|
tools/limine/BOOTLOONGARCH64.EFI \
|
||||||
|
tools/limine/BOOTRISCV64.EFI \
|
||||||
|
tools/limine/BOOTX64.EFI \
|
||||||
iso_tmp_data/EFI/BOOT/
|
iso_tmp_data/EFI/BOOT/
|
||||||
xorriso -as mkisofs -quiet -b limine-bios-cd.bin \
|
xorriso -as mkisofs -R -r -J -b limine-bios-cd.bin \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
|
||||||
--efi-boot limine-uefi-cd.bin -V FENNIX \
|
-apm-block-size 2048 --efi-boot limine-uefi-cd.bin \
|
||||||
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
||||||
iso_tmp_data -o $(OSNAME).iso
|
iso_tmp_data -o $(OSNAME).iso
|
||||||
endif
|
endif
|
||||||
@ -332,7 +332,7 @@ QEMU_DBG_MEMORY = -m 2G
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
clean_logs:
|
clean_logs:
|
||||||
rm -f serial.log COM2.dmp COM3.dmp \
|
rm -f serial.log COM2.dmp COM3.dmp COM4.dmp \
|
||||||
network.dmp \
|
network.dmp \
|
||||||
LPT1.dmp LPT2.dmp LPT3.dmp \
|
LPT1.dmp LPT2.dmp LPT3.dmp \
|
||||||
mouse.pcap kbd.pcap mousex.pcap kbdx.pcap
|
mouse.pcap kbd.pcap mousex.pcap kbdx.pcap
|
||||||
|
@ -30,7 +30,7 @@ do_tools:
|
|||||||
|
|
||||||
do_limine:
|
do_limine:
|
||||||
ifeq ("$(wildcard ./limine)", "")
|
ifeq ("$(wildcard ./limine)", "")
|
||||||
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1 limine
|
git clone https://github.com/limine-bootloader/limine.git --branch=v9.x-binary --depth=1 limine
|
||||||
else
|
else
|
||||||
$(info > TOOLS: Skipping cloning limine because directory already exists.)
|
$(info > TOOLS: Skipping cloning limine because directory already exists.)
|
||||||
endif
|
endif
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
TIMEOUT=5
|
|
||||||
INTERFACE_BRANDING=Fennix
|
|
||||||
|
|
||||||
:Fennix (limine)
|
|
||||||
# DO NOT EDIT!
|
|
||||||
COMMENT=Boot Fennix using limine protocol
|
|
||||||
PROTOCOL=limine
|
|
||||||
KERNEL_CMDLINE=--init=/sys/bin/init
|
|
||||||
KERNEL_PATH=boot:///fennix.elf
|
|
||||||
|
|
||||||
MODULE_PATH=boot:///rootfs.tar
|
|
||||||
MODULE_CMDLINE=rootfs
|
|
Loading…
x
Reference in New Issue
Block a user