[PATCH] efi_loader: Allow disabling ANSI console queries via env variable

Michal Simek michal.simek at amd.com
Tue Mar 10 14:50:05 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 runtime-configurable via
the 'no_ansi' U-Boot environment variable.

When 'no_ansi' is set to 'yes', 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.

The variable is read using env_get_yesno() which accepts standard
boolean values (yes/y/1/true/t).

Signed-off-by: Michal Simek <michal.simek at amd.com>
---

 lib/efi_loader/efi_console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 068d1a0a7b74..737c2331b56c 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 (env_get_yesno("no_ansi") == 1)
+		efi_console_set_ansi(false);
+
 	if (IS_ENABLED(CONFIG_VIDEO))
 		ret = query_vidconsole(&rows, &cols);
 	if (ret) {
-- 
2.43.0

base-commit: f74b8c2aeaf8d14565abff8f6a59625c543169ee
branch: debian-sent3


More information about the U-Boot mailing list