From 76ac1925c205c857e39400e5b61ac12b826577cf Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Fri, 19 Oct 2012 14:28:39 -0500 Subject: [PATCH] debian: rework the /etc/inittab serial settings Signed-off-by: Robert Nelson --- scripts/debian-finish.sh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/scripts/debian-finish.sh b/scripts/debian-finish.sh index cd2bd49..4783ce0 100644 --- a/scripts/debian-finish.sh +++ b/scripts/debian-finish.sh @@ -50,22 +50,16 @@ fi if [ "x${serial_tty}" != "x" ] ; then cp /etc/inittab /boot/uboot/backup/inittab + serial_num=$(echo -n "${serial_tty}"| tail -c -1) - #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 + #By default: Debian seems to be automatically modifying the first #T0 line: + #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 + + #Convert #T0: -> T${serial_num}: + sed -i -e "s/#T0:23:respawn/T${serial_num}:23:respawn/g" /etc/inittab + + #Convert ttyS0 9600 vt100 -> ${serial_tty} 115200 vt102 + sed -i -e "s/ttyS0 9600 vt100/${serial_tty} 115200 vt102/g" /etc/inittab fi if [ "x${boot_fstype}" == "xext2" ] ; then