Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12757
-gerrit
commit 207f6f8bcd7b4d40243194c117f2daa987252fd3 Author: Martin Roth martinroth@google.com Date: Thu Dec 17 12:02:45 2015 -0700
board_status.sh: Update to fix serial port reads
The old serial port read method lost characters from the boot log. This method works better for me.
- Put get_serial_bootlog arguments into variable names for clarity. - Fully configure the serial port with stty: disable parity and flow control. - Change serial port read from reading with 'cat' to reading with 'read'. - Update help to show current default speed from the variable.
tested under dash, bash, and zsh on several platfoms.
Change-Id: I91ae63a3c226e61019dbdf69c405c3f20ba7db54 Signed-off-by: Martin Roth martinroth@google.com --- util/board_status/board_status.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh index ee27bc0..d8bd3a8 100755 --- a/util/board_status/board_status.sh +++ b/util/board_status/board_status.sh @@ -122,8 +122,12 @@ cmd_nonfatal() # $3: filename to direct output of command into get_serial_bootlog () {
- if [ ! -c "$1" ]; then - echo "$1 is not a valid serial device" + local TTY=$1 + local SPEED=$2 + local FILENAME=$3 + + if [ ! -c "$TTY" ]; then + echo "$TTY is not a valid serial device" exit $EXIT_FAILURE fi
@@ -136,27 +140,29 @@ get_serial_bootlog () { fi
echo - echo "Waiting to receive boot log from $1" + echo "Waiting to receive boot log from $TTY" echo "Press [Enter] when the boot is complete and the" echo "system is ready for ssh to get the dmesg log." + echo
if [ $tput_not_available -eq 0 ]; then tput sgr0 fi
# set up the serial port - cmd $LOCAL "stty -F $1 $2 cs8 -cstopb" + stty -F $TTY $SPEED cs8 -cstopb -parenb clocal
# read from the serial port - user must press enter when complete test_cmd $LOCAL "tee" - cat "$SERIAL_DEVICE" | tee "$3" & + while read LINE; do + echo "$LINE" | tee -a "$FILENAME" + done < "$SERIAL_DEVICE" & PID=$!
- read - kill "$PID" 2>/dev/null & + read foo + kill "$PID" 2>/dev/null
- # remove the binary zero value that gets inserted into the file. - sed -i 's/\x00//' "$3" + echo "Finished reading boot log." }
show_help() { @@ -173,7 +179,7 @@ Options -s </dev/xxx> Obtain boot log via serial device. -S <speed> - Set the port speed for the serial device (Default is 115200). + Set the port speed for the serial device (Default is $SERIAL_PORT_SPEED). -u Upload results to coreboot.org. "