1 |
commit: d2f2a7d5be0da587d0f127a176a6853bafc24870 |
2 |
Author: Guy Martin <gmsoft <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 22 14:13:48 2014 +0000 |
4 |
Commit: Richard Yao <ryao <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 27 04:31:24 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=d2f2a7d5 |
7 |
|
8 |
Start a getty on the serial console if known. |
9 |
|
10 |
This allows busybox to send SIGINT when Ctrl-C is issued. |
11 |
Most users start a ping to verify connectivity but can never stop it. |
12 |
|
13 |
Signed-off-by: Guy Martin <gmsoft <AT> gentoo.org> |
14 |
Signed-off-by: Richard Yao <ryao <AT> gentoo.org> |
15 |
|
16 |
--- |
17 |
netboot/linuxrc.x | 25 ++++++++++++++----------- |
18 |
1 file changed, 14 insertions(+), 11 deletions(-) |
19 |
|
20 |
diff --git a/netboot/linuxrc.x b/netboot/linuxrc.x |
21 |
index 69e7e7a..31b19d0 100644 |
22 |
--- a/netboot/linuxrc.x |
23 |
+++ b/netboot/linuxrc.x |
24 |
@@ -322,17 +322,20 @@ LaunchShell() { |
25 |
#// Completed Startup |
26 |
touch /tmp/.startup |
27 |
|
28 |
- for i in 2 3 4 5 6; do |
29 |
- getty -n -l /bin/ashlogin 38400 tty${i} & |
30 |
- done |
31 |
- |
32 |
-# # We run the getty for tty1 in the foreground so our pid 1 doesn't end |
33 |
-# getty -n -l /bin/ashlogin 38400 tty1 |
34 |
- |
35 |
- # We were running the above code, but that doesn't work well on serial. Until |
36 |
- # we can autodetect a serial console and start a getty there, we'll just run |
37 |
- # ash on /dev/console |
38 |
- /bin/ash |
39 |
+ SERIAL_TTY=$(sed -e 's/.*console=\(tty[a-zA-Z0-9]*\).*/\1/' /proc/cmdline) |
40 |
+ if [ "${SERIAL_TTY:0:3}" = "tty" -a "${SERIAL_TTY:0:4}" != "tty0" ] |
41 |
+ then |
42 |
+ # A serial tty has been specified |
43 |
+ getty -n -l /bin/ashlogin 38400 ${SERIAL_TTY} |
44 |
+ else |
45 |
+ for i in 2 3 4 5 6; do |
46 |
+ getty -n -l /bin/ashlogin 38400 tty${i} & |
47 |
+ done |
48 |
+ |
49 |
+ # If we can't autodetect a serial console and start a getty there, we'll just run |
50 |
+ # ash on /dev/console |
51 |
+ /bin/ash |
52 |
+ fi |
53 |
} |
54 |
|
55 |
#//-------------------------------------------------------------------------------- |