Here is a revised version of the patch which also fixes syslinux.cfg_withgtk as suggested by Otavio Salvador in: http://lists.debian.org/debian-boot/2006/11/msg00959.html
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: installer/build/boot/x86/syslinux.cfg.withgtk =================================================================== --- installer/build/boot/x86/syslinux.cfg.withgtk (revision 42805) +++ installer/build/boot/x86/syslinux.cfg.withgtk (working copy) @@ -16,34 +16,34 @@ 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 installgui kernel ${KERNEL} - append ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} ${CONSOLE} -- + append ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} -- ${CONSOLE} LABEL expert kernel ${KERNEL} - append priority=low ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} -- + append priority=low ${VIDEO_MODE} initrd=${INITRD} -- ${CONSOLE} LABEL expertgui kernel ${KERNEL} - append priority=low ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} ${CONSOLE} -- + append priority=low ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} -- ${CONSOLE} LABEL rescue kernel ${KERNEL} - append ${VIDEO_MODE} initrd=${INITRD} ${CONSOLE} rescue/enable=true -- + append ${VIDEO_MODE} initrd=${INITRD} rescue/enable=true -- ${CONSOLE} LABEL rescuegui kernel ${KERNEL} - append ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} ${CONSOLE} rescue/enable=true -- + append ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} 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} LABEL autogui kernel ${KERNEL} - append auto=true priority=critical ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} ${CONSOLE} -- + append auto=true priority=critical ${VIDEO_MODE_GTK} initrd=${INITRD_GTK} -- ${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"