summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-10-10 10:05:42 +0000
committerwdenk <wdenk>2003-10-10 10:05:42 +0000
commitf72da3406bf6f1c1bce9aa03b07d070413a916af (patch)
tree5494a96d6da4706d1add61cb36d8bace834fbb8f /common
parent5da627a424b3ad2d38a81886ba4a18e5123a6788 (diff)
Added config option CONFIG_SILENT_CONSOLE. See doc/README.silentLABEL_2003_10_10_1200
for more information
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c40
-rw-r--r--common/console.c14
-rw-r--r--common/main.c33
3 files changed, 83 insertions, 4 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 79b763ec136..8bac1be4601 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -117,6 +117,9 @@ static boot_os_Fcn do_bootm_linux;
#else
extern boot_os_Fcn do_bootm_linux;
#endif
+#ifdef CONFIG_SILENT_CONSOLE
+static void fixup_silent_linux (void);
+#endif
static boot_os_Fcn do_bootm_netbsd;
static boot_os_Fcn do_bootm_rtems;
#if (CONFIG_COMMANDS & CFG_CMD_ELF)
@@ -378,6 +381,9 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
switch (hdr->ih_os) {
default: /* handled by (original) Linux case */
case IH_OS_LINUX:
+#ifdef CONFIG_SILENT_CONSOLE
+ fixup_silent_linux();
+#endif
do_bootm_linux (cmdtp, flag, argc, argv,
addr, len_ptr, verify);
break;
@@ -432,6 +438,40 @@ U_BOOT_CMD(
" 'arg' can be the address of an initrd image\n"
);
+#ifdef CONFIG_SILENT_CONSOLE
+static void
+fixup_silent_linux ()
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ char buf[256], *start, *end;
+ char *cmdline = getenv ("bootargs");
+
+ /* Only fix cmdline when requested */
+ if (!(gd->flags & GD_FLG_SILENT))
+ return;
+
+ debug ("before silent fix-up: %s\n", cmdline);
+ if (cmdline) {
+ if ((start = strstr (cmdline, "console=")) != NULL) {
+ end = strchr (start, ' ');
+ strncpy (buf, cmdline, (start - cmdline + 8));
+ if (end)
+ strcpy (buf + (start - cmdline + 8), end);
+ else
+ buf[start - cmdline + 8] = '\0';
+ } else {
+ strcpy (buf, cmdline);
+ strcat (buf, " console=");
+ }
+ } else {
+ strcpy (buf, "console=");
+ }
+
+ setenv ("bootargs", buf);
+ debug ("after silent fix-up: %s\n", buf);
+}
+#endif /* CONFIG_SILENT_CONSOLE */
+
#ifdef CONFIG_PPC
static void
do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
diff --git a/common/console.c b/common/console.c
index 3ef60fd7ac3..da49c968272 100644
--- a/common/console.c
+++ b/common/console.c
@@ -365,10 +365,16 @@ int console_init_f (void)
DECLARE_GLOBAL_DATA_PTR;
gd->have_console = 1;
+
+#ifdef CONFIG_SILENT_CONSOLE
+ if (getenv("silent") != NULL)
+ gd->flags |= GD_FLG_SILENT;
+#endif
+
return (0);
}
-#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN)
+#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN) || defined(CONFIG_SILENT_CONSOLE)
/* search a device */
device_t *search_device (int flags, char *name)
{
@@ -494,6 +500,12 @@ int console_init_r (void)
outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
#endif
+#ifdef CONFIG_SILENT_CONSOLE
+ /* Suppress all output if "silent" mode requested */
+ if (gd->flags & GD_FLG_SILENT)
+ outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
+#endif
+
/* Scan devices looking for input and output devices */
for (i = 1;
(i <= items) && ((inputdev == NULL) || (outputdev == NULL));
diff --git a/common/main.c b/common/main.c
index d08bc47d736..73f8ff9f0be 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 */