Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: utility/dev_debug_vboot

Issue 4108012: Add option to dev_debug_vboot to clean up after running (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utility/dev_debug_vboot
diff --git a/utility/dev_debug_vboot b/utility/dev_debug_vboot
index 18e76fa12f67c15a3e3a954f06ed6d732af81eb9..faefd93395c467353a88bb306e49eb4c34ebeecb 100755
--- a/utility/dev_debug_vboot
+++ b/utility/dev_debug_vboot
@@ -3,9 +3,26 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
+# Usage: dev_debug_vboot [ --cleanup | DIRECTORY ]
+#
+# This extracts some useful debugging information about verified boot. A short
+# summary is printed on stdout, more detailed information and working files are
+# left in a log directory.
+#
+TMPDIR=/tmp/debug_vboot
LOGFILE=noisy.log
+# TODO(wfrichar): Need to support ARM. The hard disk path is likely different.
+HD=/dev/sda
+ACPI=/sys/devices/platform/chromeos_acpi
+
+cleanup() {
+ if [ -n "${CLEANUP}" ]; then
+ find "${TMPDIR}" -type f -not -name "${LOGFILE}" -exec rm {} ";"
+ fi
+}
+
die() {
echo "$*" 1>&2
exit 1
@@ -40,17 +57,32 @@ result() {
fi
}
-# Optional directory name containing "bios.rom" and "*kern*.blob" files. If not
-# provided, we'll attempt to extract them ourselves.
-if [ -d "$1" ]; then
- TMPDIR="$1"
- [ -d ${TMPDIR} ] || die "${TMPDIR} doesn't exist"
- USE_EXISTING=yes
-else
- TMPDIR=/tmp/debug_vboot
- [ -d ${TMPDIR} ] || mkdir -p ${TMPDIR}
+require_chromeos_bios() {
+ log cgpt show "${HD}"
+ log rootdev -s
+ if [ ! -e "${ACPI}/HWID" ]; then
+ info "Not running Chrome OS BIOS, no further information available"
+ exit 0
+ fi
+ # including /dev/null just to get final "\n"
+ log head "${ACPI}"/*ID "${ACPI}"/BINF* "${ACPI}"/CHSW /dev/null
+}
+
+# Here we go...
+trap cleanup EXIT
+
+# Parse args
+if [ -n "$1" ]; then
+ if [ "$1" = "--cleanup" ]; then
+ CLEANUP=1
+ else
+ TMPDIR="$1"
+ [ -d ${TMPDIR} ] || die "${TMPDIR} doesn't exist"
+ USE_EXISTING=yes
+ fi
fi
+[ -d ${TMPDIR} ] || mkdir -p ${TMPDIR} || exit 1
cd ${TMPDIR}
echo "$0 $*" > "$LOGFILE"
log date
@@ -62,12 +94,12 @@ BIOS=bios.rom
if [ -n "$USE_EXISTING" ]; then
info "Using images in $(pwd)/"
else
+ require_chromeos_bios
info "Extracting BIOS image from flash..."
log flashrom -r ${BIOS}
- # FIXME: support ARM
- HD_KERN_A=/dev/sda2
- HD_KERN_B=/dev/sda4
+ HD_KERN_A="${HD}2"
+ HD_KERN_B="${HD}4"
tmp=$(rootdev -s -d)2
if [ "$tmp" != "$HD_KERN_A" ]; then
USB_KERN_A="$tmp"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698