diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh index 889419e4df..ff95dd8867 100755 --- a/util/board_status/board_status.sh +++ b/util/board_status/board_status.sh @@ -3,6 +3,7 @@ # This file is part of the coreboot project. # # Copyright (C) 2013 Google Inc. +# Copyright (C) 2014 Sage Electronic Engineering, LLC. # EXIT_SUCCESS=0 @@ -12,6 +13,7 @@ EXIT_FAILURE=1 REMOTE_HOST="" CLOBBER_OUTPUT=0 UPLOAD_RESULTS=0 +SERIAL_PORT_SPEED=115200 # Used to specify whether a command should always be run locally or # if command should be run remoteley when a remote host is specified. @@ -110,6 +112,50 @@ cmd_nonfatal() rm -f "$3" # don't leave an empty file } +# read from a serial port device +# +# $1: serial device to read from +# $2: serial port speed +# $3: filename to direct output of command into +get_serial_bootlog () { + + if [ ! -c "$1" ]; then + echo "$1 is not a valid serial device" + exit $EXIT_FAILURE + fi + + # make the text more noticible + test_cmd $LOCAL "tput" $NONFATAL + tput_not_available=$? + if [ $tput_not_available -eq 0 ]; then + tput bold + tput setaf 10 # set bright green + fi + + echo + echo "Waiting to receive boot log from $1" + echo "Press [Enter] when the boot is complete and the" + echo "system is ready for ssh to get the dmesg log." + + if [ $tput_not_available -eq 0 ]; then + tput sgr0 + fi + + # set up the serial port + cmd $LOCAL "stty -F $1 $2 cs8 -cstopb" + + # read from the serial port - user must press enter when complete + test_cmd $LOCAL "tee" + cat "$SERIAL_DEVICE" | tee "$3" & + PID=$! + + read + kill "$PID" 2>/dev/null & + + # remove the binary zero value that gets inserted into the file. + sed -i 's/\x00//' "$3" +} + show_help() { echo "Usage: ${0}