[U-Boot-Users] [PATCH - RFC] Fix printf() format problems with configurable prompts

Jerry Van Baren gerald.vanbaren at ge.com
Wed Jul 16 21:57:48 CEST 2008


Wolfgang Denk wrote:
> U-Boot allows for configurable prompt strings using the
> CONFIG_AUTOBOOT_PROMPT resp. CONFIG_MENUPROMPT definitions. So far,
> the assumption was that any such user defined problts would contain
> exactly one "%d" format specifier. But some boards did not.
> 
> To allow for flexible boot prompts without adding too complex code we
> now allow to specify the whole list of printf() arguments in the user
> definition. This is powerful, but requires a responsible user who
> really understands what he is doing, as he needs to know for exanple

s/exanple/example/

> which variables are available in the respective context.
> 
> Signed-off-by: Wolfgang Denk <wd at denx.de>
> ---
> 
> This is an attempt to fix the
> 	main.c:215: warning: too many arguments for format
> 	main.c:119: warning: too many arguments for format
> warnings we got for some boards.
> 
> I am not exactly happy about providing the complete list of printf()
> arguments in a #define, but this seems to be the solution that (1)
> requires the least changes to the code and (2) does not add memory
> footprint (like we would need if we added some format parsing
> function).
> 
> Comments / critique welcome.

Hi Wolfgang,

It seems a lot simpler to reformat the couple of boards that don't have 
%d in their string to add the "in %d seconds" type phrase.

The downside (risk!) of this is that some companies may be unhappy if 
their boot prompt changes (ripple effect through manuals, humans trained 
to see certain strings, programs expect-ing certain strings, etc.).

I'm OK with doing this to sacsng and Heiko Schocher is OK with sc3 (he 
published a patch this afternoon).  That leaves only three boards at 
risk: hymod, motionpro, and voiceblue.

$ grep -A 1 CONFIG_AUTOBOOT_PROMPT include/configs/*.h |less | grep -v 
'%d' | grep -v -- '--' | grep -v CONFIG_AUTOBOOT_DELAY_STR | grep -v 
CONFIG_AUTOBOOT_STOP_STR

include/configs/hymod.h-                                        "press 
<SPACE> to stop\n"

include/configs/motionpro.h-                                    "press 
\"<Esc><Esc>\" to stop\n"

include/configs/sacsng.h:#define CONFIG_AUTOBOOT_PROMPT "Autobooting...\n"

include/configs/sc3.h:#define CONFIG_AUTOBOOT_PROMPT            "\nSC3 - 
booting... stop with ENTER\n"

include/configs/voiceblue.h:#define CONFIG_AUTOBOOT_PROMPT 
"\nVoiceBlue Enterprise - booting...\n"


Best regards,
gvb




More information about the U-Boot mailing list