From 8e9c8e624f7a3a29c4887cc2e2c0c2e775baf86a Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Fri, 21 Jul 2023 22:27:57 +0200 Subject: [PATCH] boot/edk2: introduce a new _OVMF_DEBUG_ON_SERIAL option When EDK2 OVMF is built with debug, messages are printed to IO port 0x402. Those messages are not shown in the normal Qemu emulated serial port. Enabling this option will print debug messages on the emulated serial port, potentially mixing messages with UEFI serial console output. See OVMF README: https://github.com/tianocore/edk2/blob/master/OvmfPkg/README This option has been useful to debug problems such as [1], in which the emulator was hanging at startup without any log. Enabling this option show the debug message on the console, before hanging: ... PlatformCpuCountBugCheck: Present=0 Possible=1 PlatformCpuCountBugCheck: Broken CPU hotplug register block found. Update QEMU to version 8+, or PlatformCpuCountBugCheck: to a stable release with commit dab30fbef389 backported. Refer to PlatformCpuCountBugCheck: . ... [1] http://lists.busybox.net/pipermail/buildroot/2023-July/670807.html Signed-off-by: Julien Olivain Tested-by: Romain Naour Reviewed-by: Romain Naour Signed-off-by: Yann E. MORIN --- boot/edk2/Config.in | 15 +++++++++++++++ boot/edk2/edk2.mk | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in index 855a62f70b..bed503b168 100644 --- a/boot/edk2/Config.in +++ b/boot/edk2/Config.in @@ -108,6 +108,21 @@ comment "QEMU SBSA depends on ATF not using EDK2 as BL33" endchoice +config BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL + bool "OVMF Debug on Serial" + depends on BR2_ENABLE_DEBUG + depends on BR2_TARGET_EDK2_PLATFORM_OVMF_I386 || \ + BR2_TARGET_EDK2_PLATFORM_OVMF_X64 + help + When EDK2 OVMF is built with debug, messages are printed to + IO port 0x402. Those messages are not shown in the normal + Qemu emulated serial port. Enabling this option will print + debug messages on the emulated serial port, potentially + mixing messages with UEFI serial console output. + + See OVMF README: + https://github.com/tianocore/edk2/blob/master/OvmfPkg/README + config BR2_TARGET_EDK2_FD_NAME string default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_I386 diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk index 399bd346ef..95cbe415ef 100644 --- a/boot/edk2/edk2.mk +++ b/boot/edk2/edk2.mk @@ -16,8 +16,15 @@ EDK2_INSTALL_IMAGES = YES ifeq ($(BR2_ENABLE_DEBUG),y) EDK2_BUILD_TYPE = DEBUG +ifeq ($(BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL),y) +# DEBUG_ON_SERIAL_PORT is only tested to be set, so don't disable it, as +# it would still be set. +EDK2_BUILD_OPTS += -DDEBUG_ON_SERIAL_PORT=TRUE +endif else EDK2_BUILD_TYPE = RELEASE +# DEBUG_ON_SERIAL_PORT is only valid in debug builds, so useless to set +# it (enabled or disabled) on a relase build. endif # Build system notes.