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 2 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
8 changes: 7 additions & 1 deletion installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ 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 +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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also set the CONSOLE_PORT here if CONSOLE_PORT is not set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan there is a default CONSOLE_PORT definition in line 68, are you suggesting to remove it and apply the same procedure to it with CONSOLE_SPEED?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question, do you know if line 83 will always be successful? will the /proc/cmdline always match and get you the CONSOLE_SPEED? if line 83 fails to match, what should be our CONSOLE_SPEED? Can you add a fall-back, say if CONSOLE_SPEED is null, then we set to the default value 9600?

I had thought twice. We can use same approach for CONSOLE_PORT as this one won't change and each platform vendor can hard-code it. we can probably derive this in ONIE environment as well, but it needs more testing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you use stty approach in the initial commit, why change to read from /proc/cmdline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guohan I have tested to install from the different version of ONIE as well as SONiC. Line 83 works well and always can get the speed and port, anyway I added fallback for both port and speed in case not able to get them from cmdline, they will be set to 9600 and ttyS0.

I switch to use cmdline just because of it much easier to get the current ttyS and speed of the installing enviroment. If use stty need to find out which ttyS it is using first.

please chek my latest commit.


# 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