[U-Boot] [PATCH] Enable serial console only before booting

Frédéric Leroy fredo at starox.org
Sun Jul 7 13:42:34 CEST 2013


When netconsole is active, some boards fail to boot.
This patch enables only the serial console before
control is handed over to another operating system.

Signed-off-by: Frédéric Leroy <fredo at starox.org>
---

Sorry for the noise, I tend to post faster than my own swadow ...

Changes in v2 :

- remove unused argument from console_set_serial_unconditionally call
- fix platforms where CONFIG_CONSOLE_MUX is not defined

 common/cmd_bootm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 15f4599..e75c692 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -62,6 +62,18 @@
 #include <linux/lzo.h>
 #endif /* CONFIG_LZO */
 
+#if defined(CONFIG_NETCONSOLE)
+#include <iomux.h>
+void console_set_serial_unconditionally(void)
+{
+#if defined(CONFIG_CONSOLE_MUX)
+	iomux_doenv(stdin, "serial");
+	iomux_doenv(stdout, "serial");
+	iomux_doenv(stderr, "serial");
+#endif
+}
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifndef CONFIG_SYS_BOOTM_LEN
@@ -577,6 +589,7 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
 			 * Stop the ethernet stack if NetConsole could have
 			 * left it up
 			 */
+			console_set_serial_unconditionally();
 			eth_halt();
 #endif
 			arch_preboot_os();
@@ -645,6 +658,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_NETCONSOLE
 	/* Stop the ethernet stack if NetConsole could have left it up */
+	console_set_serial_unconditionally();
 	eth_halt();
 #endif
 
@@ -1849,6 +1863,7 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_NETCONSOLE
 	/* Stop the ethernet stack if NetConsole could have left it up */
+	console_set_serial_unconditionally();
 	eth_halt();
 #endif
 
-- 
1.8.1.2



More information about the U-Boot mailing list