diff options
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit-inittab/start_getty')
-rw-r--r-- | meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty index dfa799adac..f5671ee53d 100644 --- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | |||
@@ -1,17 +1,8 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | ############################################################################### | ||
3 | # This script is used to automatically set up the serial console(s) on startup. | ||
4 | # The variable SERIAL_CONSOLES can be set in meta/conf/machine/*.conf. | ||
5 | # Script enhancement has been done based on Bug YOCTO #10844. | ||
6 | # Most of the information is retrieved from /proc virtual filesystem containing | ||
7 | # all the runtime system information (eg. system memory, device mount, etc). | ||
8 | ############################################################################### | ||
9 | 2 | ||
10 | # Get active serial filename. | 3 | SPEED=$1 |
11 | active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//") | 4 | DEVICE=$2 |
12 | 5 | TERM=$3 | |
13 | # Rephrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc). | ||
14 | runtime_tty=$(echo $2 | grep -oh '[0-9]\+') | ||
15 | 6 | ||
16 | # busybox' getty does this itself, util-linux' agetty needs extra help | 7 | # busybox' getty does this itself, util-linux' agetty needs extra help |
17 | getty="/sbin/getty" | 8 | getty="/sbin/getty" |
@@ -22,34 +13,8 @@ case $(readlink -f "${getty}") in | |||
22 | if [ -x "/usr/bin/setsid" ] ; then | 13 | if [ -x "/usr/bin/setsid" ] ; then |
23 | setsid="/usr/bin/setsid" | 14 | setsid="/usr/bin/setsid" |
24 | fi | 15 | fi |
16 | options="" | ||
25 | ;; | 17 | ;; |
26 | esac | 18 | esac |
27 | 19 | ||
28 | # Backup $IFS. | 20 | ${setsid:-} ${getty} ${options:-} -L $SPEED $DEVICE $TERM |
29 | DEFAULT_IFS=$IFS | ||
30 | # Customize Internal Field Separator. | ||
31 | IFS="$(printf '\n\t')" | ||
32 | |||
33 | for line in $active_serial; do | ||
34 | # Check we have the file containing current active serial target index. | ||
35 | if [ -e "/proc/tty/driver/$line" ] | ||
36 | then | ||
37 | # Remove all unknown entries and discard the first line (desc). | ||
38 | activetty=$(grep -v "unknown" "/proc/tty/driver/$line" \ | ||
39 | | tail -n +2 | grep -oh "^\s*\S*[0-9]\+") | ||
40 | for active in $activetty; do | ||
41 | # If indexes do match then enable the serial console. | ||
42 | if [ $active -eq $runtime_tty ] | ||
43 | then | ||
44 | if [ -c /dev/$2 ] | ||
45 | then | ||
46 | ${setsid:-} ${getty} -L $1 $2 $3 | ||
47 | fi | ||
48 | break | ||
49 | fi | ||
50 | done | ||
51 | fi | ||
52 | done | ||
53 | |||
54 | # Restore $IFS. | ||
55 | IFS=$DEFAULT_IFS | ||