David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4051
-gerrit
commit 3fdf58f5d166e937ec9637cf55f9ae804fafdeae
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Nov 12 18:17:19 2013 -0800
board_status.sh: trivial cosmetic changes toward the end
This moves an ugly comment closer to where it is applicable and also
adds a visual break between the commands which gather data and the
part of the script that finishes up. I'm usually not fan of banner
comments, but it seemed to help in my totally subjective opinion.
I was thinking about how to break the part that uploads results into
a separate function, but there are enough variables that are re-used
from earlier parts that the tradeoff probably isn't worth it.
Change-Id: If888329911c4de3b907cdf5973695c707bbb02fe
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
util/board_status/board_status.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 2fb3555..1269c41 100644
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -174,8 +174,9 @@ cmd_nonfatal $REMOTE "cbmem -t" "${tmpdir}/${results}/coreboot_timestamps.txt"
cmd $REMOTE dmesg "${tmpdir}/${results}/kernel_log.txt"
-# FIXME: the board-status directory might get big over time. Is there a way we
-# can push the results without fetching the whole repo?
+#
+# Finish up.
+#
coreboot_dir=`pwd`
if [ $UPLOAD_RESULTS -eq 1 ]; then
# extract username from ssh://<username>@review.coreboot.org/blah
@@ -183,6 +184,9 @@ if [ $UPLOAD_RESULTS -eq 1 ]; then
cd "util/board_status/"
if [ ! -e "board-status" ]; then
+ # FIXME: the board-status directory might get big over time.
+ # Is there a way we can push the results without fetching the
+ # whole repo?
git clone "ssh://${username}@review.coreboot.org:29418/board-status"
if [ $? -ne 0 ]; then
"Error cloning board-status repo, aborting."
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4050
-gerrit
commit f5e172f387e70022acc63e5c5d5aefde638c00a9
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Nov 12 18:10:23 2013 -0800
board_status.sh: pass filename as an arg to command wrappers
This allows the command wrappers to delete files if the command
fails. In particular, it delets empty or otherwise useless files
that are generated if a non-fatal command fails.
Change-Id: If26d7b4d7500f160edd1cc2a8b6218792fefae8b
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
util/board_status/board_status.sh | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index f7300bd..2fb3555 100644
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -53,25 +53,29 @@ _cmd()
fi
if [[ $1 -eq $REMOTE && -n "$REMOTE_HOST" ]]; then
- ssh root@${REMOTE_HOST} "$2"
+ ssh root@${REMOTE_HOST} "$2" > "${3}" 2>&1
else
- $2
+ $2 > "${3}" 2>&1
fi
+
+ return $?
}
# run a command
#
# $1: 0 to run command locally, 1 to run remotely if remote host defined
# $2: command
+# $3: filename to direct output of command into
cmd()
{
- _cmd $1 $2
+ _cmd $1 "$2" "$3"
if [ $? -eq 0 ]; then
return
fi
- echo "Failed to run command: $2"
+ echo "Failed to run \"$2\", aborting"
+ rm -f "$3" # don't leave an empty file
exit $EXIT_FAILURE
}
@@ -79,15 +83,17 @@ cmd()
#
# $1: 0 to run command locally, 1 to run remotely if remote host defined
# $2: command
+# $3: filename to direct output of command into
cmd_nonfatal()
{
- _cmd $1 $2
+ _cmd $1 "$2" "$3"
if [ $? -eq 0 ]; then
return
fi
- echo "Failed to run command: $2"
+ echo "Failed to run \"$2\", ignoring"
+ rm -f "$3" # don't leave an empty file
}
show_help() {
@@ -163,10 +169,10 @@ printf "Upstream URL: %s\n" $($getrevision -U)>> ${tmpdir}/${results}/revision.t
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
+cmd $REMOTE "cbmem -c" "${tmpdir}/${results}/coreboot_console.txt"
+cmd_nonfatal $REMOTE "cbmem -t" "${tmpdir}/${results}/coreboot_timestamps.txt"
-cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
+cmd $REMOTE dmesg "${tmpdir}/${results}/kernel_log.txt"
# FIXME: the board-status directory might get big over time. Is there a way we
# can push the results without fetching the whole repo?
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4049
-gerrit
commit 41af4bac43cba432e00b49d47e8b69f04b93edfa
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Nov 12 17:24:42 2013 -0800
board_status.sh: add support for non-fatal commands
This adds cmd_nonfatal() for commands which are considered
non-essential and can be expected to fail safely. This can be used,
for example, to gather data that is generated when using non-standard
utilities or coreboot config options.
Change-Id: Ie43944d2eb73f9aae1c30c3a204cfc413e11d286
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
util/board_status/board_status.sh | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 84319f1..f7300bd 100644
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -46,14 +46,10 @@ test_cmd()
exit $EXIT_FAILURE
}
-# run a command
-#
-# $1: 0 to run command locally, 1 to run remotely if remote host defined
-# $2: command
-cmd()
+_cmd()
{
if [ -e "$2" ]; then
- return
+ return $EXIT_FAILURE
fi
if [[ $1 -eq $REMOTE && -n "$REMOTE_HOST" ]]; then
@@ -61,6 +57,15 @@ cmd()
else
$2
fi
+}
+
+# run a command
+#
+# $1: 0 to run command locally, 1 to run remotely if remote host defined
+# $2: command
+cmd()
+{
+ _cmd $1 $2
if [ $? -eq 0 ]; then
return
@@ -70,6 +75,21 @@ cmd()
exit $EXIT_FAILURE
}
+# run a command where failure is considered to be non-fatal
+#
+# $1: 0 to run command locally, 1 to run remotely if remote host defined
+# $2: command
+cmd_nonfatal()
+{
+ _cmd $1 $2
+
+ if [ $? -eq 0 ]; then
+ return
+ fi
+
+ echo "Failed to run command: $2"
+}
+
show_help() {
echo "Usage:
${0} <option>
@@ -144,9 +164,7 @@ printf "Timestamp: %s\n" "$timestamp" >> ${tmpdir}/${results}/revision.txt
test_cmd $REMOTE "cbmem"
cmd $REMOTE "cbmem -c" > ${tmpdir}/${results}/coreboot_console.txt
-
-# TODO: Some commands should be optional and be non-fatal in case of error.
-#cmd $REMOTE "cbmem -t" > ${outdir}/coreboot_timestamps.txt
+cmd_nonfatal $REMOTE "cbmem -t" > ${tmpdir}/${results}/coreboot_timestamps.txt
cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4048
-gerrit
commit a8d6a8363155172b6981dec9cdb42b96ea0bc475
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Nov 12 16:49:45 2013 -0800
board_status.sh: move show_help()
This is really only a cosmetic change, but is intended to make it
slightly easier to remember to update the help menu whenever
options change.
Change-Id: I58b5012309229d08da138a01c7cd1c5096423179
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
util/board_status/board_status.sh | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 689eda9..84319f1 100644
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -18,22 +18,6 @@ UPLOAD_RESULTS=0
LOCAL=0
REMOTE=1
-show_help() {
- echo "Usage:
- ${0} <option>
-
-Options
- -h
- Show this message.
- -C
- Clobber temporary output when finished. Useful for debugging.
- -r <host>
- Obtain machine information from remote host (using ssh).
- -u
- Upload results to coreboot.org.
-"
-}
-
# test a command
#
# $1: test command on remote host (0=no, 1=yes)
@@ -86,6 +70,22 @@ cmd()
exit $EXIT_FAILURE
}
+show_help() {
+ echo "Usage:
+ ${0} <option>
+
+Options
+ -h
+ Show this message.
+ -C
+ Clobber temporary output when finished. Useful for debugging.
+ -r <host>
+ Obtain machine information from remote host (using ssh).
+ -u
+ Upload results to coreboot.org.
+"
+}
+
while getopts "Chr:u" opt; do
case "$opt" in
h)
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4047
-gerrit
commit a5efa8b896be3726518b3e24778ad41372cefd6a
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Nov 12 16:45:37 2013 -0800
board_status.sh: Make clobber option use 'C' instead of 'c'
Clobbering output is only really useful when debugging the script.
Since we're only using short options, let's save 'c' for something
more important.
Change-Id: If87a70fdc0cd006818d1736c40f9984dfec663a9
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
util/board_status/board_status.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 12d1ecd..689eda9 100644
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -25,8 +25,8 @@ show_help() {
Options
-h
Show this message.
- -c
- Clobber temporary output when finished. Useful when not uploading.
+ -C
+ Clobber temporary output when finished. Useful for debugging.
-r <host>
Obtain machine information from remote host (using ssh).
-u
@@ -86,13 +86,13 @@ cmd()
exit $EXIT_FAILURE
}
-while getopts "chr:u" opt; do
+while getopts "Chr:u" opt; do
case "$opt" in
h)
show_help
exit $EXIT_SUCCESS
;;
- c)
+ C)
CLOBBER_OUTPUT=1
;;
r)
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4039
-gerrit
commit 4f32651e0a9653a66fc961a1919651d6d0a107e8
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Mon Nov 11 18:44:05 2013 -0800
Updates to the board status script
This is the first major re-work for the board status script.
Summary:
- Added a command to the getrevision.sh script to retrieve tagged
revision.
- Results are placed in a dynamically generated temporary location.
This makes it easy to do multiple trial runs and avoids polluting
the coreboot directory.
- Results are stored in a directory with the following form:
<vendor>/<mainboard>/<tagged_revision>/<timestamp>/
Vendor and mainboard are obtained from CONFIG_MAINBOARD_DIR so that
hierarchy is consistent between coreboot and board-status.
- The results directory is used as the commit message.
- board-status repository is checked out automatically if results are
to be uploaded.
TODO:
- Add ability to run commands which may fail. Currently we assume
any failure should terminate the script, but some commands can be
made optional.
Successfully uploaded first result to board-status repository. See
http://review.coreboot.org/gitweb?p=board-status.git;a=summary .
Change-Id: Icba41ccad4e6e6ee829b8092a2459c2d72a3365b
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
.gitignore | 1 +
util/board_status/board_status.sh | 103 +++++++++++++++++++++++++++++---------
util/board_status/getrevision.sh | 20 ++++++++
3 files changed, 99 insertions(+), 25 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1cdabfc..c172244 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,7 @@ tarballs/
util/*/.dependencies
util/*/.test
+util/board_status/board-status
util/cbfstool/cbfstool
util/cbmem/.dependencies
util/cbmem/cbmem
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index d2955e0..12d1ecd 100644
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -7,13 +7,17 @@
EXIT_SUCCESS=0
EXIT_FAILURE=1
-OUTDIR="status"
# Stuff from command-line switches
REMOTE_HOST=""
CLOBBER_OUTPUT=0
UPLOAD_RESULTS=0
+# Used to specify whether a command should always be run locally or
+# if command should be run remoteley when a remote host is specified.
+LOCAL=0
+REMOTE=1
+
show_help() {
echo "Usage:
${0} <option>
@@ -22,7 +26,7 @@ Options
-h
Show this message.
-c
- Clobber output when finished.
+ Clobber temporary output when finished. Useful when not uploading.
-r <host>
Obtain machine information from remote host (using ssh).
-u
@@ -42,7 +46,7 @@ test_cmd()
return
fi
- if [[ $1 -eq 1 && "$REMOTE_HOST" ]]; then
+ if [[ $1 -eq $REMOTE && -n "$REMOTE_HOST" ]]; then
ssh root@${REMOTE_HOST} which "$2" >/dev/null
rc=$?
else
@@ -68,7 +72,7 @@ cmd()
return
fi
- if [[ $1 -eq 1 && -n "$REMOTE_HOST" ]]; then
+ if [[ $1 -eq $REMOTE && -n "$REMOTE_HOST" ]]; then
ssh root@${REMOTE_HOST} "$2"
else
$2
@@ -100,38 +104,87 @@ while getopts "chr:u" opt; do
esac
done
-if [ -e "$OUTDIR" ]; then
- echo "Output directory exists, aborting."
+grep -rH 'coreboot.org' .git/config >/dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "Script must be run from root of coreboot directory"
exit $EXIT_FAILURE
fi
-mkdir "$OUTDIR"
+# Results will be placed in a temporary location until we're ready to upload.
+# If the user does not wish to upload, results will remain in /tmp.
+tmpdir=$(mktemp -d)
+
+# Obtain board and revision info to form the directory structure:
+# <vendor>/<board>/<revision>/<timestamp>
+cbfstool_cmd="util/cbfstool/cbfstool"
+test_cmd $LOCAL "$cbfstool_cmd"
+$cbfstool_cmd build/coreboot.rom extract -n config -f ${tmpdir}/config.txt
+mainboard_dir="$(grep CONFIG_MAINBOARD_DIR ${tmpdir}/config.txt | awk -F '"' '{ print $2 }')"
+vendor=$(echo "$mainboard_dir" | awk -F '/' '{ print $1 }')
+mainboard=$(echo "$mainboard_dir" | awk -F '/' '{ print $2 }')
getrevision="util/board_status/getrevision.sh"
-test_cmd 0 $getrevision
-touch ${OUTDIR}/revision.txt
-printf "Local revision: %s\n" $($getrevision -l) >> ${OUTDIR}/revision.txt
-printf "Upstream revision: %s\n" $($getrevision -u) >> ${OUTDIR}/revision.txt
-printf "Upstream URL: %s\n" $($getrevision -U)>> ${OUTDIR}/revision.txt
-printf "Timestamp: %s\n" $($getrevision -t) >> ${OUTDIR}/revision.txt
+test_cmd $LOCAL $getrevision
+tagged_version=$($getrevision -T)
+timestamp=$($getrevision -t)
+
+results="${vendor}/${mainboard}/${tagged_version}/${timestamp}"
+
+echo "Temporarily placing output in ${tmpdir}/${results}"
+mkdir -p "${tmpdir}/${results}"
+
+mv "${tmpdir}/config.txt" "${tmpdir}/${results}"
+
+touch ${tmpdir}/${results}/revision.txt
+printf "Local revision: %s\n" "$($getrevision -l)" >> ${tmpdir}/${results}/revision.txt
+printf "Tagged revision: %s\n" "${tagged_version}" >> ${tmpdir}/${results}/revision.txt
+printf "Upstream revision: %s\n" $($getrevision -u) >> ${tmpdir}/${results}/revision.txt
+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
+
+# TODO: Some commands should be optional and be non-fatal in case of error.
+#cmd $REMOTE "cbmem -t" > ${outdir}/coreboot_timestamps.txt
+
+cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
+
+# FIXME: the board-status directory might get big over time. Is there a way we
+# can push the results without fetching the whole repo?
+coreboot_dir=`pwd`
+if [ $UPLOAD_RESULTS -eq 1 ]; then
+ # extract username from ssh://<username>@review.coreboot.org/blah
+ username=$(git config --get remote.origin.url | sed 's/ssh\:\/\///' | sed 's/@.*//')
+
+ cd "util/board_status/"
+ if [ ! -e "board-status" ]; then
+ git clone "ssh://${username}@review.coreboot.org:29418/board-status"
+ if [ $? -ne 0 ]; then
+ "Error cloning board-status repo, aborting."
+ exit $EXIT_FAILURE
+ fi
+ fi
-cbfstool_cmd="util/cbfstool/cbfstool"
-test_cmd 0 "$cbfstool_cmd"
-$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
+ cd "board-status"
+ echo "Copying results to $(pwd)/${results}"
-test_cmd 1 "cbmem"
-cmd 1 "cbmem -c" > ${OUTDIR}/coreboot_console.txt
-cmd 1 "cbmem -t" > ${OUTDIR}/coreboot_timestamps.txt
-cmd 1 "cbmem -C" > ${OUTDIR}/coreboot_coverage.txt
+ # Note: Result directory should be unique due to the timestamp.
+ cp -R "${tmpdir}/${vendor}" .
-cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
+ echo "Uploading results"
+ git add "${vendor}"
+ git commit -a -am "${mainboard_dir}/${tagged_version}/${timestamp}"
+ git push origin
-#if [ $UPLOAD_RESULTS -eq 1 ]; then
-# FIXME: implement this part
-#fi
+ # Results have been uploaded so it's pointless to keep the
+ # temporary files around.
+ rm -rf "${tmpdir}"
+fi
+cd "$coreboot_dir"
if [ $CLOBBER_OUTPUT -eq 1 ]; then
- rm -rf ${OUTDIR}
+ rm -rf ${tmpdir}
fi
exit $EXIT_SUCCESS
diff --git a/util/board_status/getrevision.sh b/util/board_status/getrevision.sh
index c8c126a..0a6b6c6 100755
--- a/util/board_status/getrevision.sh
+++ b/util/board_status/getrevision.sh
@@ -121,6 +121,20 @@ local_revision() {
echo "${r}"
}
+# Similar to local_revision but uses "git describe" instead of "git log" which
+# includes number of commits since most recent tag.
+tagged_revision() {
+ local r
+
+ if git_is_file_tracked "$1" ; then
+ r=$(git describe --tags --dirty)
+ else
+ return ${EXIT_FAILURE}
+ fi
+
+ echo "${r}"
+}
+
upstream_revision() {
local r=
@@ -143,6 +157,8 @@ Commands
local revision information including an indicator for uncommitted changes
-u or --upstream
upstream revision
+ -T or --tags
+ similar to -l, but uses \"git describe\" to obtain revision info with tags
-U or --url
URL associated with the latest commit
-d or --date
@@ -175,6 +191,10 @@ main() {
check_action $1
action=local_revision
shift;;
+ -T|--tags)
+ check_action $1
+ action=tagged_revision
+ shift;;
-u|--upstream)
check_action $1
action=upstream_revision
the following patch was just integrated into master:
commit d8cfd23f6ab37ae68366625e144136392384638f
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Tue Nov 12 21:59:10 2013 +0100
intel/2065x: Use TSC for udelay()
For the ram init of Intel Nehalem ram init we need a udelay implementation.
Use common TSC framework for it as Intel Haswell already does.
Change-Id: I360a6db1ec1ba32c92698a7d6f6968c93ead5c52
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
Reviewed-on: http://review.coreboot.org/4043
Reviewed-by: Aaron Durbin <adurbin(a)google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones(a)se-eng.com>
See http://review.coreboot.org/4043 for details.
-gerrit