diff options
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | common/cmd_bootm.c | 40 | ||||
-rw-r--r-- | common/console.c | 14 | ||||
-rw-r--r-- | common/main.c | 33 | ||||
-rw-r--r-- | doc/README.silent | 22 | ||||
-rw-r--r-- | include/asm-arm/global_data.h | 1 | ||||
-rw-r--r-- | include/asm-i386/global_data.h | 1 | ||||
-rw-r--r-- | include/asm-mips/global_data.h | 1 | ||||
-rw-r--r-- | include/asm-nios/global_data.h | 1 | ||||
-rw-r--r-- | include/asm-ppc/global_data.h | 1 | ||||
-rw-r--r-- | include/configs/trab.h | 2 | ||||
-rw-r--r-- | lib_arm/board.c | 18 |
12 files changed, 133 insertions, 4 deletions
@@ -2,6 +2,9 @@ Changes for U-Boot 1.0.0: ====================================================================== +* Added config option CONFIG_SILENT_CONSOLE. See doc/README.silent + for more information + * Patch by Steven Scholz, 10 Oct 2003 - Add support for Altera FPGA ACEX1K diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 79b763e..8bac1be 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 3ef60fd..da49c96 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 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 */ diff --git a/doc/README.silent b/doc/README.silent new file mode 100644 index 0000000..f2628a6 --- /dev/null +++ b/doc/README.silent @@ -0,0 +1,22 @@ +The config option CONFIG_SILENT_CONSOLE can be used to quiet messages +on the console. If the option has been enabled, the output can be +silenced by setting the environment variable "silent". The variable +is latched into the global data at an early stage in the boot process +so deleting it with "setenv" will not take effect until the system is +restarted. + +The following actions are taken if "silent" is set at boot time: + + - Until the console devices have been initialized, output has to be + suppressed by testing for the flag "GD_FLG_SILENT" in "gd->flags". + Currently only the messages for the TRAB board are handled in this + way. + + - When the console devices have been initialized, "stdout" and + "stderr" are set to "nulldev", so subsequent messages are + suppressed automatically. Make sure to enable "nulldev" by + #defining CFG_DEVICE_NULLDEV in your board config file. + + - When booting a linux kernel, the "bootargs" are fixed up so that + the argument "console=" will be in the command line, no matter how + it was set in "bootargs" before. diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h index b5878ca..c2d5291 100644 --- a/include/asm-arm/global_data.h +++ b/include/asm-arm/global_data.h @@ -59,6 +59,7 @@ typedef struct global_data { */ #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") diff --git a/include/asm-i386/global_data.h b/include/asm-i386/global_data.h index 4ffbc07..1d309d5 100644 --- a/include/asm-i386/global_data.h +++ b/include/asm-i386/global_data.h @@ -53,6 +53,7 @@ typedef struct { */ #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ extern gd_t *global_data; diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h index 3ecf555..a024194 100644 --- a/include/asm-mips/global_data.h +++ b/include/asm-mips/global_data.h @@ -53,6 +53,7 @@ typedef struct global_data { */ #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0") diff --git a/include/asm-nios/global_data.h b/include/asm-nios/global_data.h index 75dd3fc..935d08e 100644 --- a/include/asm-nios/global_data.h +++ b/include/asm-nios/global_data.h @@ -40,6 +40,7 @@ typedef struct global_data { /* flags */ #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("%g7") diff --git a/include/asm-ppc/global_data.h b/include/asm-ppc/global_data.h index f17a764..c1bef37 100644 --- a/include/asm-ppc/global_data.h +++ b/include/asm-ppc/global_data.h @@ -96,6 +96,7 @@ typedef struct global_data { */ #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ +#define GD_FLG_SILENT 0x00004 /* Silent mode */ #if 1 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r29") diff --git a/include/configs/trab.h b/include/configs/trab.h index 86c3f83..0e6ffd9 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -59,6 +59,8 @@ #define CONFIG_SETUP_MEMORY_TAGS 1 #define CONFIG_INITRD_TAG 1 +#define CFG_DEVICE_NULLDEV 1 /* enble null device */ +#define CONFIG_SILENT_CONSOLE 1 /* enable silent startup */ /*********************************************************** * I2C stuff: diff --git a/lib_arm/board.c b/lib_arm/board.c index 493112d..f3f831f 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -111,6 +111,12 @@ static int init_baudrate (void) static int display_banner (void) { + DECLARE_GLOBAL_DATA_PTR; + +#ifdef CONFIG_SILENT_CONSOLE + if (gd->flags & GD_FLG_SILENT) + return (0); +#endif printf ("\n\n%s\n\n", version_string); printf ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n", @@ -122,6 +128,7 @@ static int display_banner (void) printf ("IRQ Stack: %08lx\n", IRQ_STACK_START); printf ("FIQ Stack: %08lx\n", FIQ_STACK_START); #endif + return (0); } @@ -137,6 +144,11 @@ static int display_dram_config (void) DECLARE_GLOBAL_DATA_PTR; int i; +#ifdef CONFIG_SILENT_CONSOLE + if (gd->flags & GD_FLG_SILENT) + return (0); +#endif + puts ("DRAM Configuration:\n"); for(i=0; i<CONFIG_NR_DRAM_BANKS; i++) { @@ -149,6 +161,12 @@ static int display_dram_config (void) static void display_flash_config (ulong size) { + DECLARE_GLOBAL_DATA_PTR; + +#ifdef CONFIG_SILENT_CONSOLE + if (gd->flags & GD_FLG_SILENT) + return; +#endif puts ("Flash: "); print_size (size, "\n"); } |