[coreboot-gerrit] Change in coreboot[master]: util/board_status: Add support of CMOS values dump

Evgeny Zinoviev (Code Review) gerrit at coreboot.org
Mon Sep 10 23:06:03 CEST 2018


Evgeny Zinoviev has uploaded this change for review. ( https://review.coreboot.org/28565


Change subject: util/board_status: Add support of CMOS values dump
......................................................................

util/board_status: Add support of CMOS values dump

Change-Id: I89f9a0e9622557b01dda52378f8f1323777bce39
Signed-off-by: Evgeny Zinoviev <me at ch1p.com>
---
M util/board_status/board_status.sh
1 file changed, 47 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/28565/1

diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 13c58e1..132056d 100755
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -27,6 +27,9 @@
 # Used if cbmem is not in default $PATH, e.g. not installed or when using `sudo`
 CBMEM_PATH=""
 
+# Used if nvramtool is not in default $PATH, e.g. not installed or when using `sudo`
+NVRAMTOOL_PATH=""
+
 # test a command
 #
 # $1: 0 ($LOCAL) to run command locally,
@@ -176,6 +179,8 @@
 Options
     -c, --cbmem
         Path to cbmem on device under test (DUT).
+    -n, --nvramtool
+        Path to nvramtool on device under test (DUT).
     -C, --clobber
         Clobber temporary output when finished. Useful for debugging.
     -h, --help
@@ -207,7 +212,7 @@
 LONGOPTS="${LONGOPTS},serial-device:,serial-speed:"
 LONGOPTS="${LONGOPTS},ssh-port:"
 
-ARGS=$(getopt -o c:Chi:r:s:S:u -l "$LONGOPTS" -n "$0" -- "$@");
+ARGS=$(getopt -o c:n:Chi:r:s:S:u -l "$LONGOPTS" -n "$0" -- "$@");
 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
 eval set -- "$ARGS"
 while true ; do
@@ -217,6 +222,10 @@
 			shift
 			CBMEM_PATH="$1"
 			;;
+		-n|--nvramtool)
+			shift
+			NVRAMTOOL_PATH="$1"
+			;;
 		-C|--clobber)
 			CLOBBER_OUTPUT=1
 			;;
@@ -370,6 +379,17 @@
 	cbmem_cmd="cbmem"
 fi
 
+cmos_enabled=0
+if grep -q "CONFIG_USE_OPTION_TABLE=y" "${tmpdir}/${results}/config.short.txt" > /dev/null; then
+	cmos_enabled=1
+fi
+
+if [ -n "$NVRAMTOOL_PATH" ]; then
+	nvramtool_cmd="$NVRAMTOOL_PATH"
+else
+	nvramtool_cmd="nvramtool"
+fi
+
 if [ -n "$SERIAL_DEVICE" ]; then
 	get_serial_bootlog "$SERIAL_DEVICE" "$SERIAL_PORT_SPEED" "${tmpdir}/${results}/coreboot_console.txt"
 elif [ -n "$REMOTE_HOST" ]; then
@@ -380,6 +400,13 @@
 	echo "Getting timestamp data"
 	cmd_nonfatal $REMOTE "$cbmem_cmd -t" "${tmpdir}/${results}/coreboot_timestamps.txt"
 
+	if [ "$cmos_enabled" -eq 1 ]; then
+		echo "Verifying that nvramtool is available on remote device"
+		test_cmd $REMOTE "$nvramtool_cmd"
+		echo "Getting all CMOS values"
+		cmd $REMOTE "$nvramtool_cmd -a" "${tmpdir}/${results}/cmos_values.txt"
+	fi
+
 	echo "Getting remote dmesg"
 	cmd $REMOTE dmesg "${tmpdir}/${results}/kernel_log.txt"
 else
@@ -402,6 +429,25 @@
 	echo "Getting timestamp data"
 	cmd_nonfatal $LOCAL "$cbmem_cmd -t" "${tmpdir}/${results}/coreboot_timestamps.txt"
 
+	if [ "$cmos_enabled" -eq 1 ]; then
+		echo "Verifying that nvramtool is available"
+		if [ $(id -u) -ne 0 ]; then
+			command -v "$nvramtool_cmd" >/dev/null
+			if [ $? -ne 0 ]; then
+				echo "Failed to run $nvramtool_cmd. Check \$PATH or" \
+				"use -n to specify path to nvramtool binary."
+				exit $EXIT_FAILURE
+			else
+				nvramtool_cmd="sudo $nvramtool_cmd"
+			fi
+		else
+			test_cmd $LOCAL "$nvramtool_cmd"
+		fi
+
+		echo "Getting all CMOS values"
+		cmd $LOCAL "$nvramtool_cmd -a" "${tmpdir}/${results}/cmos_values.txt"
+	fi
+
 	echo "Getting local dmesg"
 	cmd $LOCAL dmesg "${tmpdir}/${results}/kernel_log.txt"
 fi

-- 
To view, visit https://review.coreboot.org/28565
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I89f9a0e9622557b01dda52378f8f1323777bce39
Gerrit-Change-Number: 28565
Gerrit-PatchSet: 1
Gerrit-Owner: Evgeny Zinoviev <me at ch1p.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180910/1cb51d6e/attachment-0001.html>


More information about the coreboot-gerrit mailing list