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 4a4c08c26e4009622a7cf5800ed806c249777820
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:
- 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>/<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 | 102 ++++++++++++++++++++++++++++----------
2 files changed, 78 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..8221a4d 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,86 @@ 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 tempoary 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
+local_version=$($getrevision -l)
+timestamp=$($getrevision -t)
-cbfstool_cmd="util/cbfstool/cbfstool"
-test_cmd 0 "$cbfstool_cmd"
-$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
+results="${vendor}/${mainboard}/${local_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" "$local_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
-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
+# TODO: Some commands should be optional and be non-fatal in case of error.
+#cmd $REMOTE "cbmem -t" > ${outdir}/coreboot_timestamps.txt
-cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
+cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
-#if [ $UPLOAD_RESULTS -eq 1 ]; then
-# FIXME: implement this part
-#fi
+# 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/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
+
+ cd "board-status"
+ echo "Copying results to $(pwd)/${results}"
+
+ # Note: Result directory should be unique due to the timestamp.
+ cp -R "${tmpdir}/${vendor}" .
+
+ echo "Uploading results"
+ git add "${vendor}"
+ git commit -a -am "${mainboard_dir}/${local_version}/${timestamp}"
+ git push origin
+
+ # 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
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 31a0eb1f40d37492324922d6d59e94506c7bd140
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:
- 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>/<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 | 98 ++++++++++++++++++++++++++++++---------
2 files changed, 76 insertions(+), 23 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..d22c2a1 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
@@ -100,38 +104,86 @@ 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 tempoary 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
+local_version=$($getrevision -l)
+timestamp=$($getrevision -t)
-cbfstool_cmd="util/cbfstool/cbfstool"
-test_cmd 0 "$cbfstool_cmd"
-$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
+results="${vendor}/${mainboard}/${local_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" "$local_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
-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
+# TODO: Some commands should be optional and be non-fatal in case of error.
+#cmd $REMOTE "cbmem -t" > ${outdir}/coreboot_timestamps.txt
-cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
+cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
-#if [ $UPLOAD_RESULTS -eq 1 ]; then
-# FIXME: implement this part
-#fi
+# 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/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
+
+ cd "board-status"
+ echo "Copying results to $(pwd)/${results}"
+
+ # Note: Result directory should be unique due to the timestamp.
+ cp -R "${tmpdir}/${vendor}" .
+
+ echo "Uploading results"
+ git add "${vendor}"
+ git commit -a -am "${mainboard_dir}/${local_version}/${timestamp}"
+ git push origin
+
+ # 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
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 40800fdbd76d0a726eed0ee674fd6e95e2b4418d
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:
- 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 directory has the following form:
<vendor>/<mainboard>/<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 | 98 ++++++++++++++++++++++++++++++---------
2 files changed, 76 insertions(+), 23 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..1845e95 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
@@ -100,38 +104,86 @@ 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 tempoary 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
+local_version=$($getrevision -l)
+timestamp=$($getrevision -t)
-cbfstool_cmd="util/cbfstool/cbfstool"
-test_cmd 0 "$cbfstool_cmd"
-$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
+results="${vendor}/${mainboard}/${local_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" "$local_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
-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
+# TODO: Some commands should be optional and be non-fatal in case of error.
+#cmd $REMOTE "cbmem -t" > ${outdir}/coreboot_timestamps.txt
-cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
+cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
-#if [ $UPLOAD_RESULTS -eq 1 ]; then
-# FIXME: implement this part
-#fi
+# 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/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
+
+ cd "board-status"
+ echo "Copying results to $(pwd)/${results}"
+
+ # Note: Result directory should be unique due to the timestamp.
+ cp -R "${tmpdir}/${vendor}" .
+
+ echo "Uploading results"
+ git add "${vendor}"
+ git commit -a -am "${mainboard_dir}/${local_version}/${timestamp}"
+ git push origin
+
+ # 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
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 ad2846292e1307ecec05ea32be4f62e01a531fee
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:
- 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 the following form:
<vendor>/<mainboard>/<revision>/<timestamp>
Vendor and mainboard are obtained from CONFIG_MAINBOARD_DIR so that
hierarchy is consistent between coreboot and board-status.
- 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 | 98 ++++++++++++++++++++++++++++++---------
2 files changed, 76 insertions(+), 23 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..1845e95 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
@@ -100,38 +104,86 @@ 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 tempoary 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
+local_version=$($getrevision -l)
+timestamp=$($getrevision -t)
-cbfstool_cmd="util/cbfstool/cbfstool"
-test_cmd 0 "$cbfstool_cmd"
-$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
+results="${vendor}/${mainboard}/${local_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" "$local_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
-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
+# TODO: Some commands should be optional and be non-fatal in case of error.
+#cmd $REMOTE "cbmem -t" > ${outdir}/coreboot_timestamps.txt
-cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
+cmd $REMOTE dmesg > ${tmpdir}/${results}/kernel_log.txt
-#if [ $UPLOAD_RESULTS -eq 1 ]; then
-# FIXME: implement this part
-#fi
+# 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/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
+
+ cd "board-status"
+ echo "Copying results to $(pwd)/${results}"
+
+ # Note: Result directory should be unique due to the timestamp.
+ cp -R "${tmpdir}/${vendor}" .
+
+ echo "Uploading results"
+ git add "${vendor}"
+ git commit -a -am "${mainboard_dir}/${local_version}/${timestamp}"
+ git push origin
+
+ # 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
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4038
-gerrit
commit 84998dc8327dcfc87738c594d62767e0b0947214
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Mon Nov 11 18:43:39 2013 -0800
rename status-related stuff to board_status
This just moves stuff to be more clear about the purpose of
the script. Other suggestions are welcome.
Change-Id: Ic6095fd4eb347daa5a03eff21b5952d2d42a6bfd
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
util/board_status/board_status.sh | 137 +++++++++++++++++++++++
util/board_status/getrevision.sh | 228 ++++++++++++++++++++++++++++++++++++++
util/status/getrevision.sh | 228 --------------------------------------
util/status/status.sh | 137 -----------------------
4 files changed, 365 insertions(+), 365 deletions(-)
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
new file mode 100644
index 0000000..d2955e0
--- /dev/null
+++ b/util/board_status/board_status.sh
@@ -0,0 +1,137 @@
+#!/bin/sh
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2013 Google Inc.
+#
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+OUTDIR="status"
+
+# Stuff from command-line switches
+REMOTE_HOST=""
+CLOBBER_OUTPUT=0
+UPLOAD_RESULTS=0
+
+show_help() {
+ echo "Usage:
+ ${0} <option>
+
+Options
+ -h
+ Show this message.
+ -c
+ Clobber output when finished.
+ -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)
+# $2: command to test
+test_cmd()
+{
+ local rc
+
+ if [ -e "$2" ]; then
+ return
+ fi
+
+ if [[ $1 -eq 1 && "$REMOTE_HOST" ]]; then
+ ssh root@${REMOTE_HOST} which "$2" >/dev/null
+ rc=$?
+ else
+ which "$2" >/dev/null
+ rc=$?
+ fi
+
+ if [ $rc -eq 0 ]; then
+ return
+ fi
+
+ echo "$2 not found"
+ exit $EXIT_FAILURE
+}
+
+# run a command
+#
+# $1: 0 to run command locally, 1 to run remotely if remote host defined
+# $2: command
+cmd()
+{
+ if [ -e "$2" ]; then
+ return
+ fi
+
+ if [[ $1 -eq 1 && -n "$REMOTE_HOST" ]]; then
+ ssh root@${REMOTE_HOST} "$2"
+ else
+ $2
+ fi
+
+ if [ $? -eq 0 ]; then
+ return
+ fi
+
+ echo "Failed to run command: $2"
+ exit $EXIT_FAILURE
+}
+
+while getopts "chr:u" opt; do
+ case "$opt" in
+ h)
+ show_help
+ exit $EXIT_SUCCESS
+ ;;
+ c)
+ CLOBBER_OUTPUT=1
+ ;;
+ r)
+ REMOTE_HOST="$OPTARG"
+ ;;
+ u)
+ UPLOAD_RESULTS=1
+ ;;
+ esac
+done
+
+if [ -e "$OUTDIR" ]; then
+ echo "Output directory exists, aborting."
+ exit $EXIT_FAILURE
+fi
+
+mkdir "$OUTDIR"
+
+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
+
+cbfstool_cmd="util/cbfstool/cbfstool"
+test_cmd 0 "$cbfstool_cmd"
+$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
+
+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
+
+cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
+
+#if [ $UPLOAD_RESULTS -eq 1 ]; then
+# FIXME: implement this part
+#fi
+
+if [ $CLOBBER_OUTPUT -eq 1 ]; then
+ rm -rf ${OUTDIR}
+fi
+
+exit $EXIT_SUCCESS
diff --git a/util/board_status/getrevision.sh b/util/board_status/getrevision.sh
new file mode 100755
index 0000000..c8c126a
--- /dev/null
+++ b/util/board_status/getrevision.sh
@@ -0,0 +1,228 @@
+#!/bin/sh
+#
+# This file is part of the coreboot project. It originated in the
+# flashrom project but has been heavily modified since then.
+#
+# Copyright (C) 2013 Stefan Tauner
+# Copyright (C) 2013 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+# Make sure we don't get translated output
+export LC_ALL=C
+# nor local times or dates
+export TZ=UTC0
+
+# Helper functions
+git_has_local_changes() {
+ git update-index -q --refresh >/dev/null
+ ! git diff-index --quiet HEAD -- "$1"
+}
+
+git_last_commit() {
+ git log --pretty=format:"%h" -1 -- "$1"
+}
+
+git_is_file_tracked() {
+ git ls-files --error-unmatch -- "$1" >/dev/null 2>&1
+}
+
+is_file_tracked() {
+ git_is_file_tracked "$1"
+}
+
+# Tries to find a remote source for the changes committed locally.
+# This includes the URL of the remote repository including the last commit and a suitable branch name.
+# Takes one optional argument: the path to inspect
+git_url() {
+ # Note: This may not work as expected if multiple remotes are fetched from.
+ echo $(git remote -v | \
+ awk '/fetch/ {split($2, pieces, "@"); print pieces[2]; exit 0}')
+}
+
+# Returns a string indicating where others can get the current source code (excluding uncommitted changes)
+# Takes one optional argument: the path to inspect
+scm_url() {
+ local url
+
+ url="$(git_url "$1")"
+
+ echo "${url}"
+}
+
+# Retrieve timestamp since last modification. If the sources are pristine,
+# then the timestamp will match that of the SCM's most recent modification
+# date.
+timestamp() {
+ local t
+
+ # date syntaxes are manifold:
+ # gnu date [-d input]... [+FORMAT]
+ # netbsd date [-ajnu] [-d date] [-r seconds] [+format] [[[[[[CC]yy]mm]dd]HH]MM[.SS]]
+ # freebsd date [-jnu] [-d dst] [-r seconds] [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] [...]
+ # dragonflybsd date [-jnu] [-d dst] [-r seconds] [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] [...]
+ # openbsd date [-aju] [-d dst] [-r seconds] [+format] [[[[[[cc]yy]mm]dd]HH]MM[.SS]] [...]
+ if git_is_file_tracked "$2" ; then
+ # are there local changes?
+ if git_has_local_changes "$2" ; then
+ t=$(date -u "${1}")
+ else
+ # No local changes, get date of the last commit
+ case $(uname) in
+ # Most BSD dates do not support parsing date values from user input with -d but all of
+ # them support parsing epoch seconds with -r. Thanks to git we can easily use that:
+ NetBSD|OpenBSD|DragonFly|FreeBSD)
+ t=$(date -u -r "$(git log --pretty=format:%ct -1 -- $2)" "$1" 2>/dev/null);;
+ *)
+ t=$(date -d "$(git log --pretty=format:%cD -1 -- $2)" -u "$1" 2>/dev/null);;
+ esac
+ fi
+ else
+ t=$(date -u "$1")
+ fi
+
+ if [ -z "$t" ]; then
+ echo "Warning: Could not determine timestamp." 2>/dev/null
+ fi
+ echo "${t}"
+}
+
+# Retrieve local SCM revision info. This is useful if we're working in a different SCM than upstream and/or
+# have local changes.
+local_revision() {
+ local r
+
+ if git_is_file_tracked "$1" ; then
+ r=$(git_last_commit "$1")
+
+ if git_has_local_changes "$1" ; then
+ r="$r-dirty"
+ fi
+ else
+ return ${EXIT_FAILURE}
+ fi
+
+ echo "${r}"
+}
+
+upstream_revision() {
+ local r=
+
+ r=$(git log remotes/origin/master -1 --format=format:%h)
+
+ if [ -z "$r" ]; then
+ r="unknown" # default to unknown
+ fi
+ echo "${r}"
+}
+
+show_help() {
+ echo "Usage:
+ ${0} <command> [path]
+
+Commands
+ -h or --help
+ this message
+ -l or --local
+ local revision information including an indicator for uncommitted changes
+ -u or --upstream
+ upstream revision
+ -U or --url
+ URL associated with the latest commit
+ -d or --date
+ date of most recent modification
+ -t or --timestamp
+ timestamp of most recent modification
+"
+ return
+}
+
+check_action() {
+ if [ -n "$action" ]; then
+ echo "Error: Multiple actions given.">&2
+ exit ${EXIT_FAILURE}
+ fi
+}
+
+main() {
+ local query_path=
+ local action=
+
+ # The is the main loop
+ while [ $# -gt 0 ];
+ do
+ case ${1} in
+ -h|--help)
+ action=show_help;
+ shift;;
+ -l|--local)
+ check_action $1
+ action=local_revision
+ shift;;
+ -u|--upstream)
+ check_action $1
+ action=upstream_revision
+ shift;;
+ -U|--url)
+ check_action $1
+ action=scm_url
+ shift;;
+ -d|--date)
+ check_action $1
+ action="timestamp +%Y-%m-%d" # refrain from suffixing 'Z' to indicate it's UTC
+ shift;;
+ -t|--timestamp)
+ check_action $1
+ action="timestamp +%Y-%m-%dT%H:%M:%SZ" # There is only one valid time format! ISO 8601
+ shift;;
+ -*)
+ show_help;
+ echo "Error: Invalid option: ${1}"
+ exit ${EXIT_FAILURE};;
+ *)
+ if [ -z "$query_path" ] ; then
+ if [ ! -e "$1" ] ; then
+ echo "Error: Path \"${1}\" does not exist.">&2
+ exit ${EXIT_FAILURE}
+ fi
+ query_path=$1
+ else
+ echo "Warning: Ignoring over-abundant paramter: \"${1}\"">&2
+ fi
+ shift;;
+ esac;
+ done
+
+ # default to current directory (usually equals the whole repository)
+ if [ -z "$query_path" ] ; then
+ query_path=.
+ fi
+ if ! is_file_tracked "$query_path" ; then
+ echo "Warning: Path \"${query_path}\" is not under version control.">&2
+ fi
+ if [ -z "$action" ] ; then
+ show_help
+ echo "Error: No actions specified"
+ exit ${EXIT_FAILURE}
+ fi
+
+ $action "$query_path"
+}
+
+main $@
diff --git a/util/status/getrevision.sh b/util/status/getrevision.sh
deleted file mode 100755
index c8c126a..0000000
--- a/util/status/getrevision.sh
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/bin/sh
-#
-# This file is part of the coreboot project. It originated in the
-# flashrom project but has been heavily modified since then.
-#
-# Copyright (C) 2013 Stefan Tauner
-# Copyright (C) 2013 Google Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-# Make sure we don't get translated output
-export LC_ALL=C
-# nor local times or dates
-export TZ=UTC0
-
-# Helper functions
-git_has_local_changes() {
- git update-index -q --refresh >/dev/null
- ! git diff-index --quiet HEAD -- "$1"
-}
-
-git_last_commit() {
- git log --pretty=format:"%h" -1 -- "$1"
-}
-
-git_is_file_tracked() {
- git ls-files --error-unmatch -- "$1" >/dev/null 2>&1
-}
-
-is_file_tracked() {
- git_is_file_tracked "$1"
-}
-
-# Tries to find a remote source for the changes committed locally.
-# This includes the URL of the remote repository including the last commit and a suitable branch name.
-# Takes one optional argument: the path to inspect
-git_url() {
- # Note: This may not work as expected if multiple remotes are fetched from.
- echo $(git remote -v | \
- awk '/fetch/ {split($2, pieces, "@"); print pieces[2]; exit 0}')
-}
-
-# Returns a string indicating where others can get the current source code (excluding uncommitted changes)
-# Takes one optional argument: the path to inspect
-scm_url() {
- local url
-
- url="$(git_url "$1")"
-
- echo "${url}"
-}
-
-# Retrieve timestamp since last modification. If the sources are pristine,
-# then the timestamp will match that of the SCM's most recent modification
-# date.
-timestamp() {
- local t
-
- # date syntaxes are manifold:
- # gnu date [-d input]... [+FORMAT]
- # netbsd date [-ajnu] [-d date] [-r seconds] [+format] [[[[[[CC]yy]mm]dd]HH]MM[.SS]]
- # freebsd date [-jnu] [-d dst] [-r seconds] [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] [...]
- # dragonflybsd date [-jnu] [-d dst] [-r seconds] [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] [...]
- # openbsd date [-aju] [-d dst] [-r seconds] [+format] [[[[[[cc]yy]mm]dd]HH]MM[.SS]] [...]
- if git_is_file_tracked "$2" ; then
- # are there local changes?
- if git_has_local_changes "$2" ; then
- t=$(date -u "${1}")
- else
- # No local changes, get date of the last commit
- case $(uname) in
- # Most BSD dates do not support parsing date values from user input with -d but all of
- # them support parsing epoch seconds with -r. Thanks to git we can easily use that:
- NetBSD|OpenBSD|DragonFly|FreeBSD)
- t=$(date -u -r "$(git log --pretty=format:%ct -1 -- $2)" "$1" 2>/dev/null);;
- *)
- t=$(date -d "$(git log --pretty=format:%cD -1 -- $2)" -u "$1" 2>/dev/null);;
- esac
- fi
- else
- t=$(date -u "$1")
- fi
-
- if [ -z "$t" ]; then
- echo "Warning: Could not determine timestamp." 2>/dev/null
- fi
- echo "${t}"
-}
-
-# Retrieve local SCM revision info. This is useful if we're working in a different SCM than upstream and/or
-# have local changes.
-local_revision() {
- local r
-
- if git_is_file_tracked "$1" ; then
- r=$(git_last_commit "$1")
-
- if git_has_local_changes "$1" ; then
- r="$r-dirty"
- fi
- else
- return ${EXIT_FAILURE}
- fi
-
- echo "${r}"
-}
-
-upstream_revision() {
- local r=
-
- r=$(git log remotes/origin/master -1 --format=format:%h)
-
- if [ -z "$r" ]; then
- r="unknown" # default to unknown
- fi
- echo "${r}"
-}
-
-show_help() {
- echo "Usage:
- ${0} <command> [path]
-
-Commands
- -h or --help
- this message
- -l or --local
- local revision information including an indicator for uncommitted changes
- -u or --upstream
- upstream revision
- -U or --url
- URL associated with the latest commit
- -d or --date
- date of most recent modification
- -t or --timestamp
- timestamp of most recent modification
-"
- return
-}
-
-check_action() {
- if [ -n "$action" ]; then
- echo "Error: Multiple actions given.">&2
- exit ${EXIT_FAILURE}
- fi
-}
-
-main() {
- local query_path=
- local action=
-
- # The is the main loop
- while [ $# -gt 0 ];
- do
- case ${1} in
- -h|--help)
- action=show_help;
- shift;;
- -l|--local)
- check_action $1
- action=local_revision
- shift;;
- -u|--upstream)
- check_action $1
- action=upstream_revision
- shift;;
- -U|--url)
- check_action $1
- action=scm_url
- shift;;
- -d|--date)
- check_action $1
- action="timestamp +%Y-%m-%d" # refrain from suffixing 'Z' to indicate it's UTC
- shift;;
- -t|--timestamp)
- check_action $1
- action="timestamp +%Y-%m-%dT%H:%M:%SZ" # There is only one valid time format! ISO 8601
- shift;;
- -*)
- show_help;
- echo "Error: Invalid option: ${1}"
- exit ${EXIT_FAILURE};;
- *)
- if [ -z "$query_path" ] ; then
- if [ ! -e "$1" ] ; then
- echo "Error: Path \"${1}\" does not exist.">&2
- exit ${EXIT_FAILURE}
- fi
- query_path=$1
- else
- echo "Warning: Ignoring over-abundant paramter: \"${1}\"">&2
- fi
- shift;;
- esac;
- done
-
- # default to current directory (usually equals the whole repository)
- if [ -z "$query_path" ] ; then
- query_path=.
- fi
- if ! is_file_tracked "$query_path" ; then
- echo "Warning: Path \"${query_path}\" is not under version control.">&2
- fi
- if [ -z "$action" ] ; then
- show_help
- echo "Error: No actions specified"
- exit ${EXIT_FAILURE}
- fi
-
- $action "$query_path"
-}
-
-main $@
diff --git a/util/status/status.sh b/util/status/status.sh
deleted file mode 100644
index 4b5496c..0000000
--- a/util/status/status.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/sh
-#
-# This file is part of the coreboot project.
-#
-# Copyright (C) 2013 Google Inc.
-#
-
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-OUTDIR="status"
-
-# Stuff from command-line switches
-REMOTE_HOST=""
-CLOBBER_OUTPUT=0
-UPLOAD_RESULTS=0
-
-show_help() {
- echo "Usage:
- ${0} <option>
-
-Options
- -h
- Show this message.
- -c
- Clobber output when finished.
- -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)
-# $2: command to test
-test_cmd()
-{
- local rc
-
- if [ -e "$2" ]; then
- return
- fi
-
- if [[ $1 -eq 1 && "$REMOTE_HOST" ]]; then
- ssh root@${REMOTE_HOST} which "$2" >/dev/null
- rc=$?
- else
- which "$2" >/dev/null
- rc=$?
- fi
-
- if [ $rc -eq 0 ]; then
- return
- fi
-
- echo "$2 not found"
- exit $EXIT_FAILURE
-}
-
-# run a command
-#
-# $1: 0 to run command locally, 1 to run remotely if remote host defined
-# $2: command
-cmd()
-{
- if [ -e "$2" ]; then
- return
- fi
-
- if [[ $1 -eq 1 && -n "$REMOTE_HOST" ]]; then
- ssh root@${REMOTE_HOST} "$2"
- else
- $2
- fi
-
- if [ $? -eq 0 ]; then
- return
- fi
-
- echo "Failed to run command: $2"
- exit $EXIT_FAILURE
-}
-
-while getopts "chr:u" opt; do
- case "$opt" in
- h)
- show_help
- exit $EXIT_SUCCESS
- ;;
- c)
- CLOBBER_OUTPUT=1
- ;;
- r)
- REMOTE_HOST="$OPTARG"
- ;;
- u)
- UPLOAD_RESULTS=1
- ;;
- esac
-done
-
-if [ -e "$OUTDIR" ]; then
- echo "Output directory exists, aborting."
- exit $EXIT_FAILURE
-fi
-
-mkdir "$OUTDIR"
-
-getrevision="util/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
-
-cbfstool_cmd="util/cbfstool/cbfstool"
-test_cmd 0 "$cbfstool_cmd"
-$cbfstool_cmd build/coreboot.rom extract -n config -f ${OUTDIR}/config.txt
-
-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
-
-cmd 1 dmesg > ${OUTDIR}/kernel_log.txt
-
-#if [ $UPLOAD_RESULTS -eq 1 ]; then
-# FIXME: implement this part
-#fi
-
-if [ $CLOBBER_OUTPUT -eq 1 ]; then
- rm -rf ${OUTDIR}
-fi
-
-exit $EXIT_SUCCESS
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3992
-gerrit
commit f667c5eea0786d4fb68fd7bfd902ef476448d8b6
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sat Oct 26 22:35:46 2013 +0200
lenovo/x60: export reboot_bits nvram configuration.
This permits any software running after the ramstage to tell coreboot that the
boot was successfull.
Change-Id: I6b19160dcf1ea1948360db71d02e344a3bcb44ef
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/mainboard/lenovo/x60/cmos.layout | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mainboard/lenovo/x60/cmos.layout b/src/mainboard/lenovo/x60/cmos.layout
index ab51a84..a6e1a4c 100644
--- a/src/mainboard/lenovo/x60/cmos.layout
+++ b/src/mainboard/lenovo/x60/cmos.layout
@@ -71,7 +71,7 @@ entries
# RTC_BOOT_BYTE (coreboot hardcoded)
384 1 e 4 boot_option
385 1 e 4 last_boot
-388 4 r 0 reboot_bits
+388 4 h 0 reboot_bits
#390 2 r 0 unused?
# -----------------------------------------------------------------
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3991
-gerrit
commit dcab843a001bd645dd4aca98dbc87611bdb4ad42
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sun Oct 20 23:37:35 2013 +0200
X86 Kconfig: Make the MAX_REBOOT_CNT selectable in X86_BOOTBLOCK_NORMAL mode.
src/arch/x86/Kconfig defined MAX_REBOOT_CNT as 3.
In the bootblock, the reboot_bits cmos option is increased by one at each boot.
If the boot is successful, the respective nvram settings have to be reset to
boot on the normal/ prefix next time.
If KEEP_BOOT_COUNT is selected, it has to be done after the ramstage,
if not, it's done in the ramstage.
In case of a failed boot, the reboot_bits keeps increasing until it reach
KEEP_BOOT_COUNT. Once it is reached, it will swtich to fallback/ at next boot.
With KEEP_BOOT_COUNT beeing hidden in make menuconfig, and set to 3,
the user probably won't know that coreboot will only switch to fallback after
3 failed boots, and will act as if the computer will not boot anymore with its
current coreboot image.
This patch makes KEEP_BOOT_COUNT selectable.
This patch was tested on the Lenovo X60.
Change-Id: I746df11c933dfe62e01e1591479ca96a84907dc0
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/arch/x86/Kconfig | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 0a21fcc..52bafbd 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -42,12 +42,6 @@ config STACK_SIZE
hex
default 0x1000
-# Maximum reboot count
-# TODO: Improve description.
-config MAX_REBOOT_CNT
- int
- default 3
-
# This is something you almost certainly don't want to mess with.
# How many SIPIs do we send when starting up APs and cores?
# The answer in 2000 or so was '2'. Nowadays, on many systems,
@@ -72,6 +66,20 @@ config X86_BOOTBLOCK_NORMAL
endchoice
+# Maximum reboot count
+config MAX_REBOOT_CNT
+ int "Number of failed boot attempts before switching back to fallback/"
+ default 3
+ depends on X86_BOOTBLOCK_NORMAL
+ help
+ Note that the minimum number of reset a machine has to do to boot
+ can vary across machines.
+ If you set it to a number that is less that the machine minimum,
+ the machine will then switch to fallback/ during the next boot.
+ Once in fallback/, the machine will keep that settings unless
+ the nvram is reset, which will make it switch to fallback/
+ again during the next boot.
+
config BOOTBLOCK_SOURCE
string
default "bootblock_simple.c" if X86_BOOTBLOCK_SIMPLE