File uefi-default-firmware.patch of Package cockpit-machines
From a7a02f9aaabf6cc4c92f672eb08752374f614a32 Mon Sep 17 00:00:00 2001
From: Miika Alikirri <miika.alikirri@suse.com>
Date: Wed, 9 Jul 2025 11:11:07 +0300
Subject: Explicitly set UEFI as default firmware
---
src/libvirtApi/domain.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/libvirtApi/domain.ts b/src/libvirtApi/domain.ts
index 963d25f4..9ac69e77 100644
--- a/src/libvirtApi/domain.ts
+++ b/src/libvirtApi/domain.ts
@@ -361,6 +361,7 @@ interface DomainSpec {
userPassword: optString,
vmName: string,
sshKeys: string[],
+ firmware: 'bios' | 'uefi' | undefined
}
export async function domainCreate({
@@ -398,6 +399,9 @@ export async function domainCreate({
type DomainCreateScriptArgs = { connectionName: ConnectionName, type: string } & DomainSpec;
+ const arch = (await spawn(connectionName, ['uname', '-m'])).trim();
+ const defaultFirmware = ["ppc64le", "s390x"].includes(arch) ? undefined : "uefi";
+
const args: DomainCreateScriptArgs = {
connectionName,
memorySize,
@@ -416,6 +420,7 @@ export async function domainCreate({
userPassword,
vmName,
sshKeys,
+ firmware: defaultFirmware,
};
logDebug(`CREATE_VM(${vmName}): install_machine.py '${JSON.stringify(args)}'`);
--
2.51.0
From a5dcfb74c517aea09f17bd3efc0ef750c335e39b Mon Sep 17 00:00:00 2001
From: Miika Alikirri <miika.alikirri@suse.com>
Date: Thu, 10 Jul 2025 12:48:50 +0300
Subject: libvirt: allow changing from UEFI to BIOS
When UEFI is already selected and a user tries to switch to BIOS, not
all the relevant UEFI related elements are removed
This patch adds the functionality for removing loader and nvram if they
are set
---
src/libvirtApi/domain.ts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/libvirtApi/domain.ts b/src/libvirtApi/domain.ts
index 61926d52..5ba12a0b 100644
--- a/src/libvirtApi/domain.ts
+++ b/src/libvirtApi/domain.ts
@@ -1297,6 +1297,16 @@ export async function domainSetOSFirmware({
if (loaderElem)
loaderElem.remove();
+ // remove efi related things so it gets actually disabled
+ if (!loaderType || loaderType === "bios") {
+ const fwElem = getSingleOptionalElem(osElem, "firmware");
+ if (fwElem)
+ fwElem.remove();
+ const nvramElem = getSingleOptionalElem(osElem, "nvram");
+ if (nvramElem)
+ nvramElem.remove();
+ }
+
if (!loaderType)
osElem.removeAttribute("firmware");
else
--
2.50.0