From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 513291FF09B for ; Mon, 28 Sep 2026 07:49:20 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 064DE21781; Mon, 28 Sep 2026 07:48:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=genua.de; s=202307; t=1790574491; bh=vJNyHyV5XOGQ55vK85Wyk2B5QiHUJxlbSNV+AWqx6w0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=g0XrxxLKuW6kvW8TZI3IRSL0n6JQDEDvnvL/v4JrNlx4js/G10YcE6jtalmEHuX7T l4hk/ZK2sgshJF5WH+md5E2F8NEaQe+xYKCfJ0fVP5IuwQ8hGhuAwE3FtRKCa8hNVa TYZEyMFN9TpGDymDMFYJL5UJtfmeEaWmdxdH7yAnIurhebiy6rs+Zmn05lFyJTtW7R gjNCFmFnLXqjDByfIrVseoUIrQ5iPvUJHLfTm1UXAhP3jvbq01AdelDReWNnbuwQzW AR7AK6G7utwBy9I3ihVQISwr25ubROFuyBfE9cdCnRS10RA9nllAxlr64bPmCbU8hF M6Mwre57ygXdQ== Date: Mon, 28 Sep 2026 07:48:10 +0200 From: Christian Ludwig To: Subject: [PATCH v2 qemu-server 09/16] ovmf: use a custom firmware image if configured Message-ID: <58f144c27c021d87d29fec22718e8a0f50efa0d9.1790337726.git@genua.de> References: MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [192.168.217.185] X-ClientProxiedBy: kch1-mta08.win.genua.de (10.208.16.108) To kch1-mta07.win.genua.de (10.208.16.107) Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-SPAM-LEVEL: Spam detection results: 0 AWL 0.086 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record UNPARSEABLE_RELAY 0.001 Informational: message has unparseable relay lines Message-ID-Hash: 777S6OEA5D66I4OZJRNLQVJCBVDCEN3N X-Message-ID-Hash: 777S6OEA5D66I4OZJRNLQVJCBVDCEN3N X-MailFrom: christian_ludwig@genua.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Replace the system OVMF code image with the configured one, for the pflash, blockdev and '-bios' variants. Die if the volume does not exist. Signed-off-by: Christian Ludwig --- src/PVE/QemuServer/OVMF.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/PVE/QemuServer/OVMF.pm b/src/PVE/QemuServer/OVMF.pm index 67665c7c..fe301353 100644 --- a/src/PVE/QemuServer/OVMF.pm +++ b/src/PVE/QemuServer/OVMF.pm @@ -123,6 +123,9 @@ my sub print_ovmf_drive_commandlines { if $cvm_type && $cvm_type eq 'tdx'; my ($ovmf_code, $ovmf_vars) = get_ovmf_files($arch, $d, $q35, $cvm_type); + if ($conf->{'efi-firmware'}) { + $ovmf_code = PVE::Storage::path($storecfg, $conf->{'efi-firmware'}); + } my $ovmf_vars_size = file_get_size($ovmf_vars); my $var_drive_str = "if=pflash,unit=1,id=drive-efidisk0"; @@ -219,6 +222,9 @@ my sub generate_ovmf_blockdev { if $cvm_type && $cvm_type eq 'snp'; my ($ovmf_code, $ovmf_vars) = get_ovmf_files($arch, $drive, $q35, $cvm_type); + if ($conf->{'efi-firmware'}) { + $ovmf_code = PVE::Storage::path($storecfg, $conf->{'efi-firmware'}); + } my $ovmf_code_blockdev = { driver => 'raw', @@ -268,6 +274,12 @@ sub print_ovmf_commandline { my $cvm_type = $hw_info->{'cvm-type'}; + if ($conf->{'efi-firmware'}) { + my $fw_path = PVE::Storage::path($storecfg, $conf->{'efi-firmware'}); + die "efi-firmware volume '$conf->{'efi-firmware'}' not found at '$fw_path'\n" + if !file_exists($fw_path); + } + my $cmd = []; my $machine_flags = []; @@ -277,7 +289,13 @@ sub print_ovmf_commandline { "EFI disks are not supported with Confidential Virtual Machines and will be ignored" ); } - push $cmd->@*, '-bios', get_ovmf_files($hw_info->{arch}, undef, undef, $cvm_type); + my $bios_path; + if ($conf->{'efi-firmware'}) { + $bios_path = PVE::Storage::path($storecfg, $conf->{'efi-firmware'}); + } else { + ($bios_path) = get_ovmf_files($hw_info->{arch}, undef, undef, $cvm_type); + } + push $cmd->@*, '-bios', $bios_path; } else { if ($version_guard->(10, 0, 0)) { # for the switch to -blockdev my ($code_blockdev, $vars_blockdev, $throttle_group) = -- 2.34.1