首页 > 系统相关 >linux Usb serial console

linux Usb serial console

时间:2023-02-14 17:25:32浏览次数:53  
标签:console Usb grub GRUB serial SERIAL USB

ubuntu

Usb serial console 能够把下电时打印输出到串口上,可以记录,而netconsole只能输出下电到disk 之前的打印

  1. Usb串口线,ftdi或pl2303都可以
  2. 如果是ubuntu,需要重新编译内核,CONFIG_USB_SERIAL_CONSOLE=y

CONFIG_USB_SERIAL=y,其他可以把ftdi或pl2303编译进内核。注2

  1. 编辑/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

相关文章

  • 使用Arduino IDE测试ESP32-WROOM显示No Serial Data Received提示以及串口监视器空白
    如果你使用ArduinoIDE测试刚买来的ESP32-WROOM的好坏,但是按照教程上传程序但是显示NoSerialDataReceived。包括但不限于以下原因:上传程序用的microUSB线有问题,这种......
  • usb 2.0 request
           ......
  • 使用Wireshark捕捉USB通信数据
    使用Wireshark捕捉USB通信数据USB,是英文UniversalSerialBus(通用串行总线)的缩写,而其中文简称为“通串线”,是一个外部总线标准,用于规范电脑与外部设备的连接和通讯。USB接......
  • USB插拔数据控制传输
       USBMassStorage中的BBB协议、SCSI协议的命令块传输传输,USB插拔数据1.控制传输部分第二周->三、BusHound抓包学习->2.USB插拔数据->控制传输、2.数据传输......
  • USB控制传输
    一个USB的控制传输如图所示:这里写图片描述一个usb的控制传输分为2个或3个阶段,setupstage,datastage(视情况而定),statusstage。一:首先是setupstage,usbhost总是先发起第......
  • 制作可引导的USB_win11
    制作windows11可引导的USB​准备一个至少8GU盘​1.下载工具​​​https://www.microsoft.com/zh-cn/software-download/windows11​​2.双击运行学会拒绝,是内心走向强大的......
  • 安卓手机自动开启USB网络共享
    (1封私信/83条消息)安卓手机如何自动启用USB网络共享??-知乎(zhihu.com)首先开发手机开发者模式然后去手机开发者模式中去找 默认USB设置点进去选择 设置USB网......
  • usb 2.0枚举过程
    device枚举过程:hub枚举过程: ......
  • usb 2.0 packet
          注意PID[7:0]={~pid[3:0],pid[3:0]}  ......
  • CSharp: XML Serialize and Deserialize
     usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Xml.Serialization;usingSystem.Xml;namespaceDuFullCa......