From f72da3406bf6f1c1bce9aa03b07d070413a916af Mon Sep 17 00:00:00 2001 From: wdenk Date: Fri, 10 Oct 2003 10:05:42 +0000 Subject: Added config option CONFIG_SILENT_CONSOLE. See doc/README.silent for more information --- common/main.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'common/main.c') diff --git a/common/main.c b/common/main.c index d08bc47..73f8ff9 100644 --- a/common/main.c +++ b/common/main.c @@ -193,6 +193,18 @@ static __inline__ int abortboot(int bootdelay) { int abort = 0; +#ifdef CONFIG_SILENT_CONSOLE + { + DECLARE_GLOBAL_DATA_PTR; + + if (gd->flags & GD_FLG_SILENT) { + /* Restore serial console */ + console_assign (stdout, "serial"); + console_assign (stderr, "serial"); + } + } +#endif + #ifdef CONFIG_MENUPROMPT printf(CONFIG_MENUPROMPT, bootdelay); #else @@ -207,13 +219,13 @@ static __inline__ int abortboot(int bootdelay) if (bootdelay >= 0) { if (tstc()) { /* we got a key press */ (void) getc(); /* consume input */ - printf ("\b\b\b 0\n"); - return 1; /* don't auto boot */ + printf ("\b\b\b 0"); + abort = 1; /* don't auto boot */ } } #endif - while (bootdelay > 0) { + while ((bootdelay > 0) && (!abort)) { int i; --bootdelay; @@ -237,6 +249,21 @@ static __inline__ int abortboot(int bootdelay) putc ('\n'); +#ifdef CONFIG_SILENT_CONSOLE + { + DECLARE_GLOBAL_DATA_PTR; + + if (abort) { + /* permanently enable normal console output */ + gd->flags &= ~(GD_FLG_SILENT); + } else if (gd->flags & GD_FLG_SILENT) { + /* Restore silent console */ + console_assign (stdout, "nulldev"); + console_assign (stderr, "nulldev"); + } + } +#endif + return abort; } # endif /* CONFIG_AUTOBOOT_KEYED */ -- cgit v1.1