Skip to content

mkimage: add bios-sev field to metadata.json for SEV firmware#70

Merged
kvinwang merged 1 commit into
v0.6.x-develfrom
feat/metadata-bios-sev
Jun 17, 2026
Merged

mkimage: add bios-sev field to metadata.json for SEV firmware#70
kvinwang merged 1 commit into
v0.6.x-develfrom
feat/metadata-bios-sev

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

What

Emit a bios-sev field in metadata.json pointing at ovmf-sev.fd when the AMD SEV firmware is present, alongside the existing TDX "bios": "ovmf.fd":

{
    "bios": "ovmf.fd",
    "bios-sev": "ovmf-sev.fd",
    "kernel": "bzImage",
    ...
}

This lets a VMM select the right firmware per platform (ovmf.fd on Intel TDX, ovmf-sev.fd on AMD SEV-SNP) from the image metadata instead of hardcoding the TDX firmware. Follow-up to #69 (which built/shipped ovmf-sev.fd but left it unreferenced in metadata).

Behaviour

  • The field is only emitted when ovmf-sev.fd was built/shipped (OVMF_BUILD_SEV), so non-SEV builds keep the original metadata.json.
  • Both branches produce valid JSON (verified with jq).

Measurement note

metadata.json is hashed into sha256sum.txt, so digest.txt (dstack's image-bundle digest) now reflects the bios-sev reference. This does not change any TDX hardware measurement: MRTD is measured from ovmf.fd and the RTMRs from kernel/cmdline/rootfs — none depend on metadata.json. Only the bundle digest changes, which is expected for a new image build.

Not included

The VMM-side logic that reads bios-sev and selects it based on the detected platform lives in the dstack repo (overlaps the in-progress SEV-SNP work, PR #703) and is out of scope here.

When the AMD SEV firmware (ovmf-sev.fd) is present, emit a "bios-sev"
field in metadata.json alongside the existing TDX "bios": "ovmf.fd". This
lets a VMM pick the right firmware per platform (ovmf.fd on TDX, ovmf-sev.fd
on AMD SEV-SNP) instead of hardcoding the TDX firmware.

The field is only emitted when the SEV firmware was built/shipped, so
non-SEV builds keep the original metadata.json. metadata.json is part of
sha256sum.txt, so digest.txt now reflects the bios-sev reference; this does
not change any TDX hardware measurement (MRTD comes from ovmf.fd, RTMRs from
kernel/cmdline/rootfs), only dstack's image-bundle digest.

Verified: metadata.json is valid JSON with .['bios-sev'] = 'ovmf-sev.fd';
the field is omitted (still valid JSON) when no SEV firmware is present.
Copilot AI review requested due to automatic review settings June 17, 2026 01:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the image bundle metadata emitted by mkimage.sh so that when AMD SEV firmware (ovmf-sev.fd) is present, it is referenced in metadata.json via a new bios-sev field, enabling consumers (e.g., a VMM) to select firmware per platform without hardcoding.

Changes:

  • Conditionally copy ovmf-sev.fd into the output bundle when present.
  • Conditionally emit "bios-sev": "ovmf-sev.fd" in metadata.json only when the SEV firmware artifact exists.
  • Update the in-script comment to clarify that while ovmf-sev.fd is not hashed directly, metadata.json is hashed and therefore the overall bundle digest changes when the reference is present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kvinwang kvinwang merged commit 90cd128 into v0.6.x-devel Jun 17, 2026
1 check passed
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.

2 participants