aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'netboot/linuxrc.x')
-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
}
#//--------------------------------------------------------------------------------