[PATCH] autoboot: Fix inconsistent countdown output
    Sam Protsenko 
    semen.protsenko at linaro.org
       
    Mon Oct 27 01:48:38 CET 2025
    
    
  
On Sun, Oct 26, 2025 at 7:37 PM Sam Protsenko
<semen.protsenko at linaro.org> wrote:
>
> On Sun, Oct 26, 2025 at 7:24 PM Sam Protsenko
> <semen.protsenko at linaro.org> wrote:
> >
> > Commit 5f70be08b015 ("Fix autoboot countdown printing wrong") introduces
> > inconsistency in how the countdown is displayed. For example, in case
> > when BOOTDELAY=5, the next output is observed during the boot:
> >
> >     Hit any key to stop autoboot:  5
> >     Hit any key to stop autoboot: 4
> >     Hit any key to stop autoboot: 3
> >
> > That happens due to different printf format (%2d vs %1d). Moreover, the
> > mentioned commit fails to handle the case when the user is holding some
> > key before the countdown is shown. E.g. if BOOTDELAY=101, the next
> > malformed output is being produced:
> >
> >     Hit any key to stop autoboot: 1 0
> >
> > That's because the fast path code wasn't modified accordingly, and still
> > tries to erase the number using '\b\b\b' format.
> >
> > Fix both issues by introducing a dedicated routine for printing the
> > whole countdown line.
> >
> > Fixes: 5f70be08b015 ("Fix autoboot countdown printing wrong")
> > Signed-off-by: Sam Protsenko <semen.protsenko at linaro.org>
> > ---
>
+ Heinrich, Simon
Also, I remember when I suggested using ANSI escape codes back in
2018, Wolfgang wasn't very happy about that [1]. But I noticed those
being used in cmd/bootmenu.c and common/menu.c nowadays. What's our
stance on this matter currently?
Just a thought: if we don't want to use ANSI escape codes, we can
simply get back to using \b and add more spaces in the end of the line
to account for large possible countdown values like 100 or 1000. Any
thoughts?
Thanks!
[1] https://lore.kernel.org/u-boot/20180719194321.16321240175@gemini.denx.de/
    
    
More information about the U-Boot
mailing list