world leader in high performance signal processing
Trace: » silent_booting

Silencing the boot process

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.

Das U-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

scm failed with exit code 1:
file does not exist in git

Some things to note:

  • define CONFIG_SILENT_CONSOLE to enable support for silent mode
  • set the u-boot envvar silent to disable u-boot output
  • you should probably tweak the bootdelay to 1 second (or turn it off)
  • you can still interrupt u-boot by pressing the specified key (you won't see output, but your input will be processed)
  • you can use U-Boot tools under Linux to modify the bootdelay or silent env vars

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.

Linux Kernel

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.

console=

The kernel-parameters.txt covers this briefly:

file: Documentation/kernel-parameters.txt

scm failed with exit code 1:
file does not exist in git

So to disable the console, all you need is literally console= or console=null.

loglevel=

The kernel-parameters.txt covers this briefly:

file: Documentation/kernel-parameters.txt

scm failed with exit code 1:
file does not exist in git

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:

  • from the shell, run dmesg -n # to set the log level to #
  • from your code, call the syslog kernel function

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.

quiet

The kernel-parameters.txt covers this briefly:

file: Documentation/kernel-parameters.txt

scm failed with exit code 1:
file does not exist in git

Busybox shells

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

Disabling the console

If you wish to disable the console altogether, then just add console= to the kernel command line option.

Disabling the console shell

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