Friday, July 24, 2015

Serial Console logging

To debug boot-up issues we need to configure Serial port as console in Kernel . We can easily collect dmesg information with this.

Steps to enable Serial logging :

1) Make sure serial driver statically built with kernel image . If it built as a module , we can not get bootup logs as it will not loaded at that time. If it is built as modules , make sure module name is added to /etc/modules.conf. So that module will be loaded .

2) Need to add kernel boot parameters for enabling serial port as console

Edit /etc/default/grub file

Replace  GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"  with

GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS4,115200n8 debug ignore_loglevel"

close the file and execute "sudo update-grub".

Make sure target system UART is connected to other system and configure UART.

Reboot the system and observe the logs will be displayed in both test system and Other system.

console=tty0  =>  the kernel to continue using the standard console device. Boot messges will be dispayed on target system monitor.

console=ttyS4 => the kernel to also use the first serial device as a console. ttySn , n will be the serial port device available.  grep dmesg with "ttyS" to find available ports in your system.

115200n8 sets the serial speed to 115200 bits per second with no parity and 8 data bits per character. The other end of the serial line also must be configured to same settings.

debug ignore_loglevel allows you to see ALL kernel messages on the configured console.

drm.debug=14 => if we need to enable drm specifc logs other than all logs.

log_buf_len=16M => set the dmesg buffer size to get all required logs.




4 comments:

  1. on_console_suspend - for debugging suspend/resume issues
    initcall_debug - also useful for suspend / resume issues debugging

    ReplyDelete
    Replies
    1. ignore_loglevel = To ignor log level

      Delete
    2. no_console_suspend - for debugging suspend/resume issues
      initcall_debug - also useful for suspend / resume issues debugging

      Delete
  2. $ cat /etc/init/ttyS4.conf
    start on stopped rc RUNLEVEL=[12345]
    stop on runlevel [!12345]

    respawn

    exec /sbin/getty -L 115200 ttyS4 vt102

    ReplyDelete