本文介绍了如何将串行控制台的输出(例如/dev/ttyS0)重定向到缓冲区或文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将串行控制台输出传递到文件,缓冲区或某些虚拟或伪设备(在/dev中)?内核命令行此时已启动"console = null,115200".(通常它具有"console = ttyS0,115200"-我的要求是:如果"console = null,115200",则输出应转到ttyS0以外的其他位置,例如虚拟设备或伪设备还是文件/缓冲区)

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?

非常感谢!

推荐答案

我知道两种方法:-

第一种方式:-

从sourceforge获取ttylog:-

get ttylog from sourceforge :-

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

触发以下命令:-

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

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

然后将向您显示正在运行的进程的PID,现在您需要取消该PID,以便在注销时不会被杀死.请注意,115200是您在要监视的盒子上为grub配置的串行端口速度/波特率.

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.

第二种方式:-

从被测系统到其他Linux/Windows Box设置一个串行控制台.如果是linux,请安装minicom并将minicom设置为侦听被测系统grub中定义的串行端口.将其另存为dfl.您很乐意获取更多信息:-

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

这篇关于如何将串行控制台的输出(例如/dev/ttyS0)重定向到缓冲区或文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-22 09:28