how to redirect the output of serial console (e.g. /dev/ttyS0) to a buffer or file

你离开我真会死。 提交于 2019-12-24 12:19:03

问题


Is it possible to pipe serial console output to a file or a buffer or some virtual or pseudo device (in /dev)? The Kernel command line has in startup at this point "console=null,115200". (Normally it has "console=ttyS0,115200" - my requirement is: if "console=null,115200", should the output go to some other place than ttyS0, e.g. a virtual or pseudo device or to a file/buffer)

Maybe somebody know if there is good solution available?

Thanks a lot in advance!


回答1:


There are two ways that I am aware of :-

First way :-

get ttylog from sourceforge :-

http://sourceforge.net/projects/ttylog/files/latest/download

Fire the below command:-

nohup ttylog -b 115200 -d /dev/ttyS0 > log.txt

this will then show you the PID of the process that is running, you now need to disown that PID so it doesn't get killed when you log out. Note that 115200 is the serial port speed/baud rate you configured grub for on the box you are monitoring.

Second way :-

Setup a serial console from system under test to some other linux/windows box. In case of linux install minicom and set minicom to listen on the serial port define in grub of system under test. Save that as dfl. You are good to go for more info :-

https://www.kernel.org/doc/Documentation/serial-console.txt



来源:https://stackoverflow.com/questions/17406039/how-to-redirect-the-output-of-serial-console-e-g-dev-ttys0-to-a-buffer-or-fi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!