consolettyprintk

How can I send printk message into ttyS0?


I'm trying to debug my PC using laptop and serial port.

So, I wanna get some printk log from tty connected laptop.

I referred this sites (https://help.ubuntu.com/community/SerialConsoleHowto), and I already set all of console setup on my laptop and I also saw the login session from laptop.

However, despite all my effort, I couldn't get the printk log message at the tty console (I also set /proc/sys/kernel/printk as 7417 to get all the message of printk).

The curious thing is, my local console (ctrl + alt + f1~f6) are printing the printk log at the same time.

So, how can I get printk message from tty connected host device?

thnks,


Solution

  • This command

    dmesg -wH &
    

    could be used to force all your kernel messages, that are printed to dmesg (and also the virtual terminals like Ctrl+Alt+F1 , depending on your /proc/sys/kernel/printk log level and a level of your message), to also appear at your SSH or GUI console: Konsole, Terminal or whatever you are using! Should also work for ttyS0 console, I hope. And, if you need to monitor only for the specific messages:

    dmesg -wH | grep ERR &
    

    I'm using it to monitor for the "ERROR" messages like

    printk(KERN_EMERG "ERROR!\n");
    

    that I printk from my driver