Add ELF loading support for aarch64 and riscv64#234
Draft
Gelbpunkt wants to merge 4 commits into
Draft
Conversation
f121622 to
308eedc
Compare
Signed-off-by: Aelin Reidel <aelin@travitia.xyz>
Signed-off-by: Aelin Reidel <aelin@travitia.xyz>
These lack PVH support, so we conditionally don't compile the code related to that. Since aarch64 can technically also be big-endian, I also extended the code to not check for little endian, but rather native endian. I have however not run the testsuite on aarch64_be, only on aarch64. Signed-off-by: Aelin Reidel <aelin@travitia.xyz>
308eedc to
1beb80f
Compare
This method can also be used when loading ELF files, hence move it to the loader module level. Signed-off-by: Aelin Reidel <aelin@travitia.xyz>
1beb80f to
70cb872
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
This adds support for loading ELF files on aarch64 and riscv64. While this should work just fine for Linux
vmlinuximages, the reason why I'm adding it is because we want to be able to boot Hermit unikernel images (which are ELF files) without having to wrap them in the Linux kernelImageformat on these architectures. Booting kernels in ELF format isn't completely unheard of, e.g. U-Boot supports it via thebootelfcommand and QEMU can boot both ELF and Linux Image files via-kernelon ARM and RISC-V.aarch64 and riscv64 lack PVH support, so the code for that needs to be conditionally compiled out, but that's very straightforward.
Since aarch64 can technically also be big-endian, I also extended the code to not check for little endian, but rather native endian. I have however not run the testsuite on aarch64_be, only on aarch64. I only compile-tested aarch64_be.
The testing was done with a slightly modified version of cloud-hypervisor on aarch64. I don't have access to riscv64 hardware with the hypervisor extension.
I'm opening the PR a bit unfinished to get some early feedback on whether this is functionality that is desired.
Still TODO:
vmlinuxRequirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.