[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#224641: [Patch] support for GRUB console on serial port



tags 224641 + patch
thanks

Here is an un-tested patch to make grub-installer make grub use serial
port if doing a serial console install.

Alex Owen

--- postinst.orig	2004-11-02 14:59:09.000000000 +0000
+++ postinst	2004-11-25 20:55:04.000000000 +0000
@@ -33,6 +33,25 @@
 	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
@@ -390,6 +409,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 >>/target/boot/grub/menu.lst
+fi 
+
+
 # Generation menu.lst addition for other OSes.
 tmpfile=/tmp/menu.lst.extras
 OLDIFS="$IFS"

Reply to: