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
#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)
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;
" '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,
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)
{
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));
{
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
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;
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 */
--- /dev/null
+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.
*/
#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")
*/
#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;
*/
#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")
/* 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")
*/
#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")
#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:
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",
printf ("IRQ Stack: %08lx\n", IRQ_STACK_START);
printf ("FIQ Stack: %08lx\n", FIQ_STACK_START);
#endif
+
return (0);
}
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++) {
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");
}