[PATCH v2] efi_loader: Allow disabling ANSI console queries via Kconfig
Michal Simek
michal.simek at amd.com
Wed Mar 18 15:24:52 CET 2026
Commit 4cb724364030 ("efi_loader: Disable ANSI output for tests")
introduced efi_console_set_ansi() to suppress ANSI escape sequences
during unit tests. Extend this mechanism to be configurable via a new
Kconfig option CONFIG_EFI_CONSOLE_DISABLE_ANSI.
When CONFIG_EFI_CONSOLE_DISABLE_ANSI is enabled,
efi_console_set_ansi(false) is called at the start of
efi_setup_console_size(). This prevents query_console_serial() from
sending ANSI escape sequences to the terminal, using default 25x80
dimensions instead. This is useful for platforms where the serial
console cannot handle ANSI queries.
Signed-off-by: Michal Simek <michal.simek at amd.com>
---
Changes in v2:
- Replace runtime 'no_ansi' env variable with compile-time
CONFIG_EFI_CONSOLE_DISABLE_ANSI Kconfig option (Ilias, Peter)
lib/efi_loader/Kconfig | 11 +++++++++++
lib/efi_loader/efi_console.c | 3 +++
2 files changed, 14 insertions(+)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index b5f81e0ff530..bae98e07d238 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -576,6 +576,17 @@ config EFI_EBBR_2_1_CONFORMANCE
help
Enabling this option adds the EBBRv2.1 conformance entry to the ECPT UEFI table.
+config EFI_CONSOLE_DISABLE_ANSI
+ bool "Disable ANSI escape sequence queries for console size"
+ help
+ Select this option to disable ANSI escape sequence queries for
+ detecting serial console size. When enabled,
+ efi_setup_console_size() will not send ANSI escape sequences to
+ the terminal and will use default 25x80 dimensions instead.
+ This is useful for platforms where the serial console cannot
+ properly handle ANSI queries, causing boot delays or garbled
+ output.
+
config EFI_SCROLL_ON_CLEAR_SCREEN
bool "Avoid overwriting previous output on clear screen"
help
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 068d1a0a7b74..a798d5604a31 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -365,6 +365,9 @@ void efi_setup_console_size(void)
int rows = 25, cols = 80;
int ret = -ENODEV;
+ if (IS_ENABLED(CONFIG_EFI_CONSOLE_DISABLE_ANSI))
+ efi_console_set_ansi(false);
+
if (IS_ENABLED(CONFIG_VIDEO))
ret = query_vidconsole(&rows, &cols);
if (ret) {
--
2.43.0
base-commit: 0d7293676b1e644b9b9ee2e45fb1ed10337cef31
branch: debian-sent3
More information about the U-Boot
mailing list