From 1d3501328aeb7ec32037058966b746b3894450ca Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Mon, 27 Aug 2018 05:38:22 +0300 Subject: [PATCH 1/3] pick up console speed from install enviroment --- installer/x86_64/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 874dc8d13da0..e8542775725c 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -67,7 +67,12 @@ echo "onie_platform: $onie_platform" # default console settings CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -CONSOLE_SPEED=9600 + +# Pick up console speed from install enviroment, if failed, set it to 9600 +CONSOLE_SPEED=$(stty -F /dev/ttyS0 | grep speed | cut -d " " -f2) +if [ -z "$CONSOLE_SPEED" ]; then + CONSOLE_SPEED=9600 +fi # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" From 2c044d77542e00c3cd16c76c5db369d5b180dad2 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 28 Aug 2018 14:53:35 +0300 Subject: [PATCH 2/3] get console speed from /proc/cmdline --- installer/x86_64/install.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index e8542775725c..c9c8e0d248b0 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -68,12 +68,6 @@ echo "onie_platform: $onie_platform" CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -# Pick up console speed from install enviroment, if failed, set it to 9600 -CONSOLE_SPEED=$(stty -F /dev/ttyS0 | grep speed | cut -d " " -f2) -if [ -z "$CONSOLE_SPEED" ]; then - CONSOLE_SPEED=9600 -fi - # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" @@ -82,6 +76,13 @@ VAR_LOG_SIZE=4096 [ -r platforms/$onie_platform ] && . platforms/$onie_platform +# Pick up console speed from install enviroment if not defined yet. +# Console speed setting in cmdline is like "console=ttyS0,9600n", +# so we can use pattern 'console=ttyS[0-9]+,[0-9]+' to match it +if [ -z "$CONSOLE_SPEED" ]; then + CONSOLE_SPEED=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2) +fi + # Install demo on same block device as ONIE if [ "$install_env" != "build" ]; then onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') From ef6b5141571e328dceeef038dd2b4ef3a41dfb6e Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Fri, 31 Aug 2018 13:48:15 +0300 Subject: [PATCH 3/3] add CONSOLE_PORT handle --- installer/x86_64/install.sh | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index c9c8e0d248b0..e39ed9727473 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -64,10 +64,6 @@ fi echo "onie_platform: $onie_platform" -# default console settings -CONSOLE_PORT=0x3f8 -CONSOLE_DEV=0 - # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" @@ -76,11 +72,34 @@ VAR_LOG_SIZE=4096 [ -r platforms/$onie_platform ] && . platforms/$onie_platform -# Pick up console speed from install enviroment if not defined yet. -# Console speed setting in cmdline is like "console=ttyS0,9600n", -# so we can use pattern 'console=ttyS[0-9]+,[0-9]+' to match it +# Pick up console port and speed from install enviroment if not defined yet. +# Console port and speed setting in cmdline is like "console=ttyS0,9600n", +# so we can use pattern 'console=ttyS[0-9]+,[0-9]+' to match it. +# If failed to get the speed and ttyS from cmdline then set them to default: ttyS0 and 9600 +if [ -z "$CONSOLE_PORT" ]; then + console_ttys=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+' | cut -d "=" -f2) + if [ -z "$console_ttys" -o "$console_ttys" = "ttyS0" ]; then + CONSOLE_PORT=0x3f8 + CONSOLE_DEV=0 + elif [ "$console_ttys" = "ttyS1" ]; then + CONSOLE_PORT=0x2f8 + CONSOLE_DEV=1 + elif [ "$console_ttys" = "ttyS2" ]; then + CONSOLE_PORT=0x3e8 + CONSOLE_DEV=2 + elif [ "$console_ttys" = "ttyS3" ]; then + CONSOLE_PORT=0x2e8 + CONSOLE_DEV=3 + fi +fi + if [ -z "$CONSOLE_SPEED" ]; then - CONSOLE_SPEED=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2) + speed=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2) + if [ -z "$speed" ]; then + CONSOLE_SPEED=9600 + else + CONSOLE_SPEED=$speed + fi fi # Install demo on same block device as ONIE