Skip to content

Commit 876b031

Browse files
committed
[console speed] lock console speed to start up speed
Auto negotiating console speed could cause sonic to lock on a wrong speed under rare conditions. The only way to come out of the wrong speed is to issue line break or restart console service with forced speed, or reboot sonic. Lock down the console speed to avoid these situations. Signed-off-by: Ying Xie <[email protected]>
1 parent e5a031b commit 876b031

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

files/image_config/platform/rc.local

+15
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ process_reboot_cause() {
128128
echo "Unexpected reboot" > $REBOOT_CAUSE_FILE
129129
}
130130

131+
program_console_speed()
132+
{
133+
speed=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2)
134+
if [ -z "$speed" ]; then
135+
CONSOLE_SPEED=9600
136+
else
137+
CONSOLE_SPEED=$speed
138+
fi
139+
140+
sed -i "s|\-\-keep\-baud .* %I| $CONSOLE_SPEED %I|g" /lib/systemd/system/[email protected]
141+
systemctl daemon-reload
142+
}
143+
131144
#### Begin Main Body ####
132145

133146
# Set up previous and next reboot cause files
@@ -209,6 +222,8 @@ fi
209222

210223
. /host/machine.conf
211224

225+
program_console_speed
226+
212227
if [ -f $FIRST_BOOT_FILE ]; then
213228

214229
echo "First boot detected. Performing first boot tasks..."

0 commit comments

Comments
 (0)