[U-Boot] [PATCH v2 02/28] Allow displaying the U-Boot banner on a video display

Simon Glass sjg at chromium.org
Wed May 31 23:57:10 UTC 2017


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 <sjg at chromium.org>
---

Changes in v2: None

 common/board_r.c  |  1 +
 common/console.c  | 15 +++++++++++----
 include/console.h | 12 ++++++++++++
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index 5986cd7674..99b5d22c81 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -847,6 +847,7 @@ static init_fnc_t init_sequence_r[] = {
 #endif
 	console_init_r,		/* fully init console as a device */
 #ifdef CONFIG_DISPLAY_BOARDINFO_LATE
+	console_announce_r,
 	show_board_info,
 #endif
 #ifdef CONFIG_ARCH_MISC_INIT
diff --git a/common/console.c b/common/console.c
index 1232808df5..3fcd7ce66b 100644
--- a/common/console.c
+++ b/common/console.c
@@ -202,7 +202,6 @@ static void console_putc(int file, const char c)
 	}
 }
 
-#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
 static void console_puts_noserial(int file, const char *s)
 {
 	int i;
@@ -214,7 +213,6 @@ static void console_puts_noserial(int file, const char *s)
 			dev->puts(dev, s);
 	}
 }
-#endif
 
 static void console_puts(int file, const char *s)
 {
@@ -248,13 +246,11 @@ static inline void console_putc(int file, const char c)
 	stdio_devices[file]->putc(stdio_devices[file], c);
 }
 
-#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
 static inline void console_puts_noserial(int file, const char *s)
 {
 	if (strcmp(stdio_devices[file]->name, "serial") != 0)
 		stdio_devices[file]->puts(stdio_devices[file], s);
 }
-#endif
 
 static inline void console_puts(int file, const char *s)
 {
@@ -699,6 +695,17 @@ static void console_update_silent(void)
 #endif
 }
 
+int console_announce_r(void)
+{
+	char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
+
+	display_options_get_banner(false, buf, sizeof(buf));
+
+	console_puts_noserial(stdout, buf);
+
+	return 0;
+}
+
 /* Called before relocation - use serial functions */
 int console_init_f(void)
 {
diff --git a/include/console.h b/include/console.h
index 3d37f6a53b..511b38e9e7 100644
--- a/include/console.h
+++ b/include/console.h
@@ -42,6 +42,18 @@ void console_record_reset(void);
  */
 void console_record_reset_enable(void);
 
+/**
+ * console_announce_r() - print a U-Boot console on non-serial consoles
+ *
+ * When U-Boot starts up with a display it generally does not account itself
+ * on the display. The banner is emitted on the UART before relocation instead.
+ * This function prints a banner on devices which (we assume) did not receive
+ * it before relocation.
+ *
+ * @return 0 (meaning no errors)
+ */
+int console_announce_r(void);
+
 /*
  * CONSOLE multiplexing.
  */
-- 
2.13.0.219.gdb65acc882-goog



More information about the U-Boot mailing list