Search code examples
linuxserial-portu-boot

Which serial port does linux kernel use for console?


When I boot my embedded linux system I see uboot messages through a serial test cable, but no messages after the “Starting kernel…” message. The system does successfully boot after about one minute. Based on "Problem #1" at this post I believe that the kernel has probably been configured to use a console port different than the port uboot is using. But the solution described at that post seems to require access to kernel build configuration files, which I don't have. How can I find which port the kernel uses for console output? Physical access to the port is difficult - can I find the information somewhere in /etc? Thanks!


Solution

  • /proc/consoles will show you what devices are used for the system console. See the Linux Kernel documentation for details. Below is sample output from my system.

    / # cat /proc/consoles
    ttyS0                -W- (EC p a)    4:64
    / #
    

    You can also look at /proc/cmdline to see what arguments were given to the Kernel when it was loaded (e.g. from u-boot). Below is some sample output.

    / # cat /proc/cmdline
    console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p3 rootwait
    / #