Skip to content

Commit f0443bd

Browse files
authored
Update program_console_speed() in rc.local #22458 (#1811)
This is the double commit of sonic-net/sonic-buildimage#22458 #### Why I did it The --keep-baud option in agetty allows it to cycle through a set of baud rates (like 115200,57600,38400,9600) when it receives a break signal. This feature helps ensure that agetty can seamlessly adjust to different terminal speeds, enhancing compatibility across various setups. Challenges with the sed Command: Our current sed command (program_console_speed in rc.local ) is intended to update the baud rates in the serial-getty@.service based on the CONSOLE_SPEED variable. However, the command is not working as planned because the pattern --keep-baud .* %I doesn't match when %I isn't part of the file's content. #### How I did it To make the sed command more effective, we can simplify the matching pattern to focus solely on the baud rate list: sed -i "s|\-\-keep\-baud .* -| $CONSOLE_SPEED -|g" /lib/systemd/system/serial-getty@.service This adjustment should ensure that the command correctly updates the baud rate settings. #### How to verify it Verify serial-getty@.service before and after modifying rc.local Before update =========== ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,57600,38400,9600 - $TERM After Update ========== ExecStart=-/sbin/agetty -o '-p -- \\u' 115200 - $TERM #### Tested branch (Please provide the tested image version) 202501 Note: sonic-net/sonic-buildimage#24506
1 parent 415f5a8 commit f0443bd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

files/image_config/platform/rc.local

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ program_console_speed()
198198
# Subsequent boots may have new baud rate without finding keep-baud argument
199199
grep agetty /lib/systemd/system/serial-getty@.service |grep keep-baud
200200
if [ $? = 0 ]; then
201-
sed -i "s|\-\-keep\-baud .* %I| $CONSOLE_SPEED %I|g" /lib/systemd/system/serial-getty@.service
201+
sed -i "s|\-\-keep\-baud .* -| $CONSOLE_SPEED -|g" /lib/systemd/system/serial-getty@.service
202202
else
203-
sed -i "s|u' .* %I|u' $CONSOLE_SPEED %I|g" /lib/systemd/system/serial-getty@.service
203+
sed -i "s|u' .* -|u' $CONSOLE_SPEED -|g" /lib/systemd/system/serial-getty@.service
204204
fi
205205

206206
# Reload systemd config

0 commit comments

Comments
 (0)