merge of '7393275c6ccce67cadeb49d4afb3459e56edf8a9'
[vuplus_openembedded] / packages / initrdscripts / files / 01-bootldr-buster.sh
1 #!/bin/sh
2
3 cmdl=`cat /proc/cmdline`
4 #cmdl="console=ttySA0,115200 console=ttySB0,115200"
5 if expr "$cmdl" : '.*mtdparts=ipaq' > /dev/null; then
6     echo "!!!!!!!!"
7     echo "Detected Compaq bootldr or derivative"
8     echo "Kernel command line is assumed to be bogus and ignored"
9     echo "!!!!!!!!"
10     CMDLINE="console=ttyS0,115200 console=tty0"
11     sleep 3
12 fi
13
14 # The main trouble is the bogus console=ttySA0 passed by bootldr
15 # It appears that kernel doesn't have protection against only invalid
16 # consoles being passed on the command line, which means that the
17 # kernel is deaf and dumb when booted by bootldr
18
19 INVALID_CONSOLE=0
20 VALID_CONSOLE=0
21
22 for arg in $cmdl; do
23         optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
24         case $arg in
25             console=*)
26                 if expr "$optarg" : 'ttySA[0-9]\+' > /dev/null; then
27                     INVALID_CONSOLE=1
28                 elif expr "$optarg" : 'ttyS\?[0-9]\+' > /dev/null; then
29                     VALID_CONSOLE=1
30                 fi
31                 ;;
32         esac
33 done
34
35 if [ $INVALID_CONSOLE -eq 1 -a $VALID_CONSOLE -eq 0 ]; then
36     echo "!!!!!!!!"
37     echo "No valid system console is detected"
38     echo "Explicitly using /dev/tty0 for input/output"
39     echo "!!!!!!!!"
40     CONSOLE="/dev/tty0"
41 fi