File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,16 +7,24 @@ prefix=$1
77# 注意 debian initrd 没有 xargs
88
99# 最后一个 tty 是主 tty,显示的信息最全
10- is_first=true
1110if [ " $( uname -m) " = " aarch64" ]; then
1211 ttys=" ttyS0 ttyAMA0 tty0"
1312else
1413 ttys=" ttyS0 tty0"
1514fi
1615
16+ # 安装环境下 tty 不一定齐全
17+ # hytron 有ttyS0 但无法写入
18+ # 用于 cmdline 引导参数时不需要判断 tty 是否存在和可写
19+ if [ " $prefix " = " console=" ]; then
20+ is_for_cmdline=true
21+ else
22+ is_for_cmdline=false
23+ fi
24+
25+ is_first=true
1726for tty in $ttys ; do
18- # hytron 有ttyS0 但无法写入
19- if stty -g -F " /dev/$tty " > /dev/null 2>&1 ; then
27+ if $is_for_cmdline || stty -g -F " /dev/$tty " > /dev/null 2>&1 ; then
2028 if $is_first ; then
2129 is_first=false
2230 else
@@ -25,7 +33,7 @@ for tty in $ttys; do
2533
2634 printf " %s" " $prefix$tty "
2735
28- if [ " $prefix " = " console= " ] &&
36+ if $is_for_cmdline &&
2937 { [ " $tty " = ttyS0 ] || [ " $tty " = ttyAMA0 ]; }; then
3038 printf " ,115200n8"
3139 fi
You can’t perform that action at this time.
0 commit comments