OVMF-amdsev: init at 202605

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
This commit is contained in:
Paul Meyer
2026-07-06 12:10:17 +02:00
parent c428cc1a3e
commit 39e9d62cea
2 changed files with 96 additions and 0 deletions
@@ -0,0 +1,26 @@
{
"description": "OVMF with AMD SEV-* support, direct kernel boot",
"interface-types": [
"uefi"
],
"mapping": {
"device": "memory",
"filename": "@firmware@"
},
"targets": [
{
"architecture": "x86_64",
"machines": [
"pc-q35-*"
]
}
],
"features": [
"amd-sev",
"amd-sev-es",
"amd-sev-snp"
],
"tags": [
]
}
+70
View File
@@ -0,0 +1,70 @@
{
lib,
edk2,
util-linux,
nasm,
acpica-tools,
debug ? false,
}:
edk2.mkDerivation "OvmfPkg/AmdSev/AmdSevX64.dsc" (finalAttrs: {
pname = "OVMF-amdsev";
version = lib.getVersion edk2;
outputs = [
"out"
"fd"
];
__structuredAttrs = true;
nativeBuildInputs = [
util-linux
nasm
acpica-tools
];
strictDeps = true;
hardeningDisable = [
"format"
"pic"
"fortify"
];
buildFlags = lib.optionals debug [ "-D DEBUG_ON_SERIAL_PORT=TRUE" ];
buildConfig = if debug then "DEBUG" else "RELEASE";
# The AmdSev platform embeds a grub image, built by the PREBUILD hook
# (OvmfPkg/AmdSev/Grub/grub.sh). Provide an empty grub.efi instead
# (the hook keeps an existing, newer grub.efi), like Fedora does.
# The resulting firmware supports direct kernel boot only.
postPatch = ''
touch OvmfPkg/AmdSev/Grub/grub.efi
'';
# AmdSevX64 only produces a unified firmware image. There is no
# CODE/VARS split: SEV-SNP attests the initial guest memory, so the
# image is mapped read-only via -bios instead of pflash.
postInstall = ''
mkdir -vp $fd/FV $fd/share/qemu/firmware
mv -v $out/FV/OVMF.fd $fd/FV/OVMF.amdsev.fd
substitute ${./61-edk2-ovmf-x64-amdsev.json} \
$fd/share/qemu/firmware/61-edk2-ovmf-x64-amdsev.json \
--subst-var-by firmware "$fd/FV/OVMF.amdsev.fd"
'';
dontPatchELF = true;
passthru = {
firmware = "${finalAttrs.finalPackage.fd}/FV/OVMF.amdsev.fd";
mergedFirmware = "${finalAttrs.finalPackage.fd}/FV/OVMF.amdsev.fd";
};
meta = {
description = "UEFI firmware with AMD SEV, SEV-ES and SEV-SNP support, direct kernel boot only";
homepage = "https://github.com/tianocore/tianocore.github.io/wiki/OVMF";
license = lib.licenses.bsd2;
platforms = builtins.filter (lib.hasPrefix "x86_64-") edk2.meta.platforms;
maintainers = [ lib.maintainers.katexochen ];
};
})