From 8c261bf82710419b6059cc61e51e6d76c2e1b541 Mon Sep 17 00:00:00 2001 From: Andy Lau Date: Thu, 7 Nov 2024 14:55:16 +0800 Subject: [PATCH] prevents startup failure due to low screen resolution --- ...-failure-due-to-low-screen-resolutio.patch | 68 +++++++++++++++++++ edk2.spec | 6 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100755 0053-prevents-startup-failure-due-to-low-screen-resolutio.patch diff --git a/0053-prevents-startup-failure-due-to-low-screen-resolutio.patch b/0053-prevents-startup-failure-due-to-low-screen-resolutio.patch new file mode 100755 index 0000000..8d16f38 --- /dev/null +++ b/0053-prevents-startup-failure-due-to-low-screen-resolutio.patch @@ -0,0 +1,68 @@ +From 7e0f674e6f72c36797fe86c5cc950ed073500571 Mon Sep 17 00:00:00 2001 +From: Andy lau +Date: Thu, 7 Nov 2024 14:33:32 +0800 +Subject: [PATCH] prevents startup failure due to low screen resolution + +--- + OvmfPkg/QemuVideoDxe/Initialize.c | 18 ++++++++++++++---- + OvmfPkg/VirtioGpuDxe/Gop.c | 2 +- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c +index 050ae87..76f3c1f 100644 +--- a/OvmfPkg/QemuVideoDxe/Initialize.c ++++ b/OvmfPkg/QemuVideoDxe/Initialize.c +@@ -293,6 +293,8 @@ QemuVideoBochsEdid ( + ) + { + EFI_STATUS Status; ++ UINT32 XResolution; ++ UINT32 YResolution; + + if (Private->Variant != QEMU_VIDEO_BOCHS_MMIO) { + return; +@@ -344,16 +346,24 @@ QemuVideoBochsEdid ( + return; + } + +- *XRes = Private->Edid[56] | ((Private->Edid[58] & 0xf0) << 4); +- *YRes = Private->Edid[59] | ((Private->Edid[61] & 0xf0) << 4); ++ XResolution = Private->Edid[56] | ((Private->Edid[58] & 0xf0) << 4); ++ YResolution = Private->Edid[59] | ((Private->Edid[61] & 0xf0) << 4); + DEBUG (( + DEBUG_INFO, + "%a: default resolution: %dx%d\n", + __func__, +- *XRes, +- *YRes ++ XResolution, ++ YResolution + )); + ++ if ((XResolution < 640) || (YResolution < 480)) { ++ /*direct return, GraphicsConsoleDxe needs 640x480 or larger*/ ++ return ; ++ } ++ ++ *XRes = XResolution; ++ *YRes = YResolution; ++ + if (PcdGet8 (PcdVideoResolutionSource) == 0) { + Status = PcdSet32S (PcdVideoHorizontalResolution, *XRes); + ASSERT_RETURN_ERROR (Status); +diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c +index f64dfce..8eaedff 100644 +--- a/OvmfPkg/VirtioGpuDxe/Gop.c ++++ b/OvmfPkg/VirtioGpuDxe/Gop.c +@@ -265,7 +265,7 @@ GopInitialize ( + // query host for display resolution + // + GopNativeResolution (VgpuGop, &XRes, &YRes); +- if ((XRes == 0) || (YRes == 0)) { ++ if ((XRes < 640) || (YRes < 480)) { + return; + } + +-- +2.43.0 + diff --git a/edk2.spec b/edk2.spec index 8b97367..e154ff3 100644 --- a/edk2.spec +++ b/edk2.spec @@ -7,7 +7,7 @@ Name: edk2 Version: %{stable_date} -Release: 12 +Release: 13 Summary: EFI Development Kit II License: BSD-2-Clause-Patent and OpenSSL and MIT URL: https://github.com/tianocore/edk2 @@ -85,6 +85,7 @@ patch50: 0050-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch # Fix CVE-2023-45236、CVE-2023-45237 patch51: 0051-NetworkPkg-SECURITY-PATCH-CVE-2023-45237.patch patch52: 0052-NetworkPkg-TcpDxe-SECURITY-PATCH-CVE-2023-45236.patch +patch53: 0053-prevents-startup-failure-due-to-low-screen-resolutio.patch BuildRequires: acpica-tools gcc gcc-c++ libuuid-devel python3 bc nasm python3-unversioned-command isl @@ -324,6 +325,9 @@ chmod +x %{buildroot}%{_bindir}/Rsa2048Sha256GenerateKeys %endif %changelog +* Thu Nov 7 2024 andy - 202308-13 +- GraphicConsoleDxe will assert if the display is too small, ignore hint + * Mon Oct 14 2024 shenyage - 202308-12 - fix CVE-2023-45236、CVE-2023-45237 -- Gitee