the command dmesg | grep console
returns:
Kernel command line: console=ttys6,115200 root=/dev/mmcblk1p2
rootwait rw
console [ttys6] enabled
I want to change this to ttys3 after booting. Is it possible?
consolelinuxtty
the command dmesg | grep console
returns:
Kernel command line: console=ttys6,115200 root=/dev/mmcblk1p2
rootwait rw
console [ttys6] enabled
I want to change this to ttys3 after booting. Is it possible?
Best Answer
The man page for tty_ioctl lists the ioctl TIOCCONS. When applied to an open file descriptor of a tty it will redirect future output intended for
/dev/console
to that tty.You can use this in a simple perl script. Create and
chmod +x
a file mysetconsole holding the following:Assuming you can open the wanted device, use it simply as
You will not be able to use it again until you set the console back to
/dev/console
, withYou may get perl warnings about
_FORTIFY_SOURCE
which can be ignored. You will need rpm packageperl-IO-Tty
or debian packagelibio-pty-perl
. If you prefer you can just look for the definition of TIOCCONS in the system include files. I found mine in:Your perl script can then just be