All the output sent to the console is useful when developing your application, but when deploying the final product, this may be quite undesirable. Since the software running on the board is actually a set of distinct code bases, we have to tweak a few different places for a truly silent boot.
The u-boot code already supports the notion of booting up silently. The document README.silent covers most of the details:
file: doc/README.silent
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". - CONFIG_SILENT_CONSOLE_UPDATE_ON_SET When the "silent" variable is changed with env set, the change will take effect immediately. - CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC Some environments are not available until relocation (e.g. NAND) so this will make the value in the flash env take effect at relocation. 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". - 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 CONFIG_SYS_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. If you don't want the linux command line to be affected, define CONFIG_SILENT_U_BOOT_ONLY in your board config file as well, and this part of the feature will be disabled.
Some things to note:
silent to disable u-boot output
Also note that U-Boot only adds console= to clear the default console. It does not touch earlyprintk= as this is a debug only option -- you need to remove this from your default command line yourself.
The Linux kernel too supports quieting the console output. This can be done in three ways. The first is to disable the console completely by using the console= option on the kernel command line. Since this may not be what you want during testing/development/deployment, you can also control the type of message which gets sent to the console by using the loglevel= option. The quiet option suppresses most messages; during a normal boot there won't be any.
The kernel-parameters.txt covers this briefly:
file: Documentation/kernel-parameters.txt
/* line 543 to 571 */
console= [KNL] Output console device and options.
tty<n> Use the virtual console device <n>.
ttyS<n>[,options]
ttyUSB0[,options]
Use the specified serial port. The options are of
the form "bbbbpnf", where "bbbb" is the baud rate,
"p" is parity ("n", "o", or "e"), "n" is number of
bits, and "f" is flow control ("r" for RTS or
omit it). Default is "9600n8".
See Documentation/serial-console.txt for more
information. See
Documentation/networking/netconsole.txt for an
alternative.
uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
Start an early, polled-mode console on the 8250/16550
UART at the specified I/O port or MMIO address,
switching to the matching ttyS device later. The
options are the same as for ttyS, above.
hvc<n> Use the hypervisor console device <n>. This is for
both Xen and PowerPC hypervisors.
If the device connected to the port is not a TTY but a braille
device, prepend "brl," before the device type, for instance
So to disable the console, all you need is literally console= or console=null.
The kernel-parameters.txt covers this briefly:
file: Documentation/kernel-parameters.txt
/* line 1446 to 1460 */ loglevel= All Kernel Messages with a loglevel smaller than the console loglevel will be printed to the console. It can also be changed with klogd or other programs. The loglevels are defined as follows: 0 (KERN_EMERG) system is unusable 1 (KERN_ALERT) action must be taken immediately 2 (KERN_CRIT) critical conditions 3 (KERN_ERR) error conditions 4 (KERN_WARNING) warning conditions 5 (KERN_NOTICE) normal but significant condition 6 (KERN_INFO) informational 7 (KERN_DEBUG) debug-level messages
So you can simply add loglevel=0 to the u-boot bootargs envvar. Now the kernel will only show emergency messages to the console rather than informational/debug.
If, at runtime, you wish to change the console log level, you can do this a few ways:
dmesg -n # to set the log level to #The syslog kernel function is pretty easy to utilize:
#include <unistd.h> #include <sys/syscall.h> static inline int syslog(int type, char *bufp, int len) { return syscall(SYS_syslog, type, bufp, len); } int main() { /* Set the console loglevel to 3 */ syslog(8, 0, 3); return 0; }
See the syslog(2) man page for more in-depth details of the syslog() system call.
The kernel-parameters.txt covers this briefly:
file: Documentation/kernel-parameters.txt
/* line 2476 to 2478 */ quiet [KNL] Disable most log messages
The busybox shell will display some helpful text at startup. This message can be disabled via the uClinux Vendor menuconfig:
uClinux-dist$ make config_menuconfig
Then navigate the menus:
BusyBox ---> [*] sh: Hide message on interactive shell startup
If you wish to disable the console altogether, then just add console= to the kernel command line option.
If you wish to disable the console shell on the serial port, turn off the CONFIG_USER_INIT_CONSOLE_SH build option in the uClinux Vendor menuconfig:
uClinux-dist$ make config_menuconfig
Then navigate the menus:
Core Applications ---> [*] init [ ] enable console shell
Complete Table of Contents/Topics

