Ubuntu串口控制台登录
电脑硬件:QOTOM Q300P[ubuntu],Q600P[windows10]
Windows串口使用COM4
Ubuntu串口使用第一个/dev/ttyS0,115200 baud 8n1
配置Grub
编辑/etc/default/grub并添加以下代码:
1
2
3GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"修改完成后的代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19...
GRUB_DEFAULT=0
#GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
...更新grub
1
sudo update-grub
修改ttyS0配置文件
添加ttyS0配置
1
root@ubuntu:/# vim /etc/init/ttyS0.conf
添加如下代码:
1
2
3
4
5
6
7
8
9
10# 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]
stop on runlevel [!2345]
respawn
exec /sbin/getty -L 115200 ttyS0 vt100
WIN10测试结果
使用putty进行串口连接成功