Search by Tags

Configuring Serial Port Debug Console (Linux/U-Boot)

 
Applicable for

Compare with Revision




Subscribe for this article updates

On our Toradex modules the U-Boot boot loader and the Linux kernel use UART_A as serial debug console. The serial console is the primary and most reliable interface to the boot loader and Linux kernel. We do not recommend to use UART_A for any other purpose. Disabling it prevents analysing errors (e.g. crash of the user interface) or controlling the system if in an non-bootable state. However, if your design requires to disable the serial console entirely this article shows what needs to be done.

Note: This article shows how to disable the debug messages on the serial console only. In case you would like to disable debug messages or the virtual console on graphical output (DVI-I, HDMI, LVDS or VGA) please refer the Framebuffer (Linux) article.

Disable U-Boot Console Output on UART_A

Custom U-Boot

The following config options need to be defined in the respective board header file to quiet messages on the serial console:

CONFIG_SILENT_CONSOLE
CONFIG_SYS_DEVICE_NULLDEV
CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC

For enabling silent console append the environment variable 'silent=1' to CONFIG_EXTRA_ENV_SETTINGS in respective board header file.
Please refer to the following article concerning setup/compilation of the same:

Build U-Boot and Linux Kernel from Source Code

Note: Enabling silent console just bypasses the console messages to null. Depending on the module type and U-Boot version you might still be able to interrupt U-Boot by pressing the specified key which allows you to control the U-Boot at run time.

Disable most Log Messages from Linux Kernel

To get less debug messages from the Linux Kernel one can use the "quiet" Kernel parameter.

# setenv defargs '${defargs} quiet'
# saveenv

Disable Linux Kernel Console Output on UART_A

Disable the console from kernel completely by setting the console= option on the kernel command line. This can be achieved by doing it from U-Boot prompt or using U-Boot-envtools under Linux to modify the env variables:

# setenv console null
# saveenv

or
using U-Boot-envtools under Linux:

# fw_setenv console null
# reboot

After this no kernel messages/serial login are available on debug serial port any more. To re-enable the debug serial port console one need to reset the 'console' variable back to respective serial tty(e.g: ttyLP0 on Colirbi VFxx).

# setenv console ttyLP0
# saveenv

or
using U-Boot-envtools under Linux:

# fw_setenv console ttyLP0
# reboot

Configure Baudrate for Serial Getty on UART_A

While during boot the serial baudrate is taken from the U-Boot environment variable baudrate the later login shell baudrate needs to be configured separately if required in resp. /etc/systemd/system/getty.target.wants/serial-getty@<serial device>.service file:

i.MX 6/7:
/etc/systemd/system/getty.target.wants/serial-getty@ttymxc0.service
Tegras:
/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service

Disable Serial Getty on UART_A

Newer BSPs always start an explicit serial getty on UART_A which can be disabled as follows:

# systemctl disable serial-getty@ttyS0.service

An interesting blog post from Mr. Poettering about the thematic can be found here.