summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/start_getty26
1 files changed, 13 insertions, 13 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
index f0d9f8cbcf..e15ae35f90 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -1,16 +1,16 @@
1#!/bin/sh 1#!/bin/sh
2#################################################################################### 2###############################################################################
3# This script is use to automatic start serial console once power up. 3# This script is used to automatically set up the serial console(s) on startup.
4# Script enhancement has been done base on Bug YOCTO 10844. 4# The variable SERIAL_CONSOLES can be set in meta/conf/machine/*.conf.
5# Configuration can be done in meta/conf/machine/*.conf variable SERIAL_CONSOLES. 5# Script enhancement has been done based on Bug YOCTO #10844.
6# Most of the information is retrieve from /proc virtual filesystem which 6# Most of the information is retrieved from /proc virtual filesystem containing
7# contain all the runtime system information (eg. system memory, device mount, etc). 7# all the runtime system information (eg. system memory, device mount, etc).
8#################################################################################### 8###############################################################################
9 9
10# Get active serial filename. 10# Get active serial filename.
11active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//") 11active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//")
12 12
13# Re-phrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc). 13# Rephrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc).
14runtime_tty=$(echo $2 | grep -oh '[0-9]') 14runtime_tty=$(echo $2 | grep -oh '[0-9]')
15 15
16# Backup $IFS. 16# Backup $IFS.
@@ -19,14 +19,14 @@ DEFAULT_IFS=$IFS
19IFS="$(printf '\n\t')" 19IFS="$(printf '\n\t')"
20 20
21for line in $active_serial; do 21for line in $active_serial; do
22 # File is availability, file content current active serial target index. 22 # Check we have the file containing current active serial target index.
23 if [ -e "/proc/tty/driver/$line" ] 23 if [ -e "/proc/tty/driver/$line" ]
24 then 24 then
25 # File content a lot of unknown serial. We use -v to remove all unmatch and get left off. 25 # Remove all unknown entries and discard the first line (desc).
26 # Tail use to avoid 1st line included into the filter because 1st line is file description. 26 activetty=$(grep -v "unknown" "/proc/tty/driver/$line" \
27 activetty=$(grep -v "unknown" "/proc/tty/driver/$line" | tail -n +2 | grep -oh "^\s*\S*[0-9]") 27 | tail -n +2 | grep -oh "^\s*\S*[0-9]")
28 for active in $activetty; do 28 for active in $activetty; do
29 # Check if both index is match then proceed to enable the serial console. 29 # If indexes do match then enable the serial console.
30 if [ $active -eq $runtime_tty ] 30 if [ $active -eq $runtime_tty ]
31 then 31 then
32 if [ -c /dev/$2 ] 32 if [ -c /dev/$2 ]