Search code examples
linuxttyprintk

Send printk to serial


I am trying to debug a module for the Linux kernel. I heard that it is possible to send the console output to a serial port. I'm running Ubuntu on vmware and want to send printk message to the host. I have managed to set up a serial Connection and can send an echo to the host by typing echo > simething /dev/ttyS1 But I can't figure out how to send the output on the console to ttyS1.

My main problem is that when the module/kernel crashes the last printk-messages are lost and not even displayed, it just buffers.


Solution

  • Try booting your kernel with the command line 'console=ttyS1,<baud>', where <baud> is the baud rate you configured for that port in the VM settings. The kernel will then use /dev/ttyS1 as the main console, and that's where printk will send all of its output to.