1
0
Fork 0

Added config option CONFIG_SILENT_CONSOLE. See doc/README.silent

for more information
utp
wdenk 2003-10-10 10:05:42 +00:00
parent 5da627a424
commit f72da3406b
12 changed files with 133 additions and 4 deletions

View File

@ -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

View 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,

View 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));

View 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 */

22
doc/README.silent 100644
View File

@ -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.

View 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")

View 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;

View 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")

View 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")

View 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")

View 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:

View 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");
}