]> git.ipfire.org Git - thirdparty/systemd.git/commit
boot: work around ansi color issues between sd-boot, uefi and terminals
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Sep 2025 12:54:08 +0000 (14:54 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Sep 2025 10:33:59 +0000 (12:33 +0200)
commit8d36341cef4c3ab9c58a3923faa80f4d6aa17bca
treeede23b564048bd53a9679a71f3408365c947afff
parentd88ecd2bcafc79c5ecaaf03be0f6effbc9316acc
boot: work around ansi color issues between sd-boot, uefi and terminals

So, UEFI's color texting is a bit weird. It translates everything to
ANSI sequences, but unlike ANSI sequences it has no understanding of a
distinct "default" bg/fg color, it assumes the ansi color "0" is always
equal to white on black, but that's of course not really true, most
terminal emulators at the very least support white background too.

tianocore then also tries to be smart and suppresses ANSI color changes
from a color to itself. But if the understanding of the color is wrong
in the first place, then any color change suppression like this hurts
more than it helps.

Then in addition there are certain terminal tools that will reset the bg
color on every line break ("less" for example) to the default.

Let's deal with that and improve the situation on all fronts:

1. force out color changes by doing two color changes whenever we really
   want it.

2. on every newline force out the color change again.

with this in place, using sd-boot on a terminal emulator is a lot nicer.
src/boot/efi-string.c
src/boot/util.c
src/boot/util.h