diff options
Diffstat (limited to 'meta-linaro/recipes-linaro/auto-serial-console/auto-serial-console/auto-getty')
-rwxr-xr-x | meta-linaro/recipes-linaro/auto-serial-console/auto-serial-console/auto-getty | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/meta-linaro/recipes-linaro/auto-serial-console/auto-serial-console/auto-getty b/meta-linaro/recipes-linaro/auto-serial-console/auto-serial-console/auto-getty new file mode 100755 index 0000000..7b181bc --- /dev/null +++ b/meta-linaro/recipes-linaro/auto-serial-console/auto-serial-console/auto-getty | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/bin/sh -e | ||
2 | |||
3 | [ -f /etc/default/autogetty ] && . /etc/default/autogetty | ||
4 | |||
5 | [ 1 -gt $ENABLED ] && exit | ||
6 | |||
7 | while true; do | ||
8 | for arg in $(cat /proc/cmdline); do | ||
9 | case $arg in | ||
10 | console=*) | ||
11 | tty=${arg#console=} | ||
12 | tty=${tty#/dev/} | ||
13 | secure=`echo "${tty}" | cut -f1 -d,` | ||
14 | secure=`/bin/egrep "^${secure}$" /etc/securetty || true` | ||
15 | |||
16 | if [ -n "$tty" -a -n "${secure}" ]; then | ||
17 | PORT=${tty%%,*} | ||
18 | |||
19 | tmp=${tty##$PORT,} | ||
20 | SPEED=${tmp%%n*} | ||
21 | |||
22 | # if console=/dev/tty* without speed is given | ||
23 | [ $SPEED = $PORT ] && SPEED=115200 | ||
24 | BITS=${tmp##${SPEED}n} | ||
25 | |||
26 | # 8bit serial is default | ||
27 | [ -z $BITS ] && BITS=8 | ||
28 | # [ 8 -eq $BITS ] && GETTY_ARGS="$GETTY_ARGS -8 " | ||
29 | |||
30 | [ -z $SPEED ] && SPEED='115200,57600,38400,19200,9600' | ||
31 | |||
32 | GETTY_ARGS="$AUTOGETTY_ARGS $GETTY_ARGS $SPEED $PORT" | ||
33 | /sbin/getty $GETTY_ARGS | ||
34 | unset GETTY_ARGS | ||
35 | fi | ||
36 | esac | ||
37 | done | ||
38 | done | ||