[英]How to switch linux kernel console after boot process?
On my embedded system I usually use /dev/ttyS0 as a main console. 在我的嵌入式系统上,我通常使用/ dev / ttyS0作为主控制台。 This is achieved by passing kernel parameter
console=/dev/ttyS0
and when init
takes its part, getty
is fired on the same device as specified in inittab
by eg. 这是通过传递内核参数
console=/dev/ttyS0
,当init
占用它时, getty
会在inittab
指定的同一设备上触发,例如。 ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
. ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
。
Is there any possibility to change these settings without restart and switch the console to another terminal like ttyS1
, ttyUSBx
or even some pseudo tty? 是否有可能在不重启的情况下更改这些设置并将控制台切换到另一个终端,如
ttyS1
, ttyUSBx
甚至是一些伪tty?
It seems that perhaps you don't actually want the console log messages on another device, but are only proposing to redirect them there to stop them from interfering with binary transfers on the primary serial device. 看起来您可能实际上并不想在另一台设备上使用控制台日志消息,但只是建议将它们重定向到那里以阻止它们干扰主串行设备上的二进制传输。
If that is the case, you may be able to solve your problem by dynamically adjusting the console log level. 如果是这种情况,您可以通过动态调整控制台日志级别来解决问题。
http://tuxthink.blogspot.com/2012/07/printk-and-console-log-level.html http://tuxthink.blogspot.com/2012/07/printk-and-console-log-level.html
Suggests that you can do this by writing to a proc node: 建议您可以通过写入proc节点来完成此操作:
echo "6" > /proc/sys/kernel/printk
Would set it to 6 in their example. 在他们的例子中将它设置为6。 I suspect setting it to 0 or 1 would work for your purposes - if something goes that wrong, your binary transfer is probably failed anyway.
我怀疑将其设置为0或1可以用于您的目的 - 如果出现问题,您的二进制传输可能无论如何都会失败。
Log entries should still be retrievable by dmesg regardless of this setting. 无论此设置如何,日志条目仍应由dmesg检索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.