From 7bae388e2f35abd4e20b22068ad933e766b14162 Mon Sep 17 00:00:00 2001 From: dflynn-Nokia <60479697+dflynn-Nokia@users.noreply.github.com> Date: Thu, 26 Aug 2021 10:14:34 -0400 Subject: [PATCH] [Nokia ixs7215] Add support for changing the console baud rate (#8595) This commit adds support for changing the default console baud rate configured within the U-Boot bootloader. That default baud rate is exposed via the value of the U-Boot 'baudrate' environment variable. This commit removes logic that hardcoded the console baud rate to 115200 and instead ensures that the U-Boot 'baudrate' variable is always used when constructing the Linux kernel boot arguments used when booting Sonic. A change is also made to rc.local to ensure that the specified baud rate is set correctly in the serial getty service. --- files/image_config/platform/rc.local | 12 +++++++++++- platform/marvell-armhf/platform.conf | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index b63caef0f4a5..57fd8c4b062b 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -186,7 +186,17 @@ program_console_speed() CONSOLE_SPEED=$speed fi - sed -i "s|\-\-keep\-baud .* %I| $CONSOLE_SPEED %I|g" /lib/systemd/system/serial-getty@.service + # Set correct baud rate in getty service + # First boot will find keep-baud argument with multiple baud rates as per Debian convention + # Subsequent boots may have new baud rate without finding keep-baud argument + grep agetty /lib/systemd/system/serial-getty@.service |grep keep-baud + if [ $? = 0 ]; then + sed -i "s|\-\-keep\-baud .* %I| $CONSOLE_SPEED %I|g" /lib/systemd/system/serial-getty@.service + else + sed -i "s|u' .* %I|u' $CONSOLE_SPEED %I|g" /lib/systemd/system/serial-getty@.service + fi + + # Reload systemd config systemctl daemon-reload } diff --git a/platform/marvell-armhf/platform.conf b/platform/marvell-armhf/platform.conf index 651b01bea18d..b0be99a8e69e 100644 --- a/platform/marvell-armhf/platform.conf +++ b/platform/marvell-armhf/platform.conf @@ -45,9 +45,9 @@ elif [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then fdt_fname="/boot/armada-385-ipd6448m.dtb" - BOOTARGS='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}' + BOOTARGS='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs}' UBI_LOAD='scsi init; ext4load scsi 0:2 $kernel_addr $image_name; ext4load scsi 0:2 $fdt_addr $fdt_name; ext4load scsi 0:2 $initrd_addr $initrd_name' - BOOTARGS_OLD='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}' + BOOTARGS_OLD='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs_old}' UBI_LOAD_OLD='scsi init; ext4load scsi 0:2 $kernel_addr $image_name_old; ext4load scsi 0:2 $fdt_addr $fdt_name_old; ext4load scsi 0:2 $initrd_addr $initrd_name_old' UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr' UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'