-
Notifications
You must be signed in to change notification settings - Fork 58
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
Boot from memory device path #305
Merged
rbradford
merged 10 commits into
cloud-hypervisor:main
from
rbradford:2023-12-18-boot-from-memory-device-path
Dec 29, 2023
Merged
Boot from memory device path #305
rbradford
merged 10 commits into
cloud-hypervisor:main
from
rbradford:2023-12-18-boot-from-memory-device-path
Dec 29, 2023
Conversation
This file contains 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
rbradford
force-pushed
the
2023-12-18-boot-from-memory-device-path
branch
from
December 19, 2023 18:10
93ec0f8
to
ba896c6
Compare
retrage
approved these changes
Dec 29, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. I just have a few minor suggestions:
- Use the
offset_of!()
macro to calculate the offset to the field - Avoid hardcoding the length of the device path
- The max length of the path should be 256 in UCS2 (16 bits)
Convert the EFI device path protocol structure into a Rust structure in order to be able to handle different device path types (e.g. memory backed) in the future. Signed-off-by: Rob Bradford <[email protected]>
Rather than construct the device path when creating the image handle do so earlier so that ultimately a NULL path could be provided in the case of loading from memory. Signed-off-by: Rob Bradford <[email protected]>
Add a DevicePath::generate() method to generate the device path from the parsed device path. Signed-off-by: Rob Bradford <[email protected]>
Signed-off-by: Rob Bradford <[email protected]>
Signed-off-by: Rob Bradford <[email protected]>
Previously the path in the FileDevicePathProtocol was limited to 128 ascii characters. Signed-off-by: Rob Bradford <[email protected]>
This will prevent it clashing when generating other types of device paths. Signed-off-by: Rob Bradford <[email protected]>
Signed-off-by: Rob Bradford <[email protected]>
Grub will load the kernel into memory and ask the firmware to parse that as a PE binary. In order to reuse the existing infrastructure the memory range provided is turned into a struct that implements the fat::Read trait. Signed-off-by: Rob Bradford <[email protected]>
Remove some duplicated code for loading an image by extracting it out to its own function. Signed-off-by: Rob Bradford <[email protected]>
rbradford
force-pushed
the
2023-12-18-boot-from-memory-device-path
branch
from
December 29, 2023 11:25
ba896c6
to
70e286b
Compare
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.
GRUB on (at least RISC-V) loads the guest kernel directly into memory and then
expects the firmware to parse it from there - it does this by using a device
path of type PCI and subtype memory mapped.
With this change the Linux kernel boots on RISC-V if the kernel command line is
modified to specify a fixed rootfs as there are issues with the initramfs.