From 3fb72b531cdaf78afe943118e845d01d7476f822 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 2 Apr 2026 16:10:43 +0300 Subject: [PATCH 01/27] t Signed-off-by: Valeriy Khorunzhin --- images/virt-artifact/werf.inc.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index f30560fba6..54a933900e 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,8 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $tag }} /src/kubevirt + echo "kek" + git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From cb432a9b943710625cf4dbfb8f8e52de70320432 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 2 Apr 2026 18:08:03 +0300 Subject: [PATCH 02/27] t2 Signed-off-by: Valeriy Khorunzhin --- images/virt-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 54a933900e..b5c41855d3 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek" + echo "kek2" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From cea35ebcd56f3132a939003004c6b74995358128 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 7 Apr 2026 17:00:26 +0300 Subject: [PATCH 03/27] patch Signed-off-by: Valeriy Khorunzhin --- ...PortLib-for-debug-console-port-0x402.patch | 254 ++++++++++++++++++ images/edk2/werf.inc.yaml | 16 ++ 2 files changed, 270 insertions(+) create mode 100644 images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch diff --git a/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch b/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch new file mode 100644 index 0000000000..ceda7ca404 --- /dev/null +++ b/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch @@ -0,0 +1,254 @@ +diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c +new file mode 100644 +index 0000000000..4e4f20cf2d +--- /dev/null ++++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c +@@ -0,0 +1,160 @@ ++/** @file ++ Serial Port Library backed by the QEMU debug console (I/O port 0x402). ++ ++ Implements SerialPortLib by writing every byte to the I/O port specified ++ by PcdDebugIoPort (default 0x402). The port is detected at Initialize ++ time via the Bochs/QEMU magic read-back value 0xE9. ++ ++ Copyright (c) 2024, Intel Corporation. All rights reserved.
++ SPDX-License-Identifier: BSD-2-Clause-Patent ++**/ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define BOCHS_DEBUG_PORT_MAGIC 0xE9 ++ ++STATIC BOOLEAN mDebugConDetected = FALSE; ++ ++/** ++ Initialize the serial device hardware. ++ ++ Probes the QEMU debug console port. If the magic value 0xE9 is read ++ back, the port is considered present. ++ ++ @retval RETURN_SUCCESS The debug console port was detected. ++ @retval RETURN_DEVICE_ERROR The debug console port is not available. ++**/ ++RETURN_STATUS ++EFIAPI ++SerialPortInitialize ( ++ VOID ++ ) ++{ ++ UINT16 Port; ++ ++ Port = PcdGet16 (PcdDebugIoPort); ++ if (IoRead8 (Port) == BOCHS_DEBUG_PORT_MAGIC) { ++ mDebugConDetected = TRUE; ++ return RETURN_SUCCESS; ++ } ++ ++ return RETURN_DEVICE_ERROR; ++} ++ ++/** ++ Write data to the QEMU debug console port. ++ ++ @param Buffer Pointer to the data buffer to be written. ++ @param NumberOfBytes Number of bytes to write. ++ ++ @retval 0 The debug console port is not present. ++ @retval >0 The number of bytes written. ++**/ ++UINTN ++EFIAPI ++SerialPortWrite ( ++ IN UINT8 *Buffer, ++ IN UINTN NumberOfBytes ++ ) ++{ ++ UINT16 Port; ++ UINTN Index; ++ ++ if (!mDebugConDetected) { ++ return 0; ++ } ++ ++ Port = PcdGet16 (PcdDebugIoPort); ++ for (Index = 0; Index < NumberOfBytes; Index++) { ++ IoWrite8 (Port, Buffer[Index]); ++ } ++ ++ return NumberOfBytes; ++} ++ ++/** ++ Read is not supported on the debug console port. ++ ++ @param Buffer Pointer to the data buffer to store data. ++ @param NumberOfBytes Number of bytes to read. ++ ++ @retval 0 Always returns 0 (not supported). ++**/ ++UINTN ++EFIAPI ++SerialPortRead ( ++ OUT UINT8 *Buffer, ++ IN UINTN NumberOfBytes ++ ) ++{ ++ return 0; ++} ++ ++/** ++ Polling is not supported on the debug console port. ++ ++ @retval FALSE Always returns FALSE. ++**/ ++BOOLEAN ++EFIAPI ++SerialPortPoll ( ++ VOID ++ ) ++{ ++ return FALSE; ++} ++ ++/** ++ Set control bits — not supported. ++ ++ @param Control Control bits to set. ++ ++ @retval RETURN_UNSUPPORTED Always. ++**/ ++RETURN_STATUS ++EFIAPI ++SerialPortSetControl ( ++ IN UINT32 Control ++ ) ++{ ++ return RETURN_UNSUPPORTED; ++} ++ ++/** ++ Get control bits — not supported. ++ ++ @param Control Pointer to receive control signals. ++ ++ @retval RETURN_UNSUPPORTED Always. ++**/ ++RETURN_STATUS ++EFIAPI ++SerialPortGetControl ( ++ OUT UINT32 *Control ++ ) ++{ ++ return RETURN_UNSUPPORTED; ++} ++ ++/** ++ Set serial attributes — not supported. ++ ++ @retval RETURN_UNSUPPORTED Always. ++**/ ++RETURN_STATUS ++EFIAPI ++SerialPortSetAttributes ( ++ IN OUT UINT64 *BaudRate, ++ IN OUT UINT32 *ReceiveFifoDepth, ++ IN OUT UINT32 *Timeout, ++ IN OUT EFI_PARITY_TYPE *Parity, ++ IN OUT UINT8 *DataBits, ++ IN OUT EFI_STOP_BITS_TYPE *StopBits ++ ) ++{ ++ return RETURN_UNSUPPORTED; ++} +diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf +new file mode 100644 +index 0000000000..8b506f9020 +--- /dev/null ++++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf +@@ -0,0 +1,34 @@ ++## @file ++# Serial Port Library backed by the QEMU debug console (I/O port 0x402). ++# ++# This library instance implements SerialPortLib by writing bytes to the ++# I/O port configured via PcdDebugIoPort. It can be used together with ++# BaseDebugLibSerialPort to route DEBUG() output to the QEMU debug console. ++# ++# Copyright (c) 2024, Intel Corporation. All rights reserved.
++# SPDX-License-Identifier: BSD-2-Clause-Patent ++# ++## ++ ++[Defines] ++ INF_VERSION = 0x00010005 ++ BASE_NAME = BaseSerialPortLibDebugCon ++ FILE_GUID = 53A6F6C9-3297-4A36-95E0-68C5D2A4EA1F ++ MODULE_TYPE = BASE ++ VERSION_STRING = 1.0 ++ LIBRARY_CLASS = SerialPortLib ++ ++[Sources] ++ BaseSerialPortLibDebugCon.c ++ ++[Packages] ++ MdePkg/MdePkg.dec ++ OvmfPkg/OvmfPkg.dec ++ ++[LibraryClasses] ++ BaseLib ++ IoLib ++ PcdLib ++ ++[Pcd] ++ gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES +diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc +index 7ab6af3a69..b986ab13b5 100644 +--- a/OvmfPkg/OvmfPkgIa32.dsc ++++ b/OvmfPkg/OvmfPkgIa32.dsc +@@ -165,7 +165,11 @@ + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf ++!ifdef $(DEBUG_ON_SERIAL_PORT) + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf ++!else ++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf ++!endif + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf + MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf + CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf +diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc +index e7fff78df9..a2535b548a 100644 +--- a/OvmfPkg/OvmfPkgIa32X64.dsc ++++ b/OvmfPkg/OvmfPkgIa32X64.dsc +@@ -170,7 +170,11 @@ + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf ++!ifdef $(DEBUG_ON_SERIAL_PORT) + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf ++!else ++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf ++!endif + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf + MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf + CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf +diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc +index 556984bdaa..51e8fe2789 100644 +--- a/OvmfPkg/OvmfPkgX64.dsc ++++ b/OvmfPkg/OvmfPkgX64.dsc +@@ -182,7 +182,11 @@ + PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf ++!ifdef $(DEBUG_ON_SERIAL_PORT) + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf ++!else ++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf ++!endif + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf + MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf + CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 452ae9fe18..1f04bd78e9 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -53,6 +53,13 @@ git: stageDependencies: install: - '*.json' +- add: {{ .ModuleDir }}/images/{{ .ImageName }}/patches + to: /src/patches + includePaths: + - '*.patch' + stageDependencies: + install: + - '*.patch' - add: {{ .ModuleDir }}/images/{{ .ImageName }}/uefi-revocation-list to: /src/FIRMWARE includePaths: @@ -68,6 +75,8 @@ shell: - | cd /src + echo "1234567" + echo "Git clone Edk2 repository..." git clone \ --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} \ @@ -90,6 +99,13 @@ shell: submodule update --init --recursive --depth=1 fi + echo "Applying patches..." + for p in /src/patches/*.patch; do + [ -f "$p" ] || continue + echo "Applying $p" + git apply "$p" + done + --- image: {{ .ModuleNamePrefix }}{{ .ImageName }} From 69019f459fb15d8363b5b07ab6af67716b88a1bb Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 7 Apr 2026 19:21:24 +0300 Subject: [PATCH 04/27] t Signed-off-by: Valeriy Khorunzhin --- ...PortLib-for-debug-console-port-0x402.patch | 303 ++++++++++++++++++ images/edk2/werf.inc.yaml | 2 +- 2 files changed, 304 insertions(+), 1 deletion(-) diff --git a/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch b/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch index ceda7ca404..5294078562 100644 --- a/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch +++ b/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch @@ -1,3 +1,263 @@ +diff --git a/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch b/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch +new file mode 100644 +index 0000000000..ceda7ca404 +--- /dev/null ++++ b/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch +@@ -0,0 +1,254 @@ ++diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c ++new file mode 100644 ++index 0000000000..4e4f20cf2d ++--- /dev/null +++++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c ++@@ -0,0 +1,160 @@ +++/** @file +++ Serial Port Library backed by the QEMU debug console (I/O port 0x402). +++ +++ Implements SerialPortLib by writing every byte to the I/O port specified +++ by PcdDebugIoPort (default 0x402). The port is detected at Initialize +++ time via the Bochs/QEMU magic read-back value 0xE9. +++ +++ Copyright (c) 2024, Intel Corporation. All rights reserved.
+++ SPDX-License-Identifier: BSD-2-Clause-Patent +++**/ +++ +++#include +++#include +++#include +++#include +++#include +++ +++#define BOCHS_DEBUG_PORT_MAGIC 0xE9 +++ +++STATIC BOOLEAN mDebugConDetected = FALSE; +++ +++/** +++ Initialize the serial device hardware. +++ +++ Probes the QEMU debug console port. If the magic value 0xE9 is read +++ back, the port is considered present. +++ +++ @retval RETURN_SUCCESS The debug console port was detected. +++ @retval RETURN_DEVICE_ERROR The debug console port is not available. +++**/ +++RETURN_STATUS +++EFIAPI +++SerialPortInitialize ( +++ VOID +++ ) +++{ +++ UINT16 Port; +++ +++ Port = PcdGet16 (PcdDebugIoPort); +++ if (IoRead8 (Port) == BOCHS_DEBUG_PORT_MAGIC) { +++ mDebugConDetected = TRUE; +++ return RETURN_SUCCESS; +++ } +++ +++ return RETURN_DEVICE_ERROR; +++} +++ +++/** +++ Write data to the QEMU debug console port. +++ +++ @param Buffer Pointer to the data buffer to be written. +++ @param NumberOfBytes Number of bytes to write. +++ +++ @retval 0 The debug console port is not present. +++ @retval >0 The number of bytes written. +++**/ +++UINTN +++EFIAPI +++SerialPortWrite ( +++ IN UINT8 *Buffer, +++ IN UINTN NumberOfBytes +++ ) +++{ +++ UINT16 Port; +++ UINTN Index; +++ +++ if (!mDebugConDetected) { +++ return 0; +++ } +++ +++ Port = PcdGet16 (PcdDebugIoPort); +++ for (Index = 0; Index < NumberOfBytes; Index++) { +++ IoWrite8 (Port, Buffer[Index]); +++ } +++ +++ return NumberOfBytes; +++} +++ +++/** +++ Read is not supported on the debug console port. +++ +++ @param Buffer Pointer to the data buffer to store data. +++ @param NumberOfBytes Number of bytes to read. +++ +++ @retval 0 Always returns 0 (not supported). +++**/ +++UINTN +++EFIAPI +++SerialPortRead ( +++ OUT UINT8 *Buffer, +++ IN UINTN NumberOfBytes +++ ) +++{ +++ return 0; +++} +++ +++/** +++ Polling is not supported on the debug console port. +++ +++ @retval FALSE Always returns FALSE. +++**/ +++BOOLEAN +++EFIAPI +++SerialPortPoll ( +++ VOID +++ ) +++{ +++ return FALSE; +++} +++ +++/** +++ Set control bits — not supported. +++ +++ @param Control Control bits to set. +++ +++ @retval RETURN_UNSUPPORTED Always. +++**/ +++RETURN_STATUS +++EFIAPI +++SerialPortSetControl ( +++ IN UINT32 Control +++ ) +++{ +++ return RETURN_UNSUPPORTED; +++} +++ +++/** +++ Get control bits — not supported. +++ +++ @param Control Pointer to receive control signals. +++ +++ @retval RETURN_UNSUPPORTED Always. +++**/ +++RETURN_STATUS +++EFIAPI +++SerialPortGetControl ( +++ OUT UINT32 *Control +++ ) +++{ +++ return RETURN_UNSUPPORTED; +++} +++ +++/** +++ Set serial attributes — not supported. +++ +++ @retval RETURN_UNSUPPORTED Always. +++**/ +++RETURN_STATUS +++EFIAPI +++SerialPortSetAttributes ( +++ IN OUT UINT64 *BaudRate, +++ IN OUT UINT32 *ReceiveFifoDepth, +++ IN OUT UINT32 *Timeout, +++ IN OUT EFI_PARITY_TYPE *Parity, +++ IN OUT UINT8 *DataBits, +++ IN OUT EFI_STOP_BITS_TYPE *StopBits +++ ) +++{ +++ return RETURN_UNSUPPORTED; +++} ++diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf ++new file mode 100644 ++index 0000000000..8b506f9020 ++--- /dev/null +++++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf ++@@ -0,0 +1,34 @@ +++## @file +++# Serial Port Library backed by the QEMU debug console (I/O port 0x402). +++# +++# This library instance implements SerialPortLib by writing bytes to the +++# I/O port configured via PcdDebugIoPort. It can be used together with +++# BaseDebugLibSerialPort to route DEBUG() output to the QEMU debug console. +++# +++# Copyright (c) 2024, Intel Corporation. All rights reserved.
+++# SPDX-License-Identifier: BSD-2-Clause-Patent +++# +++## +++ +++[Defines] +++ INF_VERSION = 0x00010005 +++ BASE_NAME = BaseSerialPortLibDebugCon +++ FILE_GUID = 53A6F6C9-3297-4A36-95E0-68C5D2A4EA1F +++ MODULE_TYPE = BASE +++ VERSION_STRING = 1.0 +++ LIBRARY_CLASS = SerialPortLib +++ +++[Sources] +++ BaseSerialPortLibDebugCon.c +++ +++[Packages] +++ MdePkg/MdePkg.dec +++ OvmfPkg/OvmfPkg.dec +++ +++[LibraryClasses] +++ BaseLib +++ IoLib +++ PcdLib +++ +++[Pcd] +++ gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES ++diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc ++index 7ab6af3a69..b986ab13b5 100644 ++--- a/OvmfPkg/OvmfPkgIa32.dsc +++++ b/OvmfPkg/OvmfPkgIa32.dsc ++@@ -165,7 +165,11 @@ ++ CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf ++ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf ++ OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +++!ifdef $(DEBUG_ON_SERIAL_PORT) ++ SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf +++!else +++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf +++!endif ++ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf ++ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf ++ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf ++diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc ++index e7fff78df9..a2535b548a 100644 ++--- a/OvmfPkg/OvmfPkgIa32X64.dsc +++++ b/OvmfPkg/OvmfPkgIa32X64.dsc ++@@ -170,7 +170,11 @@ ++ CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf ++ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf ++ OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +++!ifdef $(DEBUG_ON_SERIAL_PORT) ++ SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf +++!else +++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf +++!endif ++ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf ++ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf ++ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf ++diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc ++index 556984bdaa..51e8fe2789 100644 ++--- a/OvmfPkg/OvmfPkgX64.dsc +++++ b/OvmfPkg/OvmfPkgX64.dsc ++@@ -182,7 +182,11 @@ ++ PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf ++ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf ++ OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +++!ifdef $(DEBUG_ON_SERIAL_PORT) ++ SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf +++!else +++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf +++!endif ++ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf ++ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf ++ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c new file mode 100644 index 0000000000..4e4f20cf2d @@ -204,6 +464,49 @@ index 0000000000..8b506f9020 + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES +diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +index d9f61757cf..cbf844df21 100644 +--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c ++++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +@@ -2020,6 +2020,12 @@ PlatformBootManagerUnableToBoot ( + EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu; + UINTN Index; + ++ DEBUG (( ++ DEBUG_ERROR, ++ "%a: No bootable option or device was found. Falling back to Boot Manager Menu / EFI Shell.\n", ++ gEfiCallerBaseName ++ )); ++ + if (FeaturePcdGet (PcdBootRestrictToFirmware)) { + AsciiPrint ( + "%a: No bootable option was found.\n", +@@ -2034,6 +2040,12 @@ PlatformBootManagerUnableToBoot ( + // + Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu); + if (EFI_ERROR (Status)) { ++ DEBUG (( ++ DEBUG_ERROR, ++ "%a: Boot Manager Menu unavailable (Status = %r). System halted.\n", ++ gEfiCallerBaseName, ++ Status ++ )); + return; + } + +@@ -2066,6 +2078,12 @@ PlatformBootManagerUnableToBoot ( + } + } + ++ DEBUG (( ++ DEBUG_ERROR, ++ "%a: Entering Boot Manager Menu loop.\n", ++ gEfiCallerBaseName ++ )); ++ + for ( ; ;) { + EfiBootManagerBoot (&BootManagerMenu); + } diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 7ab6af3a69..b986ab13b5 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 1f04bd78e9..6858e6095c 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -75,7 +75,7 @@ shell: - | cd /src - echo "1234567" + echo "12345678" echo "Git clone Edk2 repository..." git clone \ From 6a07e7014ba6f20b9eb5b40d43b9b7f1f38835d4 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 8 Apr 2026 00:34:56 +0300 Subject: [PATCH 05/27] patch new Signed-off-by: Valeriy Khorunzhin --- images/edk2/patches/0001-0x402.patch | 62 ++ ...PortLib-for-debug-console-port-0x402.patch | 557 ------------------ images/edk2/werf.inc.yaml | 2 +- 3 files changed, 63 insertions(+), 558 deletions(-) create mode 100644 images/edk2/patches/0001-0x402.patch delete mode 100644 images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch diff --git a/images/edk2/patches/0001-0x402.patch b/images/edk2/patches/0001-0x402.patch new file mode 100644 index 0000000000..c87c0b0da3 --- /dev/null +++ b/images/edk2/patches/0001-0x402.patch @@ -0,0 +1,62 @@ +diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +index d9f61757cf..d2a0e5f6a1 100644 +--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c ++++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +@@ -2020,6 +2020,14 @@ PlatformBootManagerUnableToBoot ( + EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu; + UINTN Index; + ++ { ++ STATIC CONST CHAR8 Msg[] = "No bootable device.\r\n"; ++ UINTN i; ++ for (i = 0; i < sizeof (Msg) - 1; i++) { ++ IoWrite8 (0x402, (UINT8)Msg[i]); ++ } ++ } ++ + if (FeaturePcdGet (PcdBootRestrictToFirmware)) { + AsciiPrint ( + "%a: No bootable option was found.\n", +diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c +index 9bacf9d8c7..ea78559516 100644 +--- a/ShellPkg/Application/Shell/Shell.c ++++ b/ShellPkg/Application/Shell/Shell.c +@@ -359,6 +359,14 @@ UefiMain ( + EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn; + SPLIT_LIST *Split; + ++ { ++ STATIC CONST CHAR8 Msg[] = "No bootable device.\r\n"; ++ UINTN i; ++ for (i = 0; i < sizeof (Msg) - 1; i++) { ++ IoWrite8 (0x402, (UINT8)Msg[i]); ++ } ++ } ++ + if (PcdGet8 (PcdShellSupportLevel) > 3) { + return (EFI_UNSUPPORTED); + } +diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h +index 89b4ac6b02..cd82e6f608 100644 +--- a/ShellPkg/Application/Shell/Shell.h ++++ b/ShellPkg/Application/Shell/Shell.h +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + + #include "ShellParametersProtocol.h" + #include "ShellProtocol.h" +diff --git a/ShellPkg/Application/Shell/Shell.inf b/ShellPkg/Application/Shell/Shell.inf +index f1e41de133..88b033bc35 100644 +--- a/ShellPkg/Application/Shell/Shell.inf ++++ b/ShellPkg/Application/Shell/Shell.inf +@@ -66,6 +66,7 @@ + SortLib + HandleParsingLib + UefiHiiServicesLib ++ IoLib + + [Guids] + gShellVariableGuid ## SOMETIMES_CONSUMES ## GUID diff --git a/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch b/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch deleted file mode 100644 index 5294078562..0000000000 --- a/images/edk2/patches/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch +++ /dev/null @@ -1,557 +0,0 @@ -diff --git a/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch b/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch -new file mode 100644 -index 0000000000..ceda7ca404 ---- /dev/null -+++ b/0001-OvmfPkg-Add-SerialPortLib-for-debug-console-port-0x402.patch -@@ -0,0 +1,254 @@ -+diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c -+new file mode 100644 -+index 0000000000..4e4f20cf2d -+--- /dev/null -++++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c -+@@ -0,0 +1,160 @@ -++/** @file -++ Serial Port Library backed by the QEMU debug console (I/O port 0x402). -++ -++ Implements SerialPortLib by writing every byte to the I/O port specified -++ by PcdDebugIoPort (default 0x402). The port is detected at Initialize -++ time via the Bochs/QEMU magic read-back value 0xE9. -++ -++ Copyright (c) 2024, Intel Corporation. All rights reserved.
-++ SPDX-License-Identifier: BSD-2-Clause-Patent -++**/ -++ -++#include -++#include -++#include -++#include -++#include -++ -++#define BOCHS_DEBUG_PORT_MAGIC 0xE9 -++ -++STATIC BOOLEAN mDebugConDetected = FALSE; -++ -++/** -++ Initialize the serial device hardware. -++ -++ Probes the QEMU debug console port. If the magic value 0xE9 is read -++ back, the port is considered present. -++ -++ @retval RETURN_SUCCESS The debug console port was detected. -++ @retval RETURN_DEVICE_ERROR The debug console port is not available. -++**/ -++RETURN_STATUS -++EFIAPI -++SerialPortInitialize ( -++ VOID -++ ) -++{ -++ UINT16 Port; -++ -++ Port = PcdGet16 (PcdDebugIoPort); -++ if (IoRead8 (Port) == BOCHS_DEBUG_PORT_MAGIC) { -++ mDebugConDetected = TRUE; -++ return RETURN_SUCCESS; -++ } -++ -++ return RETURN_DEVICE_ERROR; -++} -++ -++/** -++ Write data to the QEMU debug console port. -++ -++ @param Buffer Pointer to the data buffer to be written. -++ @param NumberOfBytes Number of bytes to write. -++ -++ @retval 0 The debug console port is not present. -++ @retval >0 The number of bytes written. -++**/ -++UINTN -++EFIAPI -++SerialPortWrite ( -++ IN UINT8 *Buffer, -++ IN UINTN NumberOfBytes -++ ) -++{ -++ UINT16 Port; -++ UINTN Index; -++ -++ if (!mDebugConDetected) { -++ return 0; -++ } -++ -++ Port = PcdGet16 (PcdDebugIoPort); -++ for (Index = 0; Index < NumberOfBytes; Index++) { -++ IoWrite8 (Port, Buffer[Index]); -++ } -++ -++ return NumberOfBytes; -++} -++ -++/** -++ Read is not supported on the debug console port. -++ -++ @param Buffer Pointer to the data buffer to store data. -++ @param NumberOfBytes Number of bytes to read. -++ -++ @retval 0 Always returns 0 (not supported). -++**/ -++UINTN -++EFIAPI -++SerialPortRead ( -++ OUT UINT8 *Buffer, -++ IN UINTN NumberOfBytes -++ ) -++{ -++ return 0; -++} -++ -++/** -++ Polling is not supported on the debug console port. -++ -++ @retval FALSE Always returns FALSE. -++**/ -++BOOLEAN -++EFIAPI -++SerialPortPoll ( -++ VOID -++ ) -++{ -++ return FALSE; -++} -++ -++/** -++ Set control bits — not supported. -++ -++ @param Control Control bits to set. -++ -++ @retval RETURN_UNSUPPORTED Always. -++**/ -++RETURN_STATUS -++EFIAPI -++SerialPortSetControl ( -++ IN UINT32 Control -++ ) -++{ -++ return RETURN_UNSUPPORTED; -++} -++ -++/** -++ Get control bits — not supported. -++ -++ @param Control Pointer to receive control signals. -++ -++ @retval RETURN_UNSUPPORTED Always. -++**/ -++RETURN_STATUS -++EFIAPI -++SerialPortGetControl ( -++ OUT UINT32 *Control -++ ) -++{ -++ return RETURN_UNSUPPORTED; -++} -++ -++/** -++ Set serial attributes — not supported. -++ -++ @retval RETURN_UNSUPPORTED Always. -++**/ -++RETURN_STATUS -++EFIAPI -++SerialPortSetAttributes ( -++ IN OUT UINT64 *BaudRate, -++ IN OUT UINT32 *ReceiveFifoDepth, -++ IN OUT UINT32 *Timeout, -++ IN OUT EFI_PARITY_TYPE *Parity, -++ IN OUT UINT8 *DataBits, -++ IN OUT EFI_STOP_BITS_TYPE *StopBits -++ ) -++{ -++ return RETURN_UNSUPPORTED; -++} -+diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -+new file mode 100644 -+index 0000000000..8b506f9020 -+--- /dev/null -++++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -+@@ -0,0 +1,34 @@ -++## @file -++# Serial Port Library backed by the QEMU debug console (I/O port 0x402). -++# -++# This library instance implements SerialPortLib by writing bytes to the -++# I/O port configured via PcdDebugIoPort. It can be used together with -++# BaseDebugLibSerialPort to route DEBUG() output to the QEMU debug console. -++# -++# Copyright (c) 2024, Intel Corporation. All rights reserved.
-++# SPDX-License-Identifier: BSD-2-Clause-Patent -++# -++## -++ -++[Defines] -++ INF_VERSION = 0x00010005 -++ BASE_NAME = BaseSerialPortLibDebugCon -++ FILE_GUID = 53A6F6C9-3297-4A36-95E0-68C5D2A4EA1F -++ MODULE_TYPE = BASE -++ VERSION_STRING = 1.0 -++ LIBRARY_CLASS = SerialPortLib -++ -++[Sources] -++ BaseSerialPortLibDebugCon.c -++ -++[Packages] -++ MdePkg/MdePkg.dec -++ OvmfPkg/OvmfPkg.dec -++ -++[LibraryClasses] -++ BaseLib -++ IoLib -++ PcdLib -++ -++[Pcd] -++ gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES -+diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc -+index 7ab6af3a69..b986ab13b5 100644 -+--- a/OvmfPkg/OvmfPkgIa32.dsc -++++ b/OvmfPkg/OvmfPkgIa32.dsc -+@@ -165,7 +165,11 @@ -+ CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf -+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf -+ OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf -++!ifdef $(DEBUG_ON_SERIAL_PORT) -+ SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf -++!else -++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -++!endif -+ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf -+ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf -+ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf -+diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc -+index e7fff78df9..a2535b548a 100644 -+--- a/OvmfPkg/OvmfPkgIa32X64.dsc -++++ b/OvmfPkg/OvmfPkgIa32X64.dsc -+@@ -170,7 +170,11 @@ -+ CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf -+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf -+ OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf -++!ifdef $(DEBUG_ON_SERIAL_PORT) -+ SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf -++!else -++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -++!endif -+ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf -+ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf -+ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf -+diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc -+index 556984bdaa..51e8fe2789 100644 -+--- a/OvmfPkg/OvmfPkgX64.dsc -++++ b/OvmfPkg/OvmfPkgX64.dsc -+@@ -182,7 +182,11 @@ -+ PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf -+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf -+ OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf -++!ifdef $(DEBUG_ON_SERIAL_PORT) -+ SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf -++!else -++ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -++!endif -+ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf -+ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf -+ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf -diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c -new file mode 100644 -index 0000000000..4e4f20cf2d ---- /dev/null -+++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.c -@@ -0,0 +1,160 @@ -+/** @file -+ Serial Port Library backed by the QEMU debug console (I/O port 0x402). -+ -+ Implements SerialPortLib by writing every byte to the I/O port specified -+ by PcdDebugIoPort (default 0x402). The port is detected at Initialize -+ time via the Bochs/QEMU magic read-back value 0xE9. -+ -+ Copyright (c) 2024, Intel Corporation. All rights reserved.
-+ SPDX-License-Identifier: BSD-2-Clause-Patent -+**/ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define BOCHS_DEBUG_PORT_MAGIC 0xE9 -+ -+STATIC BOOLEAN mDebugConDetected = FALSE; -+ -+/** -+ Initialize the serial device hardware. -+ -+ Probes the QEMU debug console port. If the magic value 0xE9 is read -+ back, the port is considered present. -+ -+ @retval RETURN_SUCCESS The debug console port was detected. -+ @retval RETURN_DEVICE_ERROR The debug console port is not available. -+**/ -+RETURN_STATUS -+EFIAPI -+SerialPortInitialize ( -+ VOID -+ ) -+{ -+ UINT16 Port; -+ -+ Port = PcdGet16 (PcdDebugIoPort); -+ if (IoRead8 (Port) == BOCHS_DEBUG_PORT_MAGIC) { -+ mDebugConDetected = TRUE; -+ return RETURN_SUCCESS; -+ } -+ -+ return RETURN_DEVICE_ERROR; -+} -+ -+/** -+ Write data to the QEMU debug console port. -+ -+ @param Buffer Pointer to the data buffer to be written. -+ @param NumberOfBytes Number of bytes to write. -+ -+ @retval 0 The debug console port is not present. -+ @retval >0 The number of bytes written. -+**/ -+UINTN -+EFIAPI -+SerialPortWrite ( -+ IN UINT8 *Buffer, -+ IN UINTN NumberOfBytes -+ ) -+{ -+ UINT16 Port; -+ UINTN Index; -+ -+ if (!mDebugConDetected) { -+ return 0; -+ } -+ -+ Port = PcdGet16 (PcdDebugIoPort); -+ for (Index = 0; Index < NumberOfBytes; Index++) { -+ IoWrite8 (Port, Buffer[Index]); -+ } -+ -+ return NumberOfBytes; -+} -+ -+/** -+ Read is not supported on the debug console port. -+ -+ @param Buffer Pointer to the data buffer to store data. -+ @param NumberOfBytes Number of bytes to read. -+ -+ @retval 0 Always returns 0 (not supported). -+**/ -+UINTN -+EFIAPI -+SerialPortRead ( -+ OUT UINT8 *Buffer, -+ IN UINTN NumberOfBytes -+ ) -+{ -+ return 0; -+} -+ -+/** -+ Polling is not supported on the debug console port. -+ -+ @retval FALSE Always returns FALSE. -+**/ -+BOOLEAN -+EFIAPI -+SerialPortPoll ( -+ VOID -+ ) -+{ -+ return FALSE; -+} -+ -+/** -+ Set control bits — not supported. -+ -+ @param Control Control bits to set. -+ -+ @retval RETURN_UNSUPPORTED Always. -+**/ -+RETURN_STATUS -+EFIAPI -+SerialPortSetControl ( -+ IN UINT32 Control -+ ) -+{ -+ return RETURN_UNSUPPORTED; -+} -+ -+/** -+ Get control bits — not supported. -+ -+ @param Control Pointer to receive control signals. -+ -+ @retval RETURN_UNSUPPORTED Always. -+**/ -+RETURN_STATUS -+EFIAPI -+SerialPortGetControl ( -+ OUT UINT32 *Control -+ ) -+{ -+ return RETURN_UNSUPPORTED; -+} -+ -+/** -+ Set serial attributes — not supported. -+ -+ @retval RETURN_UNSUPPORTED Always. -+**/ -+RETURN_STATUS -+EFIAPI -+SerialPortSetAttributes ( -+ IN OUT UINT64 *BaudRate, -+ IN OUT UINT32 *ReceiveFifoDepth, -+ IN OUT UINT32 *Timeout, -+ IN OUT EFI_PARITY_TYPE *Parity, -+ IN OUT UINT8 *DataBits, -+ IN OUT EFI_STOP_BITS_TYPE *StopBits -+ ) -+{ -+ return RETURN_UNSUPPORTED; -+} -diff --git a/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -new file mode 100644 -index 0000000000..8b506f9020 ---- /dev/null -+++ b/OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -@@ -0,0 +1,34 @@ -+## @file -+# Serial Port Library backed by the QEMU debug console (I/O port 0x402). -+# -+# This library instance implements SerialPortLib by writing bytes to the -+# I/O port configured via PcdDebugIoPort. It can be used together with -+# BaseDebugLibSerialPort to route DEBUG() output to the QEMU debug console. -+# -+# Copyright (c) 2024, Intel Corporation. All rights reserved.
-+# SPDX-License-Identifier: BSD-2-Clause-Patent -+# -+## -+ -+[Defines] -+ INF_VERSION = 0x00010005 -+ BASE_NAME = BaseSerialPortLibDebugCon -+ FILE_GUID = 53A6F6C9-3297-4A36-95E0-68C5D2A4EA1F -+ MODULE_TYPE = BASE -+ VERSION_STRING = 1.0 -+ LIBRARY_CLASS = SerialPortLib -+ -+[Sources] -+ BaseSerialPortLibDebugCon.c -+ -+[Packages] -+ MdePkg/MdePkg.dec -+ OvmfPkg/OvmfPkg.dec -+ -+[LibraryClasses] -+ BaseLib -+ IoLib -+ PcdLib -+ -+[Pcd] -+ gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES -diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c -index d9f61757cf..cbf844df21 100644 ---- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c -+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c -@@ -2020,6 +2020,12 @@ PlatformBootManagerUnableToBoot ( - EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu; - UINTN Index; - -+ DEBUG (( -+ DEBUG_ERROR, -+ "%a: No bootable option or device was found. Falling back to Boot Manager Menu / EFI Shell.\n", -+ gEfiCallerBaseName -+ )); -+ - if (FeaturePcdGet (PcdBootRestrictToFirmware)) { - AsciiPrint ( - "%a: No bootable option was found.\n", -@@ -2034,6 +2040,12 @@ PlatformBootManagerUnableToBoot ( - // - Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu); - if (EFI_ERROR (Status)) { -+ DEBUG (( -+ DEBUG_ERROR, -+ "%a: Boot Manager Menu unavailable (Status = %r). System halted.\n", -+ gEfiCallerBaseName, -+ Status -+ )); - return; - } - -@@ -2066,6 +2078,12 @@ PlatformBootManagerUnableToBoot ( - } - } - -+ DEBUG (( -+ DEBUG_ERROR, -+ "%a: Entering Boot Manager Menu loop.\n", -+ gEfiCallerBaseName -+ )); -+ - for ( ; ;) { - EfiBootManagerBoot (&BootManagerMenu); - } -diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc -index 7ab6af3a69..b986ab13b5 100644 ---- a/OvmfPkg/OvmfPkgIa32.dsc -+++ b/OvmfPkg/OvmfPkgIa32.dsc -@@ -165,7 +165,11 @@ - CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf - OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf -+!ifdef $(DEBUG_ON_SERIAL_PORT) - SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf -+!else -+ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -+!endif - MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf - MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf - CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf -diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc -index e7fff78df9..a2535b548a 100644 ---- a/OvmfPkg/OvmfPkgIa32X64.dsc -+++ b/OvmfPkg/OvmfPkgIa32X64.dsc -@@ -170,7 +170,11 @@ - CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf - OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf -+!ifdef $(DEBUG_ON_SERIAL_PORT) - SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf -+!else -+ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -+!endif - MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf - MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf - CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf -diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc -index 556984bdaa..51e8fe2789 100644 ---- a/OvmfPkg/OvmfPkgX64.dsc -+++ b/OvmfPkg/OvmfPkgX64.dsc -@@ -182,7 +182,11 @@ - PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf - OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf -+!ifdef $(DEBUG_ON_SERIAL_PORT) - SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf -+!else -+ SerialPortLib|OvmfPkg/Library/BaseSerialPortLibDebugCon/BaseSerialPortLibDebugCon.inf -+!endif - MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf - MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf - CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 6858e6095c..ed80f0d4f5 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -75,7 +75,7 @@ shell: - | cd /src - echo "12345678" + echo "123456789" echo "Git clone Edk2 repository..." git clone \ From 820b2cdd5e321ac46e457da5f0fe803f347cfb6a Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 8 Apr 2026 10:01:41 +0300 Subject: [PATCH 06/27] t Signed-off-by: Valeriy Khorunzhin --- images/virt-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index b5c41855d3..9516a63b35 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek2" + echo "kek23" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From d0d8884f67862e46af1bed0571be918450362032 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 8 Apr 2026 11:26:03 +0300 Subject: [PATCH 07/27] prerefactor Signed-off-by: Valeriy Khorunzhin --- api/core/v1alpha2/vmcondition/condition.go | 1 + .../pkg/controller/vm/internal/lifecycle.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/api/core/v1alpha2/vmcondition/condition.go b/api/core/v1alpha2/vmcondition/condition.go index 6abfecbe0c..0a7554ea0f 100644 --- a/api/core/v1alpha2/vmcondition/condition.go +++ b/api/core/v1alpha2/vmcondition/condition.go @@ -172,6 +172,7 @@ const ( ReasonPodTerminating RunningReason = "PodTerminating" ReasonPodNotFound RunningReason = "PodNotFound" ReasonPodConditionMissing RunningReason = "PodConditionMissing" + ReasonBootFailed RunningReason = "BootFailed" ReasonGuestNotRunning RunningReason = "GuestNotRunning" ) diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go b/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go index 4f694654c0..d5f921c06e 100644 --- a/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go +++ b/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go @@ -206,6 +206,14 @@ func (h *LifeCycleHandler) syncRunning(ctx context.Context, vm *v1alpha2.Virtual if kvvmi != nil && vm.Status.Phase != v1alpha2.MachineStopped { vm.Status.Node = kvvmi.Status.NodeName + for _, c := range kvvmi.Status.Conditions { + if string(c.Type) == "BootFailed" { + cb.Reason(vmcondition.ReasonBootFailed).Status(metav1.ConditionFalse).Message(c.Reason) + conditions.SetCondition(cb, &vm.Status.Conditions) + return + } + } + if vm.Status.Phase == v1alpha2.MachineRunning { cb.Reason(vmcondition.ReasonVirtualMachineRunning).Status(metav1.ConditionTrue) conditions.SetCondition(cb, &vm.Status.Conditions) From a281afeb205453e1202876e1dd6445166ee29055 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 9 Apr 2026 10:32:37 +0300 Subject: [PATCH 08/27] build files refactoring Signed-off-by: Valeriy Khorunzhin --- ...atch => 001-isa-debug-port-no-bootable-device-message.patch} | 0 images/edk2/patches/README.md | 2 ++ images/edk2/werf.inc.yaml | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) rename images/edk2/patches/{0001-0x402.patch => 001-isa-debug-port-no-bootable-device-message.patch} (100%) create mode 100644 images/edk2/patches/README.md diff --git a/images/edk2/patches/0001-0x402.patch b/images/edk2/patches/001-isa-debug-port-no-bootable-device-message.patch similarity index 100% rename from images/edk2/patches/0001-0x402.patch rename to images/edk2/patches/001-isa-debug-port-no-bootable-device-message.patch diff --git a/images/edk2/patches/README.md b/images/edk2/patches/README.md new file mode 100644 index 0000000000..d67a2993ca --- /dev/null +++ b/images/edk2/patches/README.md @@ -0,0 +1,2 @@ +# 001-isa-debug-port-no-bootable-device-message.patch +If an EFI “No bootable device” error occurs, or the system drops into the EFI shell, output “No bootable device.” to the ISA debug port. \ No newline at end of file diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index ed80f0d4f5..686a9d016f 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -75,8 +75,6 @@ shell: - | cd /src - echo "123456789" - echo "Git clone Edk2 repository..." git clone \ --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} \ From 79b93986472177621497ae7a692d2a1688ba1262 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Mon, 13 Apr 2026 16:27:32 +0300 Subject: [PATCH 09/27] 403 Signed-off-by: Valeriy Khorunzhin --- ...atch => 001-debug-device-no-bootable-device-message.patch} | 4 ++-- images/edk2/patches/README.md | 2 +- images/edk2/werf.inc.yaml | 2 ++ images/virt-artifact/werf.inc.yaml | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) rename images/edk2/patches/{001-isa-debug-port-no-bootable-device-message.patch => 001-debug-device-no-bootable-device-message.patch} (93%) diff --git a/images/edk2/patches/001-isa-debug-port-no-bootable-device-message.patch b/images/edk2/patches/001-debug-device-no-bootable-device-message.patch similarity index 93% rename from images/edk2/patches/001-isa-debug-port-no-bootable-device-message.patch rename to images/edk2/patches/001-debug-device-no-bootable-device-message.patch index c87c0b0da3..ada524a888 100644 --- a/images/edk2/patches/001-isa-debug-port-no-bootable-device-message.patch +++ b/images/edk2/patches/001-debug-device-no-bootable-device-message.patch @@ -10,7 +10,7 @@ index d9f61757cf..d2a0e5f6a1 100644 + STATIC CONST CHAR8 Msg[] = "No bootable device.\r\n"; + UINTN i; + for (i = 0; i < sizeof (Msg) - 1; i++) { -+ IoWrite8 (0x402, (UINT8)Msg[i]); ++ IoWrite8 (0x403, (UINT8)Msg[i]); + } + } + @@ -29,7 +29,7 @@ index 9bacf9d8c7..ea78559516 100644 + STATIC CONST CHAR8 Msg[] = "No bootable device.\r\n"; + UINTN i; + for (i = 0; i < sizeof (Msg) - 1; i++) { -+ IoWrite8 (0x402, (UINT8)Msg[i]); ++ IoWrite8 (0x403, (UINT8)Msg[i]); + } + } + diff --git a/images/edk2/patches/README.md b/images/edk2/patches/README.md index d67a2993ca..8d1720d23a 100644 --- a/images/edk2/patches/README.md +++ b/images/edk2/patches/README.md @@ -1,2 +1,2 @@ # 001-isa-debug-port-no-bootable-device-message.patch -If an EFI “No bootable device” error occurs, or the system drops into the EFI shell, output “No bootable device.” to the ISA debug port. \ No newline at end of file +If an EFI “No bootable device” error occurs, or the system drops into the EFI shell, output “No bootable device.” to the debug device at address 0x403. \ No newline at end of file diff --git a/images/edk2/werf.inc.yaml b/images/edk2/werf.inc.yaml index 686a9d016f..7793c69d27 100644 --- a/images/edk2/werf.inc.yaml +++ b/images/edk2/werf.inc.yaml @@ -75,6 +75,8 @@ shell: - | cd /src + echo "kek231" + echo "Git clone Edk2 repository..." git clone \ --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} \ diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 9516a63b35..76d3b8243a 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek23" + echo "kek231" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From 1dcbad09b50593e24def0c1dac0981759b890811 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 12:56:24 +0300 Subject: [PATCH 10/27] seabios patch Signed-off-by: Valeriy Khorunzhin --- ...ebug-port-no-bootable-device-message.patch | 38 +++++++++++++++++++ images/qemu/patches/seabios/README.md | 2 + images/qemu/werf.inc.yaml | 8 ++++ 3 files changed, 48 insertions(+) create mode 100644 images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch create mode 100644 images/qemu/patches/seabios/README.md diff --git a/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch b/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch new file mode 100644 index 0000000000..dac272bddf --- /dev/null +++ b/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch @@ -0,0 +1,38 @@ +diff --git a/src/boot.c b/src/boot.c +index 1effd80..ec5992f 100644 +--- a/src/boot.c ++++ b/src/boot.c +@@ -21,6 +21,7 @@ + #include "string.h" // memset + #include "util.h" // irqtimer_calc + #include "tcgbios.h" // tpm_* ++#include "x86.h" // outb + + /**************************************************************** + * Helper search functions +@@ -960,12 +961,23 @@ boot_rom(u32 vector) + } + + // Unable to find bootable device - warn user and eventually retry. ++static void ++write_port_403(const char *s) ++{ ++ if (!CONFIG_DEBUG_IO || !runningOnQEMU()) ++ return; ++ ++ for (; *s; s++) ++ outb(*s, 0x403); ++} ++ + static void + boot_fail(void) + { +- if (BootRetryTime == (u32)-1) ++ if (BootRetryTime == (u32)-1) { + printf("No bootable device.\n"); +- else ++ write_port_403("No bootable device.\n"); ++ } else + printf("No bootable device. Retrying in %d seconds.\n" + , BootRetryTime/1000); + // Wait for 'BootRetryTime' milliseconds and then reboot. diff --git a/images/qemu/patches/seabios/README.md b/images/qemu/patches/seabios/README.md new file mode 100644 index 0000000000..b53c22887f --- /dev/null +++ b/images/qemu/patches/seabios/README.md @@ -0,0 +1,2 @@ +# 001-isa-debug-port-no-bootable-device-message.patch +If SeaBIOS cannot find a bootable device, output "No bootable device." to the debug device at address 0x403 in addition to the normal console message. diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 019a5f5d58..5ab2605ff1 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -62,6 +62,14 @@ shell: fi + echo "Apply SeaBIOS patches" + for p in /patches/seabios/*.patch ; do + [ -f "$p" ] || continue + git -C roms/seabios apply --check --ignore-space-change --ignore-whitespace "$p" >/dev/null 2>&1 || continue + echo -n "Apply ${p} to roms/seabios ... " + git -C roms/seabios apply --ignore-space-change --ignore-whitespace "$p" && echo OK || (echo FAIL ; exit 1) + done + --- {{- $name := print $.ImageName "-dependencies" -}} {{- define "$name" -}} From 5758e5a3bf8cfedd22ba6b7172f97a241a5e736a Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 18:47:44 +0300 Subject: [PATCH 11/27] bios2 Signed-off-by: Valeriy Khorunzhin --- ...001-isa-debug-port-no-bootable-device-message.patch | 10 ++++++---- images/qemu/werf.inc.yaml | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch b/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch index dac272bddf..646242bdf3 100644 --- a/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch +++ b/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch @@ -1,5 +1,5 @@ diff --git a/src/boot.c b/src/boot.c -index 1effd80..ec5992f 100644 +index 1effd80..db9abb4 100644 --- a/src/boot.c +++ b/src/boot.c @@ -21,6 +21,7 @@ @@ -10,7 +10,7 @@ index 1effd80..ec5992f 100644 /**************************************************************** * Helper search functions -@@ -960,12 +961,23 @@ boot_rom(u32 vector) +@@ -960,12 +961,24 @@ boot_rom(u32 vector) } // Unable to find bootable device - warn user and eventually retry. @@ -28,9 +28,11 @@ index 1effd80..ec5992f 100644 boot_fail(void) { - if (BootRetryTime == (u32)-1) -+ if (BootRetryTime == (u32)-1) { - printf("No bootable device.\n"); +- printf("No bootable device.\n"); - else ++ if (BootRetryTime == (u32)-1) { ++ printf("No bootable device123.\n"); ++ printf("Kek\n"); + write_port_403("No bootable device.\n"); + } else printf("No bootable device. Retrying in %d seconds.\n" diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 5ab2605ff1..7143856e26 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -35,6 +35,8 @@ shell: mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $version }} /src/{{ $gitRepoName }}-{{ $version }} + echo "1" + cd /src/{{ $gitRepoName }}-{{ $version }} if [[ "$(cat /run/secrets/SOURCE_REPO)" =~ "github.com" ]] ; then From 2641372de79dbdbfc5682c0eadbcc2bc500e0f43 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 22:07:15 +0300 Subject: [PATCH 12/27] try patch Signed-off-by: Valeriy Khorunzhin --- images/qemu/werf.inc.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 7143856e26..d27ba1d289 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -35,7 +35,7 @@ shell: mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $version }} /src/{{ $gitRepoName }}-{{ $version }} - echo "1" + echo "12" cd /src/{{ $gitRepoName }}-{{ $version }} @@ -359,6 +359,23 @@ shell: setup: - | + cd /{{ $gitRepoName }}-{{ $version }} + + echo "Building patched SeaBIOS..." + for cfg in roms/config.seabios-256k roms/config.seabios-128k ; do + variant=$(echo "$cfg" | grep -oP '\d+k') + make -C roms/seabios distclean + cp "$cfg" roms/seabios/.config + make -C roms/seabios oldnoconfig + make -C roms/seabios -j$(nproc) + if [ "$variant" = "256k" ]; then + cp roms/seabios/out/bios.bin pc-bios/bios-256k.bin + else + cp roms/seabios/out/bios.bin pc-bios/bios.bin + fi + echo "Built SeaBIOS ${variant} from patched source" + done + /install-qemu.sh --version-num "{{ $version }}" \ -s /{{ $gitRepoName }}-{{ $version }} \ -d /BINS \ From c3bd6c5d321cbab477c5415b2677c80117101168 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 22:18:25 +0300 Subject: [PATCH 13/27] try patch 2 Signed-off-by: Valeriy Khorunzhin --- images/qemu/werf.inc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index d27ba1d289..a88b08df5d 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -362,6 +362,7 @@ shell: cd /{{ $gitRepoName }}-{{ $version }} echo "Building patched SeaBIOS..." + ln -sf /usr/bin/python3 /usr/bin/python for cfg in roms/config.seabios-256k roms/config.seabios-128k ; do variant=$(echo "$cfg" | grep -oP '\d+k') make -C roms/seabios distclean From 5752f2d31c2893c135dc8cd0ff865ac6ced6c1aa Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:21:29 +0300 Subject: [PATCH 14/27] try patch 3 Signed-off-by: Valeriy Khorunzhin --- images/qemu/werf.inc.yaml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index a88b08df5d..c90d2bf859 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -363,19 +363,17 @@ shell: echo "Building patched SeaBIOS..." ln -sf /usr/bin/python3 /usr/bin/python - for cfg in roms/config.seabios-256k roms/config.seabios-128k ; do - variant=$(echo "$cfg" | grep -oP '\d+k') - make -C roms/seabios distclean - cp "$cfg" roms/seabios/.config - make -C roms/seabios oldnoconfig - make -C roms/seabios -j$(nproc) - if [ "$variant" = "256k" ]; then - cp roms/seabios/out/bios.bin pc-bios/bios-256k.bin - else - cp roms/seabios/out/bios.bin pc-bios/bios.bin - fi - echo "Built SeaBIOS ${variant} from patched source" - done + + python3 -c " + p = 'roms/seabios/scripts/layoutrom.py' + t = open(p).read() + t = t.replace( + 'relocsection = sectionmap[sectionname]', + 'relocsection = sectionmap.get(sectionname)\n if relocsection is None:\n state = None\n continue') + open(p, 'w').write(t) + " + + make -C roms bios -j$(nproc) /install-qemu.sh --version-num "{{ $version }}" \ -s /{{ $gitRepoName }}-{{ $version }} \ From b6627b33fb2007c1eb55bd702df59375d5278a76 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:26:49 +0300 Subject: [PATCH 15/27] pppatch Signed-off-by: Valeriy Khorunzhin --- images/qemu/werf.inc.yaml | 47 ++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index c90d2bf859..0a79274174 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -364,14 +364,45 @@ shell: echo "Building patched SeaBIOS..." ln -sf /usr/bin/python3 /usr/bin/python - python3 -c " - p = 'roms/seabios/scripts/layoutrom.py' - t = open(p).read() - t = t.replace( - 'relocsection = sectionmap[sectionname]', - 'relocsection = sectionmap.get(sectionname)\n if relocsection is None:\n state = None\n continue') - open(p, 'w').write(t) - " + python3 - <<'PY' + from pathlib import Path + + p = Path("roms/seabios/scripts/layoutrom.py") + t = p.read_text() + + replacements = { + "relocsection = sectionmap[sectionname]": """relocsection = sectionmap.get(sectionname) + if relocsection is None: + state = None + continue""", + """ pending = list(anchorsections) + while pending: + section = pending.pop() + for reloc in section.relocs:""": """ pending = [section for section in anchorsections if section is not None] + while pending: + section = pending.pop() + if section is None or section.relocs is None: + continue + for reloc in section.relocs:""", + """ nextsection = reloc.symbol.section + if nextsection not in anchorsections:""": """ nextsection = reloc.symbol.section + if nextsection is None: + continue + if nextsection not in anchorsections:""", + """ anchorsections = [entrysym.section] + [ + section for section in allsections + if section.name.startswith('.fixedaddr.')]""": """ anchorsections = [section for section in ([entrysym.section if entrysym is not None else None] + [ + section for section in allsections + if section.name.startswith('.fixedaddr.')]) if section is not None]""", + } + + for old, new in replacements.items(): + if old not in t: + raise SystemExit(f"Expected snippet not found in {p}: {old!r}") + t = t.replace(old, new, 1) + + p.write_text(t) + PY make -C roms bios -j$(nproc) From a5d5ee77f2f04de785603e05ca4472f07dfd5670 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:31:09 +0300 Subject: [PATCH 16/27] patch)))) Signed-off-by: Valeriy Khorunzhin --- images/qemu/werf.inc.yaml | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 0a79274174..80efcda6b1 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -375,25 +375,15 @@ shell: if relocsection is None: state = None continue""", - """ pending = list(anchorsections) - while pending: - section = pending.pop() - for reloc in section.relocs:""": """ pending = [section for section in anchorsections if section is not None] - while pending: - section = pending.pop() - if section is None or section.relocs is None: + " pending = list(anchorsections)": " pending = [section for section in anchorsections if section is not None]", + " for reloc in section.relocs:": """ if section is None or section.relocs is None: continue for reloc in section.relocs:""", - """ nextsection = reloc.symbol.section - if nextsection not in anchorsections:""": """ nextsection = reloc.symbol.section - if nextsection is None: + " if nextsection not in anchorsections:": """ if nextsection is None: continue if nextsection not in anchorsections:""", - """ anchorsections = [entrysym.section] + [ - section for section in allsections - if section.name.startswith('.fixedaddr.')]""": """ anchorsections = [section for section in ([entrysym.section if entrysym is not None else None] + [ - section for section in allsections - if section.name.startswith('.fixedaddr.')]) if section is not None]""", + " keepsections = findReachable(anchorsections, checkKeep, symbols)": """ anchorsections = [section for section in anchorsections if section is not None] + keepsections = findReachable(anchorsections, checkKeep, symbols)""", } for old, new in replacements.items(): From db8a024e49abf73287872ef10d7318b2281b93ee Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:38:21 +0300 Subject: [PATCH 17/27] pppatch Signed-off-by: Valeriy Khorunzhin --- ...02-layoutrom-handle-missing-sections.patch | 46 +++++++++++++++++++ images/qemu/patches/seabios/README.md | 3 ++ images/qemu/werf.inc.yaml | 30 ------------ 3 files changed, 49 insertions(+), 30 deletions(-) create mode 100644 images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch diff --git a/images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch b/images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch new file mode 100644 index 0000000000..6847ae62b4 --- /dev/null +++ b/images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch @@ -0,0 +1,46 @@ +diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py +index dd2c9ef..f09ec55 100644 +--- a/scripts/layoutrom.py ++++ b/scripts/layoutrom.py +@@ -460,13 +460,18 @@ def findReachable(anchorsections, checkreloc, data): + def findReachable(anchorsections, checkreloc, data): + anchorsections = dict([(section, []) for section in anchorsections]) + pending = list(anchorsections) + while pending: + section = pending.pop() ++ if section is None or section.relocs is None: ++ continue + for reloc in section.relocs: + chain = anchorsections[section] + [section.name] + if not checkreloc(reloc, section, data, chain): + continue + nextsection = reloc.symbol.section ++ if nextsection is None: ++ continue + if nextsection not in anchorsections: + anchorsections[nextsection] = chain + pending.append(nextsection) + return anchorsections +@@ -555,7 +560,10 @@ def parseObjDump(file, fileid): + state = None + continue + state = 'reloc' +- relocsection = sectionmap[sectionname] ++ relocsection = sectionmap.get(sectionname) ++ if relocsection is None: ++ state = None ++ continue + continue + + if state == 'section': +@@ -660,10 +668,11 @@ else: + entrysym = symbols['16'].get('entry_csm') + else: + entrysym = symbols['16'].get('reset_vector') +-anchorsections = [entrysym.section] + [ ++anchorsections = [entrysym.section] + [ + section for section in allsections + if section.name.startswith('.fixedaddr.')] ++anchorsections = [section for section in anchorsections if section is not None] + keepsections = findReachable(anchorsections, checkKeep, symbols) + sections = [section for section in allsections if section in keepsections] diff --git a/images/qemu/patches/seabios/README.md b/images/qemu/patches/seabios/README.md index b53c22887f..37a373478f 100644 --- a/images/qemu/patches/seabios/README.md +++ b/images/qemu/patches/seabios/README.md @@ -1,2 +1,5 @@ # 001-isa-debug-port-no-bootable-device-message.patch If SeaBIOS cannot find a bootable device, output "No bootable device." to the debug device at address 0x403 in addition to the normal console message. + +# 002-layoutrom-handle-missing-sections.patch +Teach `layoutrom.py` to skip relocations and anchor sections that are absent in `objdump` output from newer toolchains so `make -C roms bios` can finish successfully. diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 80efcda6b1..fbee31fc9a 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -364,36 +364,6 @@ shell: echo "Building patched SeaBIOS..." ln -sf /usr/bin/python3 /usr/bin/python - python3 - <<'PY' - from pathlib import Path - - p = Path("roms/seabios/scripts/layoutrom.py") - t = p.read_text() - - replacements = { - "relocsection = sectionmap[sectionname]": """relocsection = sectionmap.get(sectionname) - if relocsection is None: - state = None - continue""", - " pending = list(anchorsections)": " pending = [section for section in anchorsections if section is not None]", - " for reloc in section.relocs:": """ if section is None or section.relocs is None: - continue - for reloc in section.relocs:""", - " if nextsection not in anchorsections:": """ if nextsection is None: - continue - if nextsection not in anchorsections:""", - " keepsections = findReachable(anchorsections, checkKeep, symbols)": """ anchorsections = [section for section in anchorsections if section is not None] - keepsections = findReachable(anchorsections, checkKeep, symbols)""", - } - - for old, new in replacements.items(): - if old not in t: - raise SystemExit(f"Expected snippet not found in {p}: {old!r}") - t = t.replace(old, new, 1) - - p.write_text(t) - PY - make -C roms bios -j$(nproc) /install-qemu.sh --version-num "{{ $version }}" \ From 0325af58b6350d723b390979bb5d42b221844a4b Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 17:53:26 +0300 Subject: [PATCH 18/27] patch Signed-off-by: Valeriy Khorunzhin --- ...kip-flags-when-parse-objdump-section.patch | 13 ++++++ ...bug-port-no-bootable-device-message.patch} | 3 +- ...02-layoutrom-handle-missing-sections.patch | 46 ------------------- images/qemu/patches/seabios/README.md | 14 ++++-- images/qemu/werf.inc.yaml | 29 +++++------- 5 files changed, 35 insertions(+), 70 deletions(-) create mode 100644 images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch rename images/qemu/patches/seabios/{001-isa-debug-port-no-bootable-device-message.patch => 002-0x403-debug-port-no-bootable-device-message.patch} (93%) delete mode 100644 images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch diff --git a/images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch b/images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch new file mode 100644 index 0000000000..815c5fc7a1 --- /dev/null +++ b/images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch @@ -0,0 +1,13 @@ +diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py +index 6616721..4f655dc 100755 +--- a/scripts/layoutrom.py ++++ b/scripts/layoutrom.py +@@ -564,7 +564,7 @@ def parseObjDump(file, fileid): + + if state == 'section': + try: +- idx, name, size, vma, lma, fileoff, align = line.split() ++ idx, name, size, vma, lma, fileoff, align, *_flags = line.split() + if align[:3] != '2**': + continue + section = Section() diff --git a/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch b/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch similarity index 93% rename from images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch rename to images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch index 646242bdf3..136ea43c87 100644 --- a/images/qemu/patches/seabios/001-isa-debug-port-no-bootable-device-message.patch +++ b/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch @@ -31,8 +31,7 @@ index 1effd80..db9abb4 100644 - printf("No bootable device.\n"); - else + if (BootRetryTime == (u32)-1) { -+ printf("No bootable device123.\n"); -+ printf("Kek\n"); ++ printf("No bootable device.\n"); + write_port_403("No bootable device.\n"); + } else printf("No bootable device. Retrying in %d seconds.\n" diff --git a/images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch b/images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch deleted file mode 100644 index 6847ae62b4..0000000000 --- a/images/qemu/patches/seabios/002-layoutrom-handle-missing-sections.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py -index dd2c9ef..f09ec55 100644 ---- a/scripts/layoutrom.py -+++ b/scripts/layoutrom.py -@@ -460,13 +460,18 @@ def findReachable(anchorsections, checkreloc, data): - def findReachable(anchorsections, checkreloc, data): - anchorsections = dict([(section, []) for section in anchorsections]) - pending = list(anchorsections) - while pending: - section = pending.pop() -+ if section is None or section.relocs is None: -+ continue - for reloc in section.relocs: - chain = anchorsections[section] + [section.name] - if not checkreloc(reloc, section, data, chain): - continue - nextsection = reloc.symbol.section -+ if nextsection is None: -+ continue - if nextsection not in anchorsections: - anchorsections[nextsection] = chain - pending.append(nextsection) - return anchorsections -@@ -555,7 +560,10 @@ def parseObjDump(file, fileid): - state = None - continue - state = 'reloc' -- relocsection = sectionmap[sectionname] -+ relocsection = sectionmap.get(sectionname) -+ if relocsection is None: -+ state = None -+ continue - continue - - if state == 'section': -@@ -660,10 +668,11 @@ else: - entrysym = symbols['16'].get('entry_csm') - else: - entrysym = symbols['16'].get('reset_vector') --anchorsections = [entrysym.section] + [ -+anchorsections = [entrysym.section] + [ - section for section in allsections - if section.name.startswith('.fixedaddr.')] -+anchorsections = [section for section in anchorsections if section is not None] - keepsections = findReachable(anchorsections, checkKeep, symbols) - sections = [section for section in allsections if section in keepsections] diff --git a/images/qemu/patches/seabios/README.md b/images/qemu/patches/seabios/README.md index 37a373478f..7829f2be27 100644 --- a/images/qemu/patches/seabios/README.md +++ b/images/qemu/patches/seabios/README.md @@ -1,5 +1,11 @@ -# 001-isa-debug-port-no-bootable-device-message.patch -If SeaBIOS cannot find a bootable device, output "No bootable device." to the debug device at address 0x403 in addition to the normal console message. +# Patches -# 002-layoutrom-handle-missing-sections.patch -Teach `layoutrom.py` to skip relocations and anchor sections that are absent in `objdump` output from newer toolchains so `make -C roms bios` can finish successfully. +## 001-alt-skip-flags-when-parse-objdump-section.patch + +This patch makes `scripts/layoutrom.py` tolerate extra flags in `objdump` +section output. + +## 002-0x403-debug-port-no-bootable-device-message.patch + +If SeaBIOS cannot find a bootable device on QEMU, this patch also outputs +`No bootable device.` to the debug device at address `0x403`. diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index fbee31fc9a..11563d26c4 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -35,8 +35,6 @@ shell: mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $version }} /src/{{ $gitRepoName }}-{{ $version }} - echo "12" - cd /src/{{ $gitRepoName }}-{{ $version }} if [[ "$(cat /run/secrets/SOURCE_REPO)" =~ "github.com" ]] ; then @@ -64,14 +62,6 @@ shell: fi - echo "Apply SeaBIOS patches" - for p in /patches/seabios/*.patch ; do - [ -f "$p" ] || continue - git -C roms/seabios apply --check --ignore-space-change --ignore-whitespace "$p" >/dev/null 2>&1 || continue - echo -n "Apply ${p} to roms/seabios ... " - git -C roms/seabios apply --ignore-space-change --ignore-whitespace "$p" && echo OK || (echo FAIL ; exit 1) - done - --- {{- $name := print $.ImageName "-dependencies" -}} {{- define "$name" -}} @@ -211,6 +201,17 @@ shell: cd /{{ $gitRepoName }}-{{ $version }} + echo "Apply SeaBIOS patches" + for p in /patches/seabios/*.patch ; do + [ -f "$p" ] || continue + git -C roms/seabios apply --check --ignore-space-change --ignore-whitespace "$p" >/dev/null 2>&1 || (echo "FAIL" ; exit 1) + echo -n "Apply ${p} to roms/seabios ... " + git -C roms/seabios apply --ignore-space-change --ignore-whitespace "$p" && echo OK || (echo FAIL ; exit 1) + done + + echo "Building patched SeaBIOS..." + make -C roms bios V=1 PYTHON=python3 HOSTCC=gcc -j$(nproc) + for p in /patches/*.patch ; do echo -n "Apply ${p} ... " git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1) @@ -356,16 +357,8 @@ shell: {{- $_ := set $ "ProjectName" (list $.ImageName "qemu" | join "/") }} {{- include "image-build.build" (set $ "BuildCommand" `make -j$(nproc)`) | nindent 6 }} - setup: - | - cd /{{ $gitRepoName }}-{{ $version }} - - echo "Building patched SeaBIOS..." - ln -sf /usr/bin/python3 /usr/bin/python - - make -C roms bios -j$(nproc) - /install-qemu.sh --version-num "{{ $version }}" \ -s /{{ $gitRepoName }}-{{ $version }} \ -d /BINS \ From dace6479325d4ca71fc7b786de8085770fcdc58a Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 18:10:31 +0300 Subject: [PATCH 19/27] move Signed-off-by: Valeriy Khorunzhin --- ...atch => 001-0x403-debug-port-no-bootable-device-message.patch} | 0 ....patch => 002-alt-skip-flags-when-parse-objdump-section.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename images/qemu/patches/seabios/{002-0x403-debug-port-no-bootable-device-message.patch => 001-0x403-debug-port-no-bootable-device-message.patch} (100%) rename images/qemu/patches/seabios/{001-alt-skip-flags-when-parse-objdump-section.patch => 002-alt-skip-flags-when-parse-objdump-section.patch} (100%) diff --git a/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch b/images/qemu/patches/seabios/001-0x403-debug-port-no-bootable-device-message.patch similarity index 100% rename from images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch rename to images/qemu/patches/seabios/001-0x403-debug-port-no-bootable-device-message.patch diff --git a/images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch b/images/qemu/patches/seabios/002-alt-skip-flags-when-parse-objdump-section.patch similarity index 100% rename from images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch rename to images/qemu/patches/seabios/002-alt-skip-flags-when-parse-objdump-section.patch From 195a7500c57a077ef8e46f7f4cc709c918e10eba Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 19:04:36 +0300 Subject: [PATCH 20/27] correct applying Signed-off-by: Valeriy Khorunzhin --- ...ch => 001-alt-skip-flags-when-parse-objdump-section.patch} | 0 ... => 002-0x403-debug-port-no-bootable-device-message.patch} | 0 images/qemu/werf.inc.yaml | 4 +++- 3 files changed, 3 insertions(+), 1 deletion(-) rename images/qemu/patches/seabios/{002-alt-skip-flags-when-parse-objdump-section.patch => 001-alt-skip-flags-when-parse-objdump-section.patch} (100%) rename images/qemu/patches/seabios/{001-0x403-debug-port-no-bootable-device-message.patch => 002-0x403-debug-port-no-bootable-device-message.patch} (100%) diff --git a/images/qemu/patches/seabios/002-alt-skip-flags-when-parse-objdump-section.patch b/images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch similarity index 100% rename from images/qemu/patches/seabios/002-alt-skip-flags-when-parse-objdump-section.patch rename to images/qemu/patches/seabios/001-alt-skip-flags-when-parse-objdump-section.patch diff --git a/images/qemu/patches/seabios/001-0x403-debug-port-no-bootable-device-message.patch b/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch similarity index 100% rename from images/qemu/patches/seabios/001-0x403-debug-port-no-bootable-device-message.patch rename to images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 11563d26c4..5ef5523655 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -199,7 +199,7 @@ shell: export LDFLAGS="-L/usr/lib64 -L/usr/lib" export CPPFLAGS="-I/usr/include" - cd /{{ $gitRepoName }}-{{ $version }} + cd /src/{{ $gitRepoName }}-{{ $version }} echo "Apply SeaBIOS patches" for p in /patches/seabios/*.patch ; do @@ -209,6 +209,8 @@ shell: git -C roms/seabios apply --ignore-space-change --ignore-whitespace "$p" && echo OK || (echo FAIL ; exit 1) done + cd /{{ $gitRepoName }}-{{ $version }} + echo "Building patched SeaBIOS..." make -C roms bios V=1 PYTHON=python3 HOSTCC=gcc -j$(nproc) From 06c8291c1ba5f5013885b6b12a50b31a1a0721c2 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 19:09:16 +0300 Subject: [PATCH 21/27] p Signed-off-by: Valeriy Khorunzhin --- images/qemu/werf.inc.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index 5ef5523655..d1a0a2e220 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -62,6 +62,14 @@ shell: fi + echo "Apply SeaBIOS patches" + for p in /patches/seabios/*.patch ; do + [ -f "$p" ] || continue + git -C roms/seabios apply --check --ignore-space-change --ignore-whitespace "$p" >/dev/null 2>&1 || (echo "FAIL" ; exit 1) + echo -n "Apply ${p} to roms/seabios ... " + git -C roms/seabios apply --ignore-space-change --ignore-whitespace "$p" && echo OK || (echo FAIL ; exit 1) + done + --- {{- $name := print $.ImageName "-dependencies" -}} {{- define "$name" -}} @@ -199,16 +207,6 @@ shell: export LDFLAGS="-L/usr/lib64 -L/usr/lib" export CPPFLAGS="-I/usr/include" - cd /src/{{ $gitRepoName }}-{{ $version }} - - echo "Apply SeaBIOS patches" - for p in /patches/seabios/*.patch ; do - [ -f "$p" ] || continue - git -C roms/seabios apply --check --ignore-space-change --ignore-whitespace "$p" >/dev/null 2>&1 || (echo "FAIL" ; exit 1) - echo -n "Apply ${p} to roms/seabios ... " - git -C roms/seabios apply --ignore-space-change --ignore-whitespace "$p" && echo OK || (echo FAIL ; exit 1) - done - cd /{{ $gitRepoName }}-{{ $version }} echo "Building patched SeaBIOS..." From a475cd36772efe8178331e7c1e1584c3073f1b61 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 16 Apr 2026 00:11:55 +0300 Subject: [PATCH 22/27] fix patch Signed-off-by: Valeriy Khorunzhin --- ...002-0x403-debug-port-no-bootable-device-message.patch | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch b/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch index 136ea43c87..dac272bddf 100644 --- a/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch +++ b/images/qemu/patches/seabios/002-0x403-debug-port-no-bootable-device-message.patch @@ -1,5 +1,5 @@ diff --git a/src/boot.c b/src/boot.c -index 1effd80..db9abb4 100644 +index 1effd80..ec5992f 100644 --- a/src/boot.c +++ b/src/boot.c @@ -21,6 +21,7 @@ @@ -10,7 +10,7 @@ index 1effd80..db9abb4 100644 /**************************************************************** * Helper search functions -@@ -960,12 +961,24 @@ boot_rom(u32 vector) +@@ -960,12 +961,23 @@ boot_rom(u32 vector) } // Unable to find bootable device - warn user and eventually retry. @@ -28,10 +28,9 @@ index 1effd80..db9abb4 100644 boot_fail(void) { - if (BootRetryTime == (u32)-1) -- printf("No bootable device.\n"); -- else + if (BootRetryTime == (u32)-1) { -+ printf("No bootable device.\n"); + printf("No bootable device.\n"); +- else + write_port_403("No bootable device.\n"); + } else printf("No bootable device. Retrying in %d seconds.\n" From 1b0b2f40959972f5e6c4d73abf7e817bbd924ab1 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 29 Apr 2026 11:26:45 +0300 Subject: [PATCH 23/27] qmp Signed-off-by: Valeriy Khorunzhin --- images/qemu/patches/002-no-bootable-qmp.patch | 130 ++++++++++++++++++ images/virt-artifact/werf.inc.yaml | 2 +- 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 images/qemu/patches/002-no-bootable-qmp.patch diff --git a/images/qemu/patches/002-no-bootable-qmp.patch b/images/qemu/patches/002-no-bootable-qmp.patch new file mode 100644 index 0000000000..a2cfda7032 --- /dev/null +++ b/images/qemu/patches/002-no-bootable-qmp.patch @@ -0,0 +1,130 @@ +diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c +index fdb04fe..bfb3daf 100644 +--- a/hw/char/debugcon.c ++++ b/hw/char/debugcon.c +@@ -26,6 +26,7 @@ + + #include "qemu/osdep.h" + #include "qapi/error.h" ++#include "qapi/qapi-events-control.h" + #include "qemu/module.h" + #include "chardev/char-fe.h" + #include "hw/isa/isa.h" +@@ -34,6 +35,7 @@ + #include "qom/object.h" + + #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon" ++#define DEBUGCON_NO_BOOTABLE_DEVICE "No bootable device." + OBJECT_DECLARE_SIMPLE_TYPE(ISADebugconState, ISA_DEBUGCON_DEVICE) + + //#define DEBUG_DEBUGCON +@@ -42,6 +44,9 @@ typedef struct DebugconState { + MemoryRegion io; + CharBackend chr; + uint32_t readback; ++ bool watch_no_bootable_device; ++ char match_buf[sizeof(DEBUGCON_NO_BOOTABLE_DEVICE) - 1]; ++ size_t match_len; + } DebugconState; + + struct ISADebugconState { +@@ -51,6 +56,27 @@ struct ISADebugconState { + DebugconState state; + }; + ++static void debugcon_maybe_emit_no_bootable_device(DebugconState *s, ++ unsigned char ch) ++{ ++ if (!s->watch_no_bootable_device) { ++ return; ++ } ++ ++ if (s->match_len < sizeof(s->match_buf)) { ++ s->match_buf[s->match_len++] = ch; ++ } else { ++ memmove(s->match_buf, s->match_buf + 1, sizeof(s->match_buf) - 1); ++ s->match_buf[sizeof(s->match_buf) - 1] = ch; ++ } ++ ++ if (s->match_len == sizeof(s->match_buf) && ++ memcmp(s->match_buf, DEBUGCON_NO_BOOTABLE_DEVICE, ++ sizeof(s->match_buf)) == 0) { ++ qapi_event_send_no_bootable_device(); ++ } ++} ++ + static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val, + unsigned width) + { +@@ -64,6 +90,7 @@ static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val, + /* XXX this blocks entire thread. Rewrite to use + * qemu_chr_fe_write and background I/O callbacks */ + qemu_chr_fe_write_all(&s->chr, &ch, 1); ++ debugcon_maybe_emit_no_bootable_device(s, ch); + } + + +@@ -112,6 +139,7 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp) + TYPE_ISA_DEBUGCON_DEVICE, 1); + memory_region_add_subregion(isa_address_space_io(d), + isa->iobase, &s->io); ++ s->watch_no_bootable_device = isa->iobase == 0x403; + } + + static Property debugcon_isa_properties[] = { +diff --git a/qapi/control.json b/qapi/control.json +index 336386f..2026992 100644 +--- a/qapi/control.json ++++ b/qapi/control.json +@@ -209,3 +209,13 @@ + '*pretty': 'bool', + 'chardev': 'str' + } } ++ ++## ++# @NO_BOOTABLE_DEVICE: ++# ++# Emitted when `isa-debugcon` at I/O port 0x403 receives the ++# string "No bootable device.". ++# ++# Since: 0.14 ++## ++{ 'event': 'NO_BOOTABLE_DEVICE' } +diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c +index 22957fa..76915c0 100644 +--- a/tests/qtest/qmp-test.c ++++ b/tests/qtest/qmp-test.c +@@ -337,6 +337,24 @@ static void test_qmp_missing_any_arg(void) + qtest_quit(qts); + } + ++static void test_qmp_no_bootable_device_event(void) ++{ ++ static const char trigger[] = "No bootable device."; ++ QTestState *qts; ++ size_t i; ++ ++ qts = qtest_initf("-nodefaults -machine q35 " ++ "-chardev null,id=debugcon " ++ "-device isa-debugcon,iobase=0x403,chardev=debugcon"); ++ ++ for (i = 0; i < sizeof(trigger) - 1; i++) { ++ qtest_outb(qts, 0x403, trigger[i]); ++ } ++ ++ qtest_qmp_eventwait(qts, "NO_BOOTABLE_DEVICE"); ++ qtest_quit(qts); ++} ++ + int main(int argc, char *argv[]) + { + g_test_init(&argc, &argv, NULL); +@@ -348,6 +366,8 @@ int main(int argc, char *argv[]) + #endif + qtest_add_func("qmp/preconfig", test_qmp_preconfig); + qtest_add_func("qmp/missing-any-arg", test_qmp_missing_any_arg); ++ qtest_add_func("qmp/no-bootable-device-event", ++ test_qmp_no_bootable_device_event); + + return g_test_run(); + } diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 76d3b8243a..ffc94de263 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek231" + echo "kek231d" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From 5228d6e9531021a80e10f07d885b52884093c26c Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 29 Apr 2026 12:58:33 +0300 Subject: [PATCH 24/27] d Signed-off-by: Valeriy Khorunzhin --- images/virt-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index ffc94de263..ff1c503794 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek231d" + echo "kek231dd" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From 46999e05ca65b10d6c7fea3738ec63bb04469956 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 29 Apr 2026 13:39:29 +0300 Subject: [PATCH 25/27] fix rebase Signed-off-by: Valeriy Khorunzhin --- .../pkg/controller/vm/internal/lifecycle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go b/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go index d5f921c06e..714522bf34 100644 --- a/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go +++ b/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go @@ -210,7 +210,7 @@ func (h *LifeCycleHandler) syncRunning(ctx context.Context, vm *v1alpha2.Virtual if string(c.Type) == "BootFailed" { cb.Reason(vmcondition.ReasonBootFailed).Status(metav1.ConditionFalse).Message(c.Reason) conditions.SetCondition(cb, &vm.Status.Conditions) - return + return nil } } From b06add28be968e535f48b6ebc3908bf1fc0b9102 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 29 Apr 2026 15:04:22 +0300 Subject: [PATCH 26/27] up Signed-off-by: Valeriy Khorunzhin --- images/virt-artifact/werf.inc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index ff1c503794..4aabf7723f 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek231dd" + echo "kek231ddd" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git From 0e8cfc58f5a84a42fbed6ce8deacd52e9f84c39e Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 29 Apr 2026 16:12:31 +0300 Subject: [PATCH 27/27] param Signed-off-by: Valeriy Khorunzhin --- images/qemu/patches/002-no-bootable-qmp.patch | 34 ++++++++++--------- images/virt-artifact/werf.inc.yaml | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/images/qemu/patches/002-no-bootable-qmp.patch b/images/qemu/patches/002-no-bootable-qmp.patch index a2cfda7032..96f96da8b5 100644 --- a/images/qemu/patches/002-no-bootable-qmp.patch +++ b/images/qemu/patches/002-no-bootable-qmp.patch @@ -1,5 +1,5 @@ diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c -index fdb04fe..bfb3daf 100644 +index fdb04fe..0cf2325 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -26,6 +26,7 @@ @@ -64,16 +64,17 @@ index fdb04fe..bfb3daf 100644 } -@@ -112,6 +139,7 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp) - TYPE_ISA_DEBUGCON_DEVICE, 1); - memory_region_add_subregion(isa_address_space_io(d), - isa->iobase, &s->io); -+ s->watch_no_bootable_device = isa->iobase == 0x403; - } +@@ -118,6 +145,8 @@ static Property debugcon_isa_properties[] = { + DEFINE_PROP_UINT32("iobase", ISADebugconState, iobase, 0xe9), + DEFINE_PROP_CHR("chardev", ISADebugconState, state.chr), + DEFINE_PROP_UINT32("readback", ISADebugconState, state.readback, 0xe9), ++ DEFINE_PROP_BOOL("watch-no-bootable", ISADebugconState, ++ state.watch_no_bootable_device, false), + DEFINE_PROP_END_OF_LIST(), + }; - static Property debugcon_isa_properties[] = { diff --git a/qapi/control.json b/qapi/control.json -index 336386f..2026992 100644 +index 336386f..e1e727e 100644 --- a/qapi/control.json +++ b/qapi/control.json @@ -209,3 +209,13 @@ @@ -84,17 +85,17 @@ index 336386f..2026992 100644 +## +# @NO_BOOTABLE_DEVICE: +# -+# Emitted when `isa-debugcon` at I/O port 0x403 receives the -+# string "No bootable device.". ++# Emitted when `isa-debugcon` with enabled no-bootable watching ++# receives the string "No bootable device.". +# +# Since: 0.14 +## +{ 'event': 'NO_BOOTABLE_DEVICE' } diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c -index 22957fa..76915c0 100644 +index 22957fa..9b4840e 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c -@@ -337,6 +337,24 @@ static void test_qmp_missing_any_arg(void) +@@ -337,6 +337,25 @@ static void test_qmp_missing_any_arg(void) qtest_quit(qts); } @@ -106,10 +107,11 @@ index 22957fa..76915c0 100644 + + qts = qtest_initf("-nodefaults -machine q35 " + "-chardev null,id=debugcon " -+ "-device isa-debugcon,iobase=0x403,chardev=debugcon"); ++ "-device isa-debugcon,iobase=0x402,chardev=debugcon," ++ "watch-no-bootable=on"); + + for (i = 0; i < sizeof(trigger) - 1; i++) { -+ qtest_outb(qts, 0x403, trigger[i]); ++ qtest_outb(qts, 0x402, trigger[i]); + } + + qtest_qmp_eventwait(qts, "NO_BOOTABLE_DEVICE"); @@ -119,7 +121,7 @@ index 22957fa..76915c0 100644 int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); -@@ -348,6 +366,8 @@ int main(int argc, char *argv[]) +@@ -348,6 +367,8 @@ int main(int argc, char *argv[]) #endif qtest_add_func("qmp/preconfig", test_qmp_preconfig); qtest_add_func("qmp/missing-any-arg", test_qmp_missing_any_arg); diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 4aabf7723f..2fe6d1cae8 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,7 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - echo "kek231ddd" + echo "kek231dddd" git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-no-bootable /src/kubevirt rm -rf /src/kubevirt/.git