summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2011-03-03 18:08:18 -0800
committerBill Richardson <wfrichar@chromium.org>2011-03-03 18:08:18 -0800
commitccdaa47b4d7a0528d148bcbdf22b3b7806ac9b7c (patch)
tree4fada52c62bb54755afd0da27c85738f7e7cd1b1
parentf82f4ae92048f0af8ec4e1934fe58f438301c4e9 (diff)
downloadvboot-ccdaa47b4d7a0528d148bcbdf22b3b7806ac9b7c.tar.gz
Support new flashmap layout in dev_debug_vboot.
Make dev_debug_vboot look first for the new section names, then the old ones. Change-Id: I723f022bbbb23257c7c57db9543d7c35f524f95d BUG=chromium-os:12611 TEST=manual Rerun the steps that reproduce the problem as reported in the initial bug report. You should see much more information. Review URL: http://codereview.chromium.org/6621003
-rwxr-xr-xutility/dev_debug_vboot38
-rw-r--r--utility/dump_fmap.c3
2 files changed, 34 insertions, 7 deletions
diff --git a/utility/dev_debug_vboot b/utility/dev_debug_vboot
index a171eb4c..55cdd73f 100755
--- a/utility/dev_debug_vboot
+++ b/utility/dev_debug_vboot
@@ -47,9 +47,9 @@ loghead() {
echo "+" "$@" "| head" >> "$LOGFILE"
"$@" | head >> "$LOGFILE" 2>&1
}
+
logdie() {
echo "+" "$@" >> "$LOGFILE"
- "$@" >> "$LOGFILE" 2>&1
die "$@"
}
@@ -75,6 +75,19 @@ require_chromeos_bios() {
log ls -la /root/.force_update_firmware
}
+# Search for files from the FMAP, in the order listed. Return the first one
+# found or die if none are there.
+find_name() {
+ for fn in "$@"; do
+ if [ -e "$fn" ]; then
+ echo "$fn"
+ return
+ fi
+ done
+ echo "+ no files named $@" >> "$LOGFILE"
+ exit 1
+}
+
# Here we go...
umask 022
trap cleanup EXIT
@@ -129,18 +142,31 @@ ls *kern*.blob >/dev/null 2>&1 || logdie "no kernel images found"
info "Extracting BIOS components..."
log dump_fmap -x ${BIOS} || logdie "Unable to extract BIOS components"
+# Find the FMAP regions we're interested in. Look first for the new names, then
+# the old names.
+area_gbb=$(find_name GBB GBB_Area) || \
+ logdie "no area_gbb"
+area_vblock_a=$(find_name VBLOCK_A Firmware_A_Key) || \
+ logdie "no area_vblock_a"
+area_vblock_b=$(find_name VBLOCK_B Firmware_B_Key) || \
+ logdie "no area_vblock_b"
+area_fw_main_a=$(find_name FW_MAIN_A Firmware_A_Data) || \
+ logdie "no area_fw_main_a"
+area_fw_main_b=$(find_name FW_MAIN_B Firmware_B_Data) || \
+ logdie "no area_fw_main_a"
+
info "Pulling root and recovery keys from GBB..."
log gbb_utility -g --rootkey rootkey.vbpubk --recoverykey recoverykey.vbpubk \
- GBB_Area || logdie "Unable to extract keys from GBB"
+ "$area_gbb" || logdie "Unable to extract keys from GBB"
log vbutil_key --unpack rootkey.vbpubk
log vbutil_key --unpack recoverykey.vbpubk
infon "Verify firmware A with root key... "
-log vbutil_firmware --verify Firmware_A_Key --signpubkey rootkey.vbpubk \
- --fv Firmware_A_Data --kernelkey kernel_subkey_a.vbpubk ; result
+log vbutil_firmware --verify "$area_vblock_a" --signpubkey rootkey.vbpubk \
+ --fv "$area_fw_main_a" --kernelkey kernel_subkey_a.vbpubk ; result
infon "Verify firmware B with root key... "
-log vbutil_firmware --verify Firmware_B_Key --signpubkey rootkey.vbpubk \
- --fv Firmware_B_Data --kernelkey kernel_subkey_b.vbpubk ; result
+log vbutil_firmware --verify "$area_vblock_b" --signpubkey rootkey.vbpubk \
+ --fv "$area_fw_main_b" --kernelkey kernel_subkey_b.vbpubk ; result
for key in kernel_subkey_a.vbpubk kernel_subkey_b.vbpubk; do
infon "Test $key... "
diff --git a/utility/dump_fmap.c b/utility/dump_fmap.c
index bd7abac9..ab2043c8 100644
--- a/utility/dump_fmap.c
+++ b/utility/dump_fmap.c
@@ -57,7 +57,8 @@ static int dump_fmap(const void* ptr) {
progname, buf, strerror(errno));
retval = 1;
} else {
- if (1 != fwrite(base_of_rom + ah->area_offset, ah->area_size, 1, fp)) {
+ if (ah->area_size &&
+ 1 != fwrite(base_of_rom + ah->area_offset, ah->area_size, 1, fp)) {
fprintf(stderr, "%s: can't write %s: %s\n",
progname, buf, strerror(errno));
retval = 1;