Files
reinstall/ttys.sh
bin456789 3d3f3488e0 core: 不需要判断 tty 能否写入
而且安装环境下 tty 不一定齐全
2026-04-26 21:59:07 +08:00

31 lines
638 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
prefix=$1
# 不要在 windows 上使用,因为不准确
# 在原系统上使用,也可能不准确?例如安装了 cloud 内核的甲骨文?
# 注意 debian initrd 没有 xargs
# 最后一个 tty 是主 tty显示的信息最全
if [ "$(uname -m)" = "aarch64" ]; then
ttys="ttyS0 ttyAMA0 tty0"
else
ttys="ttyS0 tty0"
fi
is_first=true
for tty in $ttys; do
if $is_first; then
is_first=false
else
printf " "
fi
printf "%s" "$prefix$tty"
if [ "$prefix" = "console=" ] &&
{ [ "$tty" = ttyS0 ] || [ "$tty" = ttyAMA0 ]; }; then
printf ",115200n8"
fi
done