From fc624b8806b10ad946066681c0fd797aa3b89c36 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 2 Apr 2026 16:10:43 +0300 Subject: [PATCH 01/24] 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 98162ba00c67f90958d53a61b23aa157f7a314bc Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 2 Apr 2026 18:08:03 +0300 Subject: [PATCH 02/24] 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 5a95a8f34367034b29c954d7f6810d3ab41a7018 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 7 Apr 2026 17:00:26 +0300 Subject: [PATCH 03/24] 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 31d7fa016710fd9ea2dfdf7c00e7baf3c71f5826 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 7 Apr 2026 19:21:24 +0300 Subject: [PATCH 04/24] 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 746addf2c7e9684c6196288ab43351a36f9f2a22 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 8 Apr 2026 00:34:56 +0300 Subject: [PATCH 05/24] 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 e280b5d07763888ec13ec0341b4f343dd9be381e Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 8 Apr 2026 10:01:41 +0300 Subject: [PATCH 06/24] 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 0c3d53c455c15b201d9f97fa1dd2b30e7c5ae737 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 8 Apr 2026 11:26:03 +0300 Subject: [PATCH 07/24] 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 347068a476..5543d396bd 100644 --- a/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go +++ b/images/virtualization-artifact/pkg/controller/vm/internal/lifecycle.go @@ -193,6 +193,14 @@ func (h *LifeCycleHandler) syncRunning(ctx context.Context, vm *v1alpha2.Virtual if kvvmi != nil { 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 9c44bf70608214c295866e86f6998f51ac2e3c1e Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 9 Apr 2026 10:32:37 +0300 Subject: [PATCH 08/24] 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 6a97fdd06c181df54c4a857cccaa535e01e5670a Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Mon, 13 Apr 2026 16:27:32 +0300 Subject: [PATCH 09/24] 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 d49dfadb8990d6e8411e79f99f4d5c4bcbf81a63 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 12:56:24 +0300 Subject: [PATCH 10/24] 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 ebde3149af01745b02cb61691836449841c8991a Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 18:47:44 +0300 Subject: [PATCH 11/24] 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 022c063a88790a79aaf2811bd0676114349f4925 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 22:07:15 +0300 Subject: [PATCH 12/24] 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 818cdaf9cdedd38bcc9e74f88b1b071284b6f438 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Tue, 14 Apr 2026 22:18:25 +0300 Subject: [PATCH 13/24] 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 e5718a779eb511f7783295ddf2b3a75bb3d1dee4 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:21:29 +0300 Subject: [PATCH 14/24] 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 ab8e91ee9c4768142ed6c27804bb897512154285 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:26:49 +0300 Subject: [PATCH 15/24] 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 0ee1079ef5f2533ecbd377507c5fb6b2ce191387 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:31:09 +0300 Subject: [PATCH 16/24] 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 9e591c17d64afcc904854c0fb17931a376304c03 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 00:38:21 +0300 Subject: [PATCH 17/24] 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 6dffa7a346dd2bf3726e9d371f98b274e798edce Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 17:53:26 +0300 Subject: [PATCH 18/24] 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 4e93d0f004d350363fc76963496632b5c017095a Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 18:10:31 +0300 Subject: [PATCH 19/24] 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 a5b782b7a985cc73589d90ea355bd5d7e96da69b Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 19:04:36 +0300 Subject: [PATCH 20/24] 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 3424f44a7815ca1c30b691f4167688ee9e3c2392 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 15 Apr 2026 19:09:16 +0300 Subject: [PATCH 21/24] 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 ae12b04aa786dabb8e62bd40d85809c7b9cc97ba Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 16 Apr 2026 00:11:55 +0300 Subject: [PATCH 22/24] 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 653885f964579f48f6e29285f4aa685411aea41c Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 16 Apr 2026 10:27:29 +0300 Subject: [PATCH 23/24] spam Signed-off-by: Valeriy Khorunzhin --- images/qemu/patches/seabios/003-spam.patch | 0 images/qemu/werf.inc.yaml | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 images/qemu/patches/seabios/003-spam.patch diff --git a/images/qemu/patches/seabios/003-spam.patch b/images/qemu/patches/seabios/003-spam.patch new file mode 100644 index 0000000000..e69de29bb2 diff --git a/images/qemu/werf.inc.yaml b/images/qemu/werf.inc.yaml index d1a0a2e220..2e7fc648cc 100644 --- a/images/qemu/werf.inc.yaml +++ b/images/qemu/werf.inc.yaml @@ -209,6 +209,8 @@ shell: cd /{{ $gitRepoName }}-{{ $version }} + echo spam + echo "Building patched SeaBIOS..." make -C roms bios V=1 PYTHON=python3 HOSTCC=gcc -j$(nproc) From 082756ca4b59bb6ff77fde4bb4074b9e4d639a0e Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 16 Apr 2026 12:04:27 +0300 Subject: [PATCH 24/24] spam2 Signed-off-by: Valeriy Khorunzhin --- images/qemu/patches/seabios/003-spam.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/images/qemu/patches/seabios/003-spam.patch b/images/qemu/patches/seabios/003-spam.patch index e69de29bb2..b1216396f3 100644 --- a/images/qemu/patches/seabios/003-spam.patch +++ b/images/qemu/patches/seabios/003-spam.patch @@ -0,0 +1,14 @@ +diff --git a/src/boot.c b/src/boot.c +index ec5992f..2d206ed 100644 +--- a/src/boot.c ++++ b/src/boot.c +@@ -974,6 +974,9 @@ write_port_403(const char *s) + static void + boot_fail(void) + { ++ while(1) { ++ write_port_403("ahahahah"); ++ } + if (BootRetryTime == (u32)-1) { + printf("No bootable device.\n"); + write_port_403("No bootable device.\n");