[PATCH 0/9] lib: term: fix fbconsole cursor desynchronization

Ahmad Fatoum a.fatoum at barebox.org
Thu Apr 30 23:53:54 PDT 2026


term_getsize() was added as a common helper to compute the minimum
terminal size across all enabled stdout consoles.

Since then, the EFI loader support added the same functionality again in
open-coded form.

Both suffer from the same underlying issue: They emit some control
characters on all enabled stdout consoles without the regard for the
individual size and capabilities of the terminals they are connected to.

This can lead to the cursor to end up at odd places on some consoles,
but not others as can be seen here on this video of the barebox
framebuffer console on a device without a terminal connected to the
serial port:

https://fosstodon.org/@otte_homan@theblower.au/116229733790452489

The <blue>OTICE</blue> is due to the framebuffer console cursor being
placed at the very end of the previous line. Then N is printed and
the rest at the line after it.

This series fixes term_getsize() to correctly account for differences
between the framebuffer and "regular" consoles and then switches off the
UEFI loader console support to make use of it.

This fixes the display of the OpenBSD bootloader when run under QEMU.

There's still some more improvements to be made to the GOP support, but
they do not preclude actual use: To have the OpenBSD installer
automatically use the console, simple-framebuffer ought to be used
instead of the GOP anyway.

Ahmad Fatoum (9):
  lib: term: avoid printing NUL with new new console_puts API
  lib: term: return error code from term_getsize()
  lib: term: add per-console terminal response parser
  lib: term: factor out single cdev handling from term_getsize
  lib: term: fix term_getsize cursor restore
  console: add get_size callback for direct size reporting
  video: fbconsole: implement get_size
  console: add per-console terminal.size parameter
  efi: reimplement query_console_serial using term_getsize

 common/console.c               |  18 ++++
 drivers/video/fbconsole.c      |  10 +++
 efi/loader/protocols/console.c | 119 +------------------------
 include/console.h              |   3 +
 include/term.h                 |   7 +-
 lib/term.c                     | 158 +++++++++++++++++++++++----------
 6 files changed, 148 insertions(+), 167 deletions(-)

-- 
2.47.3




More information about the barebox mailing list