Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[console speed] Inherit console speed from install environment #1987

Merged
merged 3 commits into from
Sep 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ fi

echo "onie_platform: $onie_platform"

# default console settings
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=9600

# Get platform specific linux kernel command line arguments
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX=""

Expand All @@ -77,6 +72,36 @@ VAR_LOG_SIZE=4096

[ -r platforms/$onie_platform ] && . platforms/$onie_platform

# 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
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
if [ "$install_env" != "build" ]; then
onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//')
Expand Down