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

fixed serial console for syslinux #2650

Merged
merged 7 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions usr/share/rear/conf/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2904,8 +2904,15 @@ SIMPLIFY_TEAMING=no
# are set when booting the rescue/recovery system (see KERNEL_CMDLINE above).
# IA64 platforms do require it, and sometimes people still use serial console
# e.g. when no VGA console is available (say y, n or leave empty to autodetect):
# This config value may change in the near future and may merge with SERIAL_CONSOLE_DEVICE_SYSLINUX.
USE_SERIAL_CONSOLE=

# Since syslinux does not work with more then one serial device at once it must be explicitly named.
# Here you can configute the serial console device to use e.g. 'SERIAL_CONSOLE_DEVICE_SYSLINUX=/dev/ttyS0' when USE_SERIAL_CONSOLE is turned on.
# By default (when unset) all found serial devices are used.
# This config value may change in the near future and may get merged with USE_SERIAL_CONSOLE.
SERIAL_CONSOLE_DEVICE_SYSLINUX=

# Say "y", "Yes", etc, to enable or "n", "No" etc. to disable the DHCP client protocol or leave empty to autodetect.
# When enabled, lets the rescue/recovery system run dhclient to get an IP address
# instead of using the same IP address as the original system:
Expand Down
13 changes: 9 additions & 4 deletions usr/share/rear/lib/bootloader-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,17 @@ function make_syslinux_config {
SYSLINUX_DIR="$syslinux_modules_dir"
fi

# Enable serial console, unless explicitly disabled (only last entry is used :-/)
# Enable serial console, unless explicitly disabled (only last entry is used on some systems thats where SERIAL_CONSOLE_DEVICE_SYSLINUX comes in :-/)
if [[ "$USE_SERIAL_CONSOLE" =~ ^[yY1] ]]; then
for devnode in $(ls /dev/ttyS[0-9]* | sort); do
speed=$(stty -F $devnode 2>/dev/null | awk '/^speed / { print $2 }')
if [ "$speed" ]; then
echo "serial ${devnode##/dev/ttyS} $speed"
# Not sure if using all serial devices do screw up syslinux in general
# for me listing more then one serial line in the config screwed it
# see https://github.com/rear/rear/pull/2650
if [ -z $SERIAL_CONSOLE_DEVICE_SYSLINUX ] || [[ $SERIAL_CONSOLE_DEVICE_SYSLINUX == $devnode ]]; then
speed=$(stty -F $devnode 2>/dev/null | awk '/^speed / { print $2 }')
if [ "$speed" ]; then
echo "serial ${devnode##/dev/ttyS} $speed"
fi
fi
done
fi
Expand Down
11 changes: 8 additions & 3 deletions usr/share/rear/output/USB/Linux-i386/300_create_extlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,14 @@ Log "Creating $SYSLINUX_PREFIX/extlinux.conf"
# Enable serial console, unless explicitly disabled
if [[ "$USE_SERIAL_CONSOLE" =~ ^[yY1] ]]; then
for devnode in $(ls /dev/ttyS[0-9]* | sort); do
speed=$(stty -F $devnode 2>/dev/null | awk '/^speed / { print $2 }')
if [ "$speed" ]; then
syslinux_write "serial ${devnode##/dev/ttyS} $speed"
# Not sure if using all serial devices do screw up syslinux in general
# for me listing more then one serial line in the config screwed it
# see https://github.com/rear/rear/pull/2650
if [ -z $SERIAL_CONSOLE_DEVICE_SYSLINUX ] || [[ $SERIAL_CONSOLE_DEVICE_SYSLINUX == $devnode ]]; then
speed=$(stty -F $devnode 2>/dev/null | awk '/^speed / { print $2 }')
if [ "$speed" ]; then
syslinux_write "serial ${devnode##/dev/ttyS} $speed"
fi
fi
done
fi
Expand Down