[PATCH] cmd: Remove default prompt from output

Quentin Schulz quentin.schulz at cherry.de
Tue Aug 19 11:14:11 CEST 2025


Hi Daniel, Tom,

On 8/15/25 6:12 PM, Tom Rini wrote:
> On Fri, Aug 15, 2025 at 09:06:35AM -0700, Daniel Schultz wrote:
> 
>> Some commands include the U-Boot prompt (=>) in their output,
>> which can interfere with tools like labgrid that rely on prompt
>> detection to determine when a command has completed. This may cause
>> such tools to misinterpret partial output.
>>
>> To avoid this issue, it's better to update the command output itself
>> rather than modifying the actual U-Boot prompt. Changing the prompt
>> is not acceptable in many cases, as some boards have used the default
>> prompt (=>) for years, and altering it - especially just for testing -
>> could lead to inconsistencies or unintended side effects.
>> Instead, replace instances of the prompt that appear within command
>> output (not the real prompt) with an alternative like -> to ensure
>> correct parsing by tools that rely on prompt recognition.
>>
>> Signed-off-by: Daniel Schultz <d.schultz at phytec.de>
>> ---
>>   cmd/i2c.c      |  2 +-
>>   cmd/mtdparts.c | 12 ++++++------
>>   common/hash.c  |  6 +++---
>>   3 files changed, 10 insertions(+), 10 deletions(-)
> 
> This is two cases, and I'm not sure I like the proposal here, sorry. For
> cmd/mtdparts.c, it's debug statements. We can change them, but are they
> also enabled by default in anything? The other cases, we're changing
> output along the lines of:
> 
>> -	printf ("CRC32 for %08lx ... %08lx ==> ", addr, addr + count - 1);
>> +	printf("CRC32 for %08lx ... %08lx --> ", addr, addr + count - 1);
> 
> In each case, and I'm surprised there's not testing that globs on that
> today. I see the wget case that uses "==>" and we do have a test that
> checks it, today. Is your testing framework not able to handle "=>" in
> the middle of a line? Thanks.
> 

In the case of labgrid, I assume this should be possible.

c.f. https://labgrid.readthedocs.io/en/latest/configuration.html#ubootdriver

Arguments:

         prompt (regex, default=””): U-Boot prompt to match

I assume you just want to be using

UBootDriver:
   prompt: '^=> '

instead of simply using '=> ' ?

While SYS_PROMPT defaults to => for anything but the Zynq architecture, 
it can be set from defconfigs as well and look what we have here:

configs/brcp150_defconfig
63:CONFIG_SYS_PROMPT="-> "

configs/brcp170_defconfig
62:CONFIG_SYS_PROMPT="-> "

configs/brcp1_1r_defconfig
62:CONFIG_SYS_PROMPT="-> "

configs/brcp1_1r_switch_defconfig
62:CONFIG_SYS_PROMPT="-> "

configs/brcp1_2r_defconfig
62:CONFIG_SYS_PROMPT="-> "

configs/brsmarc2_defconfig
62:CONFIG_SYS_PROMPT="-> "

So now we would be breaking those users instead. I'm not sure it's a 
good idea for U-Boot to do this, we'll never find a way to have the 
prompt never repeated in log messages for all supported platforms. You 
can always fix those in your own fork if you want though. But I fear 
this will be the beginning of an endless loop of revert commits because 
it broke one's CI.

Cheers,
Quentin


More information about the U-Boot mailing list