首页 行业资讯 宠物日常 宠物养护 宠物健康 宠物故事

如何将ubuntu控制台输出到串口

发布网友 发布时间:2022-04-23 14:38

我来回答

1个回答

热心网友 时间:2023-07-12 19:55

操作步骤:

1、修改/etc/default/grub
## Modify this line by leekwen
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"

## Modify this line by leekwen
GRUB_TERMINAL=serial

## Add this line by leekwen
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

2、运行update-grub命令

3、增加配置文件/etc/init.d/ttyS0.conf

leekwen@leekwen:/etc/default$ cat /etc/init/ttyS0.conf
# Add those lines
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ttyS0 vt100

# Add those lines End

4、查看设置是否成功
重启电脑
# cat /proc/cmdlineBOOT_IMAGE=/boot/vmlinuz-3.13.0-32-generic root=/dev/sda1 ro console=tty0 console=ttyS2,115200n8
# who
latelee ttyS2

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com