Bug#224641: [Patch] fixup serial support for grub for etch d-i

2006-11-27 Thread Alex Owen

Tested patch  of 22/11/06 by  running d-i  in expert mode and copying
a patched grub-installer into /usr/bin/ of the running initrd. Grub is
installed properly with serial terminal and the console= parameter
is also added to kopt as it should be.

With the current kernel you then hit bug http://bugs.debian.org/378204
which is a kernel bug that will disappear with the 2.6.18 kernel transition.
Work arround for 2.6.17 kernels is to remove console=ttyS... from
kernel command line in grub on first boot then login and either
upgrade kernel to 2.6.18 OR
 echo blacklist 8250_pnp /etc/modprobe.d/local-8250_pnp-off

Regards
Alex Owen

On 22/11/06, Alex Owen [EMAIL PROTECTED] wrote:

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



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Processed: Re: Bug#224641: [Patch] fixup serial support for grub for etch d-i

2006-11-27 Thread Debian Bug Tracking System
Processing commands for [EMAIL PROTECTED]:

 tag 224641 + pending
Bug#224641: grub-installer does not account for serial console
Tags were: patch
Tags added: pending


End of message, stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#224641: [Patch] fixup serial support for grub for etch d-i

2006-11-22 Thread Alex Owen

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


Re: Bug#224641: [Patch] fixup serial support for grub for etch d-i

2006-11-22 Thread Otavio Salvador
Alex Owen [EMAIL PROTECTED] writes:

 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)

Your patch looks good to me but it miss the syslinux.cfg_withgtk
right? Could you do it there too?

-- 
O T A V I OS A L V A D O R
-
 E-mail: [EMAIL PROTECTED]  UIN: 5906116
 GNU/Linux User: 239058 GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
-
Microsoft gives you Windows ... Linux gives
 you the whole house.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#224641: [Patch] fixup serial support for grub for etch d-i

2006-11-22 Thread Alex Owen

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