aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Martin <gmsoft@gentoo.org>2014-01-22 15:13:48 +0100
committerRichard Yao <ryao@gentoo.org>2014-02-26 23:31:24 -0500
commitd2f2a7d5be0da587d0f127a176a6853bafc24870 (patch)
tree427558f530bb701612385e2e9d45caf4dca5e838 /netboot
parentSuppress superfluous console kernel output (diff)
downloadgenkernel-d2f2a7d5be0da587d0f127a176a6853bafc24870.tar.gz
genkernel-d2f2a7d5be0da587d0f127a176a6853bafc24870.tar.bz2
genkernel-d2f2a7d5be0da587d0f127a176a6853bafc24870.zip
Start a getty on the serial console if known.
This allows busybox to send SIGINT when Ctrl-C is issued. Most users start a ping to verify connectivity but can never stop it. Signed-off-by: Guy Martin <gmsoft@gentoo.org> Signed-off-by: Richard Yao <ryao@gentoo.org>
Diffstat (limited to 'netboot')
-rw-r--r--netboot/linuxrc.x25
1 files changed, 14 insertions, 11 deletions
diff --git a/netboot/linuxrc.x b/netboot/linuxrc.x
index 69e7e7a..31b19d0 100644
--- a/netboot/linuxrc.x
+++ b/netboot/linuxrc.x
@@ -322,17 +322,20 @@ LaunchShell() {
#// Completed Startup
touch /tmp/.startup
- for i in 2 3 4 5 6; do
- getty -n -l /bin/ashlogin 38400 tty${i} &
- done
-
-# # We run the getty for tty1 in the foreground so our pid 1 doesn't end
-# getty -n -l /bin/ashlogin 38400 tty1
-
- # We were running the above code, but that doesn't work well on serial. Until
- # we can autodetect a serial console and start a getty there, we'll just run
- # ash on /dev/console
- /bin/ash
+ SERIAL_TTY=$(sed -e 's/.*console=\(tty[a-zA-Z0-9]*\).*/\1/' /proc/cmdline)
+ if [ "${SERIAL_TTY:0:3}" = "tty" -a "${SERIAL_TTY:0:4}" != "tty0" ]
+ then
+ # A serial tty has been specified
+ getty -n -l /bin/ashlogin 38400 ${SERIAL_TTY}
+ else
+ for i in 2 3 4 5 6; do
+ getty -n -l /bin/ashlogin 38400 tty${i} &
+ done
+
+ # If we can't autodetect a serial console and start a getty there, we'll just run
+ # ash on /dev/console
+ /bin/ash
+ fi
}
#//--------------------------------------------------------------------------------