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

coreboot support #74

Merged
merged 5 commits into from
Jan 19, 2021
Merged

Conversation

retrage
Copy link
Contributor

@retrage retrage commented Nov 6, 2020

This PR proposes "coreboot" feature for rust-hypervisor-firmware as a coreboot payload.
It adds coreboot::StartInfo that parses coreboot table[1] to provide e820 table and RSDP address. (This part may be able to reuse for PR #24)
It adds rust64_start for "coreboot" feature because the coreboot::StartInfo struct should be allocated and supplied before main.

Since coreboot payload starts from 32-bit protected mode, and it uses the ELF entry point, it must point ram32_start (230daa6).

To build:

      cargo build \
        --target target.json \
        -Zbuild-std=core \
        -Zbuild-std-features=compiler-builtins-mem
        --features "coreboot"

Build coreboot.rom with hypervisor-fw as a payload.

To run:

    qemu-system-x86_64
      -enable-kvm \
      -cpu host \
      -machine type=q35 \
      -drive if=pflash,format=raw,readonly,file=coreboot.rom \
      -drive id=disk,file=bionic-server-cloudimg-amd64-raw.img,if=none \
      -device virtio-blk-pci,drive=disk,disable-legacy=on \
      -nographic \
      -serial mon:stdio \
      -m 8G

I confirmed that it works on both Linux loader mode and EFI mode.

[1] https://www.coreboot.org/API

@retrage retrage changed the title [RFC] coreboot support coreboot support Nov 22, 2020
@retrage
Copy link
Contributor Author

retrage commented Nov 22, 2020

Does anyone have comments?

Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

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

This looks fine but I think it probably needs an integration test.

layout.ld Outdated Show resolved Hide resolved
src/coreboot.rs Outdated Show resolved Hide resolved
This commit adds coreboot specific info parser to satisfy Info trait
requirements. The coreboot info table includes various information, but
this supports E820 like memory map parsing and ACPI RSDP address search
only. It is based on coreboot's libpayload[1].

[1] payloads/libpayload/libc/coreboot.c (e1a7a26)

Signed-off-by: Akira Moroo <[email protected]>
@retrage
Copy link
Contributor Author

retrage commented Dec 4, 2020

For integration tests, I would like to add a shell script like run_integration_tests.sh.

@retrage
Copy link
Contributor Author

retrage commented Dec 19, 2020

This looks fine but I think it probably needs an integration test.

I pushed integration tests for coreboot as b7e1ff9. It passes all integration tests.

@retrage
Copy link
Contributor Author

retrage commented Dec 19, 2020

The coreboot integration tests clone coreboot repository, checkout submodules, and build a binutils/gcc cross compiler every time. It's heavy and time-consuming process to just building a BIOS rom. I think we can improve this by providing pre-built packages for CI.

Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

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

@josephlr What do you think?

@retrage
Copy link
Contributor Author

retrage commented Jan 19, 2021

@josephlr Any updates?

@josephlr
Copy link
Contributor

This looks reasonable to me, and we should be able to reuse some of this for #24.

I haven't had the chance to review this in extreme detail, but if it boots, we can merge this for now and clean it up later.

Long term, we will probably want to use some sort of CI caching (say w/ Github Actions) to speed stuff up.

@josephlr josephlr merged commit 8a8d0d5 into cloud-hypervisor:master Jan 19, 2021
@retrage retrage mentioned this pull request Jan 22, 2021
@retrage retrage deleted the coreboot-support branch March 13, 2021 05:03
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.

3 participants