AMD R2000 Bilby 单板 串口在Grub和Linux下的使用

2024-07-19 08:12:01 浏览数 (3)

Ubuntu 20启动时,自动加载了UART驱动,系统启动信息含有UART的相关信息。

代码语言:javascript复制
[    2.418748] printk: console [ttyS4] disabled
[    2.418757] AMDI0020:00: ttyS4 at MMIO 0xfedc9000 (irq = 3, base_baud = 3000000) is a 16550A
[    2.418820] printk: console [ttyS4] enabled
[    2.424359] printk: console [ttyS4] printing thread started

使用命令 “echo “hello” > /dev/ttyS4 ” , 在串口能得到字符串“hello”。

代码语言:javascript复制
Ubuntu 20.04.6 LTS Bilby-RV1-R2314ttyS4

Bilby-RV1-R2314 login: 
hello
hello
hello
hello

修改/etc/default/grub文件, 增加下面“GRUB_TERMINAL_OUTPUT”行,串口上看得到 grub 菜单。

代码语言:javascript复制
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
GRUB_TERMINAL_OUTPUT="gfxterm console"

串口上看到的grub 菜单:

代码语言:javascript复制
*Ubuntu                                                                                                                     
Advanced options for Ubuntu 

串口上也能看到的grub的输出信息:

代码语言:javascript复制
The highlighted entry will be executed automatically in 5s.                                                                    
The highlighted entry will be executed automatically in 4s.                                                                    
The highlighted entry will be executed automatically in 3s.                                                                    
The highlighted entry will be executed automatically in 2s.                                                                    
The highlighted entry will be executed automatically in 1s.                                                                    
The highlighted entry will be executed automatically in 0s.       

修改/etc/default/grub文件, 增加参数"console=tty0 console=ttyS4,115200n8",串口上看得到 Linux的启动信息,也能有Linux的登陆界面,可以交互执行命令。

代码语言:javascript复制
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS4,115200n8"

Linux的串口界面:

代码语言:javascript复制
Ubuntu 20.04.6 LTS Bilby-RV1-R2314 ttyS4

Bilby-RV1-R2314login: root    xilinx

Password: 
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 6.1.70-rt21  x86_64)

* Documentation:  https://help.ubuntu.com
* Management:     https://landscape.canonical.com
* Support:        https://ubuntu.com/advantage

Expanded Security Maintenance for Applications is not enabled.

147 updates can be applied immediately.
110 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

8 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm

New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login:  7 18 15:46:07 CST 2024 on ttyS4

Ubuntu 重启动,也能看到打印。

代码语言:javascript复制
xilinx@Bilby-RV1-R2314[  202.311794] reboot: Restarting system

0 人点赞