opentmk: add config-patch protocol and bootable VHD build#3953
opentmk: add config-patch protocol and bootable VHD build#3953mayank-microsoft wants to merge 4 commits into
Conversation
Add the OpenTMK test-selection config mechanism and the tooling to build a bootable OpenTMK VHD: - New `opentmk_protocol` crate: the embedded config region format (OPENTMK_CONFIG_MAGIC / OpenTmkConfig / TestConfig) and `patch_opentmk_config`, which patches a built `.efi` in place to select the backend/test to run. - New `opentmk/opentmk_disk` crate: builds a fixed VHD (GPT + EFI system partition) around an OpenTMK `.efi`, optionally patching the config. - OpenTMK guest: read the embedded `.tmkcfg` config region and dispatch to the selected backend/test via the `tmk_tests!` / `tmk_backends!` macros (`opentmk/src/tests`). Interrupt tests remain `#[cfg(nightly)]` gated (dropping that requirement is a separate change). - flowey `cargo xflowey build-opentmk` pipeline: build the `.efi` and package it into a VHD, using `opentmk_disk`. - Register the two new crates in the workspace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 34167341-e52b-4594-9f87-97bec95ae81c
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
There was a problem hiding this comment.
Pull request overview
This PR introduces a host-patchable “config region” protocol for selecting OpenTMK tests without rebuilding, plus shared tooling to package an OpenTMK UEFI binary into a bootable fixed VHD, and a new local-only cargo xflowey build-opentmk pipeline to produce those artifacts.
Changes:
- Add
opentmk_protocoldefining the embedded config region layout, JSON schema, and an in-place patcher for.efi/disk images. - Add
opentmk_diskto build a GPT + FAT32 ESP fixed VHD containing the OpenTMK.efi, optionally patched with test-selection config. - Update OpenTMK guest-side test dispatch to read the embedded
.tmkcfgconfig region, and add a local-only flowey pipeline (build-opentmk) to build and package artifacts.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
opentmk/src/tests/mod.rs |
Adds backend/test dispatch macros, embeds the .tmkcfg config static, and reads it via volatile load to drive test selection. |
opentmk/src/tests/hyperv/mod.rs |
Switches Hyper-V tests to macro-driven registration/dispatch with per-test cfg gating. |
opentmk/opentmk_disk/src/lib.rs |
New crate that builds a bootable fixed VHD (GPT + FAT32 ESP) around an OpenTMK .efi, with optional config patching. |
opentmk/opentmk_disk/Cargo.toml |
Declares opentmk_disk dependencies (reusing existing workspace deps). |
opentmk/Cargo.toml |
Adds dependency on opentmk_protocol for guest-side config parsing/static. |
opentmk_protocol/src/lib.rs |
New no-std protocol crate defining the config region format, JSON schema, and patching logic (+ unit tests). |
opentmk_protocol/Cargo.toml |
Declares opentmk_protocol dependencies (serde, serde_json, thiserror). |
flowey/flowey_lib_hvlite/src/lib.rs |
Exposes the new build_opentmk flow node module. |
flowey/flowey_lib_hvlite/src/build_opentmk.rs |
New flowey node to build opentmk as a UEFI binary and report .efi/.pdb outputs. |
flowey/flowey_lib_hvlite/src/_jobs/mod.rs |
Registers the new local-only build job for OpenTMK. |
flowey/flowey_lib_hvlite/src/_jobs/local_build_opentmk.rs |
New local job that packages the built .efi into a VHD via opentmk_disk (optionally patching config). |
flowey/flowey_lib_hvlite/Cargo.toml |
Adds dependency on opentmk_disk for the packaging step. |
flowey/flowey_hvlite/src/pipelines/mod.rs |
Adds the BuildOpentmk CLI subcommand entry point. |
flowey/flowey_hvlite/src/pipelines/build_opentmk.rs |
New local-only cargo xflowey build-opentmk pipeline wiring + CLI flags. |
Cargo.toml |
Registers opentmk_protocol and opentmk_disk as workspace dependencies. |
Cargo.lock |
Locks the new workspace crates into the dependency graph. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
flowey/flowey_hvlite/src/pipelines/build_opentmk.rs:16
- This PR adds a new
cargo xflowey build-opentmkpipeline, but the Guide’s list of notablecargo xfloweypipelines doesn’t mention it yet (seeGuide/src/dev_guide/dev_tools/xflowey.md, which currently lists build-igvm/restore-packages/vmm-tests-run/cca-tests). Adding at least a brief entry forbuild-opentmkwould help discoverability and keep the dev-tool docs in sync.
/// Build OpenTMK and package it into a bootable VHD.
#[derive(clap::Args)]
pub struct BuildOpentmkCli {
/// Target architecture for the OpenTMK build. Defaults to x86-64.
Summary
Add OpenTMK's test-selection config mechanism and the tooling to build a
bootable OpenTMK VHD.
OpenTMK tests are selected by patching a small config region embedded in
the built
.efi, rather than by rebuilding per test. This PR adds thatprotocol, the guest-side dispatch that reads it, and a
cargo xflowey build-opentmkpipeline that builds the.efiandpackages it into a bootable VHD.
Changes
opentmk_protocol— the embedded config region format(
OPENTMK_CONFIG_MAGIC/OpenTmkConfig/TestConfig) andpatch_opentmk_config, which patches a built.efiin place to selectthe backend/test to run.
opentmk/opentmk_disk— builds a fixed VHD (GPT + EFIsystem partition) around an OpenTMK
.efi, optionally patching theconfig.
.tmkcfgconfig region anddispatches to the selected backend/test via the
opentmk_tests!/opentmk_backends!macros.cargo xflowey build-opentmkpipeline — builds the.efiand packages it into a VHD using
opentmk_disk.No new external dependencies:
opentmk_disk's deps (gptman,fscommon,disk_vhd1,guid,tempfile) are already workspacedependencies.
Testing
cargo build -p opentmk_protocol -p opentmk_diskcargo build -p opentmk --target x86_64-unknown-uefi(stable)cargo build -p flowey_hvlite -p flowey_lib_hvlitecargo xflowey build-opentmk --help