From 8e0071b7982f5f72cc8e182f8eb5d77248f0b720 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Thu, 10 Jul 2014 15:00:35 -0600 Subject: 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 Reviewed-on: http://review.coreboot.org/6260 Reviewed-by: Mike Loptien Tested-by: build bot (Jenkins) --- util/board_status/board_status.sh | 68 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) (limited to 'util') 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}