ubuntu
Usb serial console 能够把下电时打印输出到串口上,可以记录,而netconsole只能输出下电到disk 之前的打印
- Usb串口线,ftdi或pl2303都可以
- 如果是ubuntu,需要重新编译内核,CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_USB_SERIAL=y,其他可以把ftdi或pl2303编译进内核。注2
- 编辑/etc/default/grub
找到GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 替换成 GRUB_CMDLINE_LINUX_DEFAULT="debug ignore_loglevel console=tty0 console=ttyUSB0,115200n8 ",注意Ubuntu需要加ignore_loglevel4. centos执行grub2-mkconfig –o /boot/grub2/grub.cfg (grub.cfg也可能在/boot/efi/里)。Ubuntu执行update-grub5. reboot6. Ubuntu会显示login,原因是systemd主动把ttyUSB0加到getty了,可以chmod a-x /lib/systemd/system-generators/system-getty-generator
附录参考
注1:
Serial Console
Serial console enables one to dump out console messages over a serial cable. Most modern PCs do not have legacy serial ports, so instead, one can use a USB serial dongle instead. A "null serial cable" or "universal file transfer cable" is needed to connect the target computer with the host. Most commonly this will be a DB9 female to DB9 female null serial cable. In addition, one needs to enable USB serial support as a kernel build configuration:
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_USB_SERIAL=y
and enable the appropriate driver, e.g.:
CONFIG_USB_SERIAL_PL2303=y
and boot this kernel with
console=ttyUSB0,9600n8
one may need to adjust the baud rate appropriately.
Note: Generally, there is NO hardware or software flow control on serial console drivers, which means one may get dropped characters when running very high speed tty baud rates, such as 115200 baud.
注2,ubuntu 内核编译
1.下载对应源码 apt-get source linux-image-$(uname -r)
2.安装编译工具略
https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
centos8+ASUA B560M-Plus
centos8中的默认串口为ttyS0
首先连接串口线:如下图
修改grub配置:
打开/etc/default/grub,增加如下配置。
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200"
更新grub
grub2-mkconfig -o /boot/grub2/grub.cfg
用其他电脑连接串口。
标签:console,Usb,grub,GRUB,serial,SERIAL,USB From: https://www.cnblogs.com/zjxcyr/p/17120225.html