From 547bf69f7a7e9f2e7416980a41811d465abc8eb0 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Fri, 5 Oct 2012 07:29:32 -0500 Subject: [PATCH] Debian Squeeze: if the serial port is enabled in the kernel command line, dont just add the serial getty to inittab, note wheezy needs retesting to verify this works for that too. Signed-off-by: Robert Nelson --- scripts/debian-finish.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/debian-finish.sh b/scripts/debian-finish.sh index ca86284..cd2bd49 100644 --- a/scripts/debian-finish.sh +++ b/scripts/debian-finish.sh @@ -49,7 +49,23 @@ if [ "x${boot_image}" == "xbootm" ] ; then fi if [ "x${serial_tty}" != "x" ] ; then - cat /etc/inittab | grep -v '#' | grep ${serial_tty} || echo "T2:23:respawn:/sbin/getty -L ${serial_tty} 115200 vt102" >> /etc/inittab && echo "#" >> /etc/inittab + cp /etc/inittab /boot/uboot/backup/inittab + + #With Debian Squeeze, if console=${serial_tty} is set, /etc/inittab gets changed automatically... + check=$(dmesg | grep "Kernel command line" | grep "console=${serial_tty}" | head -n 1) + if [ "x${check}" == "x" ] ; then + + check=$(cat /etc/inittab | grep ${serial_tty} | head -n 1) + if [ "x${check}" == "x" ] ; then + echo "T2:23:respawn:/sbin/getty -L ${serial_tty} 115200 vt102" >> /etc/inittab + echo "#" >> /etc/inittab + else + # #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 + check=$(cat /etc/inittab | grep ${serial_tty} | grep '^#T' | head -n 1 | awk -F'respawn' '{print $1}') + check=$(echo ${check} | sed 's/^#T*//') + sed -i -e "s/#T${check}respawn/T${check}respawn/g" /etc/inittab + fi + fi fi if [ "x${boot_fstype}" == "xext2" ] ; then