diff options
author | Martin Roth <martin.roth@se-eng.com> | 2014-07-10 15:00:35 -0600 |
---|---|---|
committer | Martin Roth <gaumless@gmail.com> | 2014-07-21 17:35:45 +0200 |
commit | 8e0071b7982f5f72cc8e182f8eb5d77248f0b720 (patch) | |
tree | a4ae1c6f39ffe144b1d7632da75895dadd7185a9 /util/board_status | |
parent | 13c7db8fe805e5b535356a7d86df17b81dff5d2a (diff) |
board_status.sh: Read coreboot boot log from a serial device
- Read the boot log from a serial device.
Change-Id: I9daf97fd9b7fc55d0d56d815b185f9b4e3ef9f5a
Signed-off-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-on: http://review.coreboot.org/6260
Reviewed-by: Mike Loptien <mike.loptien@se-eng.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'util/board_status')
-rwxr-xr-x | util/board_status/board_status.sh | 68 |
1 files changed, 64 insertions, 4 deletions
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} <option> @@ -121,12 +167,16 @@ Options Clobber temporary output when finished. Useful for debugging. -r <host> Obtain machine information from remote host (using ssh). + -s </dev/xxx> + Obtain boot log via serial device. + -S <speed> + Set the port speed for the serial device (Default is 115200). -u Upload results to coreboot.org. " } -while getopts "Chr:u" opt; do +while getopts "Chr:s:S:u" opt; do case "$opt" in h) show_help @@ -138,6 +188,12 @@ while getopts "Chr:u" opt; do r) REMOTE_HOST="$OPTARG" ;; + s) + SERIAL_DEVICE="$OPTARG" + ;; + S) + SERIAL_PORT_SPEED="$OPTARG" + ;; u) UPLOAD_RESULTS=1 ;; @@ -184,9 +240,13 @@ printf "Upstream revision: %s\n" $($getrevision -u) >> ${tmpdir}/${results}/revi printf "Upstream URL: %s\n" $($getrevision -U)>> ${tmpdir}/${results}/revision.txt printf "Timestamp: %s\n" "$timestamp" >> ${tmpdir}/${results}/revision.txt -test_cmd $REMOTE "cbmem" -cmd $REMOTE "cbmem -c" "${tmpdir}/${results}/coreboot_console.txt" -cmd_nonfatal $REMOTE "cbmem -t" "${tmpdir}/${results}/coreboot_timestamps.txt" +if [ -z "$SERIAL_DEVICE" ]; then + test_cmd $REMOTE "cbmem" + cmd $REMOTE "cbmem -c" "${tmpdir}/${results}/coreboot_console.txt" + cmd_nonfatal $REMOTE "cbmem -t" "${tmpdir}/${results}/coreboot_timestamps.txt" +else + get_serial_bootlog "$SERIAL_DEVICE" "$SERIAL_PORT_SPEED" "${tmpdir}/${results}/coreboot_console.txt" +fi cmd $REMOTE dmesg "${tmpdir}/${results}/kernel_log.txt" |