Bug#224641: [Patch] fixup serial support for grub for etch d-i
Her is an updated (but untested) patch against the d-i/trunk to fix
serial support for grub-installer.
Please note that the "${CONSOLE}" has been moved to after the "--" so
that it is caught as a user param. This saves special casing in the
install-grub script (which was the fix in my last revision of the
patch).
Regards
Alex Owen
Index: installer/build/boot/x86/syslinux.cfg
===================================================================
--- installer/build/boot/x86/syslinux.cfg (revision 42805)
+++ installer/build/boot/x86/syslinux.cfg (working copy)
@@ -16,22 +16,22 @@
LABEL install
kernel ${KERNEL}
- append ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} --
+ append ${VIDEO_MODE} initrd=${INITRD} -- ${CONSOLE}
LABEL linux
kernel ${KERNEL}
- append ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} --
+ append ${VIDEO_MODE} initrd=${INITRD} -- ${CONSOLE}
LABEL expert
kernel ${KERNEL}
- append priority=low ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} --
+ append priority=low ${VIDEO_MODE} initrd=${INITRD} -- ${CONSOLE}
LABEL rescue
kernel ${KERNEL}
- append ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} rescue/enable=true --
+ append ${VIDEO_MODE} initrd=${INITRD} rescue/enable=true -- ${CONSOLE}
LABEL auto
kernel ${KERNEL}
- append auto=true priority=critical ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} --
+ append auto=true priority=critical ${VIDEO_MODE} initrd=${INITRD} -- ${CONSOLE}
PROMPT 1
TIMEOUT 0
Index: packages/arch/i386/grub-installer/grub-installer
===================================================================
--- packages/arch/i386/grub-installer/grub-installer (revision 42805)
+++ packages/arch/i386/grub-installer/grub-installer (working copy)
@@ -37,11 +37,29 @@
if echo "${defconsole}" | grep -q console=ttyS; then
local PORT="$(echo "${defconsole}" | sed -e 's%^console=ttyS%%' -e 's%,.*%%')"
local SPEED="$(echo "${defconsole}" | sed -e 's%^console=ttyS[0-9]\+,%%' -e 's% .*%%')"
- local SERIAL="${PORT},${SPEED}"
+ local SERIAL="ttyS${PORT},${SPEED}"
echo "console=$SERIAL"
fi
}
+grub_serial_console() {
+ #$1=output of get_serial_console
+ local unit=$(echo $1 | sed -e 's%^console=ttyS%%' -e 's%,.*%%')
+ local speed=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,%%' -e 's%[^(0-9)].*%%')
+ local parity=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+%%' -e 's%[78].*%%')
+ case "$parity" in
+ "n") local parity="no" ;;
+ "e") local parity="even" ;;
+ "o") local parity="odd" ;;
+ *) local parity="" ;;
+ esac
+ local word=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+[oen]%%' -e 's%r%%')
+ local flow=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+[oen][78]%%')
+
+ echo serial --unit=$unit --speed=$speed --word=$word --parity=$parity --stop=1
+ echo terminal serial
+ }
+
serial="$(get_serial_console)"
# This is copied from update-grub; we've requested that it be moved
@@ -428,6 +446,12 @@
update_grub # again, to add new options to all the Debian kernel entries
fi
+if [ -n "$serial" ] ; then
+ # Modify menu.lst so _grub_ uses serial console.
+ grub_serial_console $serial | cat - $ROOT/boot/grub/$menu_file >$ROOT/boot/grub/$menu_file.new
+ mv $ROOT/boot/grub/$menu_file.new $ROOT/boot/grub/$menu_file
+fi
+
# Generate menu.lst additions for other OSes
tmpfile=/tmp/menu.lst.extras
OLDIFS="$IFS"
Reply to: