summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit/sysvinit-inittab
diff options
context:
space:
mode:
authorKevin Hao <kexin.hao@windriver.com>2021-04-07 20:18:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-18 11:37:26 +0100
commitbfbccfd85fcf8d3789f152aa7cb1f8d355873892 (patch)
tree1b08fea636113b78c172fbc7a9c146c0e99c893c /meta/recipes-core/sysvinit/sysvinit-inittab
parent7d9a47e6234159a8cfa17a965ceba65856eeb801 (diff)
downloadpoky-bfbccfd85fcf8d3789f152aa7cb1f8d355873892.tar.gz
sysvinit-inittab/start_getty: Check /sys for the tty device existence
The hvc tty driver doesn't populate a file like /proc/tty/driver/serial, so the current implementation of start_getty doesn't work for the hvc console. By checking the /sys/class/tty/ for the tty device existence, it should support more console types and also make the codes more simple. (From OE-Core rev: 670ceef0f6584ece5ce4176610255226a6148570) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit-inittab')
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/start_getty44
1 files changed, 3 insertions, 41 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
index dfa799adac..699a1ead1a 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -1,17 +1,4 @@
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
10# Get active serial filename.
11active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//")
12
13# Rephrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc).
14runtime_tty=$(echo $2 | grep -oh '[0-9]\+')
15 2
16# busybox' getty does this itself, util-linux' agetty needs extra help 3# busybox' getty does this itself, util-linux' agetty needs extra help
17getty="/sbin/getty" 4getty="/sbin/getty"
@@ -25,31 +12,6 @@ case $(readlink -f "${getty}") in
25 ;; 12 ;;
26esac 13esac
27 14
28# Backup $IFS. 15if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then
29DEFAULT_IFS=$IFS 16 ${setsid:-} ${getty} -L $1 $2 $3
30# Customize Internal Field Separator. 17fi
31IFS="$(printf '\n\t')"
32
33for 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
52done
53
54# Restore $IFS.
55IFS=$DEFAULT_IFS