diff options
author | Andrea Adami <andrea.adami@gmail.com> | 2017-09-16 01:35:49 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-21 09:24:24 +0100 |
commit | fbefc329886f1cbbc5c07378dcb15afdb83bec46 (patch) | |
tree | 3b140bcbd2891e49197b2872e9589728258c0595 /meta | |
parent | cf166da446603f8a666f77b4c1d05b8c1c8f27a2 (diff) | |
download | poky-fbefc329886f1cbbc5c07378dcb15afdb83bec46.tar.gz |
sysvinit-inittab: start_getty: consider whitespaces in tty driver name
Unbreak serial console when driver name contains spaces (PXA serial).
Fix commit ac0e954
"start_getty: Over added SERIAL_CONSOLE cause error in userspace log"
(From OE-Core rev: 8b98302c30efb7073f61dc2a166f7414f050ef65)
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty index 31b4413433..f0d9f8cbcf 100644 --- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | |||
@@ -8,21 +8,26 @@ | |||
8 | #################################################################################### | 8 | #################################################################################### |
9 | 9 | ||
10 | # Get active serial filename. | 10 | # Get active serial filename. |
11 | active_serial=$(grep "serial" /proc/tty/drivers | grep -oh "^\s*\S*") | 11 | active_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 | # Re-phrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc). |
14 | runtime_tty=$(echo $2 | grep -oh '[0-9]') | 14 | runtime_tty=$(echo $2 | grep -oh '[0-9]') |
15 | 15 | ||
16 | # Backup $IFS. | ||
17 | DEFAULT_IFS=$IFS | ||
18 | # Customize Internal Field Separator. | ||
19 | IFS="$(printf '\n\t')" | ||
20 | |||
16 | for line in $active_serial; do | 21 | for line in $active_serial; do |
17 | # File is availability, file content current active serial target index. | 22 | # File is availability, file content current active serial target index. |
18 | if [ -e /proc/tty/driver/$line ] | 23 | if [ -e "/proc/tty/driver/$line" ] |
19 | then | 24 | then |
20 | # File content a lot of unknown serial. We use -v to remove all unmatch and get left off. | 25 | # File content a lot of unknown serial. We use -v to remove all unmatch and get left off. |
21 | # Tail use to avoid 1st line included into the filter because 1st line is file description. | 26 | # Tail use to avoid 1st line included into the filter because 1st line is file description. |
22 | activetty=$(grep -v "unknown" /proc/tty/driver/$line | tail -n +2 | grep -oh "^\s*\S*[0-9]") | 27 | activetty=$(grep -v "unknown" "/proc/tty/driver/$line" | tail -n +2 | grep -oh "^\s*\S*[0-9]") |
23 | for active in $activetty; do | 28 | for active in $activetty; do |
24 | # Check if both index is match then proceed to enable the serial console. | 29 | # Check if both index is match then proceed to enable the serial console. |
25 | if [ $active -eq $runtime_tty ] | 30 | if [ $active -eq $runtime_tty ] |
26 | then | 31 | then |
27 | if [ -c /dev/$2 ] | 32 | if [ -c /dev/$2 ] |
28 | then | 33 | then |
@@ -33,3 +38,6 @@ for line in $active_serial; do | |||
33 | done | 38 | done |
34 | fi | 39 | fi |
35 | done | 40 | done |
41 | |||
42 | # Restore $IFS. | ||
43 | IFS=$DEFAULT_IFS | ||