Skip to content

Commit b089538

Browse files
committed
Allow displaying the U-Boot banner on a video display
At present the U-Boot banner is only displayed on the serial console. If this is not visible to the user, the banner does not show. Some devices have a video display which can usefully display this information. Add a banner which is printed after relocation only on non-serial devices if CONFIG_DISPLAY_BOARDINFO_LATE is defined. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Bin Meng <[email protected]> Tested-by: Bin Meng <[email protected]> Tested-by: Stephen Warren <[email protected]>
1 parent 6c519f2 commit b089538

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

common/board_r.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ static init_fnc_t init_sequence_r[] = {
829829
#endif
830830
console_init_r, /* fully init console as a device */
831831
#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
832+
console_announce_r,
832833
show_board_info,
833834
#endif
834835
#ifdef CONFIG_ARCH_MISC_INIT

common/console.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ static void console_putc(int file, const char c)
202202
}
203203
}
204204

205-
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
206205
static void console_puts_noserial(int file, const char *s)
207206
{
208207
int i;
@@ -214,7 +213,6 @@ static void console_puts_noserial(int file, const char *s)
214213
dev->puts(dev, s);
215214
}
216215
}
217-
#endif
218216

219217
static void console_puts(int file, const char *s)
220218
{
@@ -248,13 +246,11 @@ static inline void console_putc(int file, const char c)
248246
stdio_devices[file]->putc(stdio_devices[file], c);
249247
}
250248

251-
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
252249
static inline void console_puts_noserial(int file, const char *s)
253250
{
254251
if (strcmp(stdio_devices[file]->name, "serial") != 0)
255252
stdio_devices[file]->puts(stdio_devices[file], s);
256253
}
257-
#endif
258254

259255
static inline void console_puts(int file, const char *s)
260256
{
@@ -699,6 +695,19 @@ static void console_update_silent(void)
699695
#endif
700696
}
701697

698+
int console_announce_r(void)
699+
{
700+
#if !CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
701+
char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
702+
703+
display_options_get_banner(false, buf, sizeof(buf));
704+
705+
console_puts_noserial(stdout, buf);
706+
#endif
707+
708+
return 0;
709+
}
710+
702711
/* Called before relocation - use serial functions */
703712
int console_init_f(void)
704713
{

include/console.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ void console_record_reset(void);
4242
*/
4343
void console_record_reset_enable(void);
4444

45+
/**
46+
* console_announce_r() - print a U-Boot console on non-serial consoles
47+
*
48+
* When U-Boot starts up with a display it generally does not announce itself
49+
* on the display. The banner is instead emitted on the UART before relocation.
50+
* This function prints a banner on devices which (we assume) did not receive
51+
* it before relocation.
52+
*
53+
* @return 0 (meaning no errors)
54+
*/
55+
int console_announce_r(void);
56+
4557
/*
4658
* CONSOLE multiplexing.
4759
*/

0 commit comments

Comments
 (0)