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

Kernel: Introduce the EFIPrekernel #23664

Closed
wants to merge 44 commits into from
Closed

Conversation

spholz
Copy link
Collaborator

@spholz spholz commented Mar 21, 2024

This EFI Prekernel will be used to boot the kernel on (U)EFI systems.
Currently, the Prekernel only actually runs the Kernel on RISC-V (as I still need to fix some bugs for x86 and aarch64 currently isn't bootable from arbitrary physical load addresses). The EFIPrekernel does boot on AArch64 and x86-64, it just panics before booting the kernel.

The EFIPrekernel doesn't pass the EFI cmdline to the kernel yet. The cmdline is hardcoded in the riscv64 kernel for now when booted via EFI.

Making it able to boot the riscv64 kernel currently requires this patch: https://gist.github.com/spholz/caee2a25ebab06e9b836b91748b717f8. I didn't add this patch to the PR, since it would break the current pre_init code and serenity.sh isn't able to use the efi prekernel yet.

This is currently a draft, as I still need to fix the cmake scripts.
Trying to do a clean build via serenity.sh image currently results in error: unable to find library -lLibELF.
The PrekernelPEImageGenerator also doesn't seem to get rerun when its code gets changed, but it seems to be rebuilt.

@spholz spholz force-pushed the efi-prekernel branch 7 times, most recently from 8661d7a to e520d42 Compare March 23, 2024 15:39
@spholz spholz force-pushed the efi-prekernel branch 4 times, most recently from 2aec7e7 to 5465559 Compare April 1, 2024 20:57
Copy link

stale bot commented May 1, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label May 1, 2024
@Hendiadyoin1 Hendiadyoin1 added 👀 pr-needs-review PR needs review from a maintainer or community member ⚠️ pr-has-conflicts PR has merge conflicts and needs to be rebased and removed stale labels May 1, 2024
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jun 1, 2024
Copy link

stale bot commented Jun 26, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jun 26, 2024
@spholz spholz added 👀 pr-needs-review PR needs review from a maintainer or community member and removed stale ⚠️ pr-has-conflicts PR has merge conflicts and needs to be rebased labels Jun 30, 2024
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jul 5, 2024
@spholz spholz force-pushed the efi-prekernel branch 3 times, most recently from 2f23361 to 499056d Compare July 19, 2024 18:23
spholz added 20 commits July 21, 2024 22:01
This allows us to use them in the EFIPrekernel.
This function has to translate ELF virtual addresses to offsets in the
ELF file by walking the program header table for each relocation, since
this function will be called while we are still identity mapped by the
firmware.
This function simply stores the size and location of the FDT from the
EFI configuration table in the boot info struct.
Otherwise validate_program_headers will complain about the kernel text
segment being executable and writable.
The EFIPrekernel doesn't convert the cmdline to UTF-8 yet.
Manually calculate the target address instead of storing the target
address in .text.
This adds all the remaining code necessary to actually boot the kernel.
This only works on riscv64 for now.
The GOP framebuffer (if present) is passed to the kernel so it can use
it as the boot framebuffer.
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Jul 21, 2024
Copy link

stale bot commented Aug 16, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

Copy link

stale bot commented Sep 8, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Sep 8, 2024
@spholz spholz closed this Sep 8, 2024
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants