Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EFI Prekernel (6/N): Kernel: Preparations for booting with the EFIPrekernel #25668

Merged
merged 12 commits into from
Jan 28, 2025

Conversation

spholz
Copy link
Member

@spholz spholz commented Jan 26, 2025

This PR includes all kernel changes necessary for making the kernel bootable with the EFIPrekernel.

`load_kernel_symbols_from_data` modifies the contents of this segment,
so it needs to be writable.
Setting the boot method to Multiboot1 is no longer necessary because we
don't use a hard-coded multiboot memory map anymore.
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Jan 26, 2025
@spholz spholz changed the title EFI Prekernel (6/N): Kernel: Preparations for booting the kernel EFI Prekernel (6/N): Kernel: Preparations for booting with the EFIPrekernel Jan 26, 2025
Copy link
Contributor

@nico nico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright, but I don't know this area well.

Does booting via EFI have any noticeable effect in baremetal arm boots? (Faster? Slower? More capable? Less?)

Kernel/Arch/riscv64/Processor.cpp Show resolved Hide resolved
Kernel/Firmware/DeviceTree/DeviceTree.cpp Outdated Show resolved Hide resolved
@spholz
Copy link
Member Author

spholz commented Jan 26, 2025

Does booting via EFI have any noticeable effect in baremetal arm boots? (Faster? Slower? More capable? Less?)

The bootup speed depends on the firmware. Booting with EDK2 will definitely be slower, but booting using U-Boot as the "UEFI firmware" should be just as fast.

UEFI support will give us a framebuffer for free, if the firmware supports the UEFI Graphics Output Protocol (GOP).

We currently use the linux boot protocol for aarch64 and riscv64, which I think isn't very clean tbh (but I think we should keep the current pre_init code even with the EFIPrekernel completely functional).

UEFI is (sadly) the only widespread OS-agnostic boot protocol that works on all our supported architectures.

@spholz
Copy link
Member Author

spholz commented Jan 26, 2025

Oh no, not this panic

APICTimer: Timer fired during calibration!

But I don't see how that could be caused by this PR?

@spholz
Copy link
Member Author

spholz commented Jan 26, 2025

Oh duh

-        MUST(StaticParsing::find_rsdp_in_platform_specific_memory_locations());
+        rsdp = MUST(StaticParsing::find_rsdp_in_platform_specific_memory_locations());

The EFIPrekernel will identity map one page to set up virtual memory,
instead of identity mapping its entire memory like the current
multiboot prekernel.
This also required making the aarch64 pre_init code pass the boot_info
to init.
This will be necessary when booting with the EFIPrekernel.
x86-64 also loads the IDT in Processor::initialize.
The EFIPrekernel will set `acpi_rsdp_paddr` to the RSDP address found
in the configuration table.
@spholz spholz merged commit 1197f1f into SerenityOS:master Jan 28, 2025
13 checks passed
@spholz spholz deleted the efi-prekernel-6 branch January 28, 2025 12:01
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants