]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Added config option CONFIG_SILENT_CONSOLE. See doc/README.silent LABEL_2003_10_10_1200
authorwdenk <wdenk>
Fri, 10 Oct 2003 10:05:42 +0000 (10:05 +0000)
committerwdenk <wdenk>
Fri, 10 Oct 2003 10:05:42 +0000 (10:05 +0000)
for more information

12 files changed:
CHANGELOG
common/cmd_bootm.c
common/console.c
common/main.c
doc/README.silent [new file with mode: 0644]
include/asm-arm/global_data.h
include/asm-i386/global_data.h
include/asm-mips/global_data.h
include/asm-nios/global_data.h
include/asm-ppc/global_data.h
include/configs/trab.h
lib_arm/board.c

index ab68eb411426e48d70d790709b3d052fa6256cd4..8e70868ca01a0360635f06bbc9d1dea56cbee426 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
 
index 79b763ec13648f129a404669f089e965a91c0423..8bac1be46012ee9211ad618a2f4bcea865d6f13f 100644 (file)
@@ -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,
index 3ef60fd7ac39dd2c6b4b8e02f4b908867280883b..da49c968272068235ac79edbd9ef7a520eea3d68 100644 (file)
@@ -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));
index d08bc47d73604ee5bc053e6f5fd0aae9d4ee122c..73f8ff9f0bed86169cf5e5f83c10ccb240790c90 100644 (file)
@@ -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 (file)
index 0000000..f2628a6
--- /dev/null
@@ -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.
index b5878cae9a1583f230ea34ac57496bbf3f9f1bd2..c2d52915a85fc4816dcff69c47e240a98462de8a 100644 (file)
@@ -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")
 
index 4ffbc074bc77922590248e24cd07a61cf3f5a46a..1d309d5b50f8cca3d0ddaae06e7013b20b1ef677 100644 (file)
@@ -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;
 
index 3ecf555501a8d61e477e23ff5db7bf5302236106..a024194ba32498e532d40cb9f3b2c1ce37d0e5eb 100644 (file)
@@ -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")
 
index 75dd3fca551b3f9e6354c33451873e4184b27585..935d08e54bdc74462210d0c0258d1a2cdcf3af08 100644 (file)
@@ -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")
 
index f17a764a1ab7f34caf3ea4d0416879bf35276870..c1bef37217f2fe701948b0689f5400dc694ba511 100644 (file)
@@ -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")
index 86c3f83f099bd17e4d3c8ee970b43111e8565694..0e6ffd90ba19af38dd3db6445f0175131d054f2d 100644 (file)
@@ -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:
index 493112d55ed1a35212e82b4b72871e6a8e1e33c2..f3f831f4fbeb4657b99c3f3bdbf0e6a38152b5dd 100644 (file)
@@ -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");
 }