mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
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
This commit is contained in:
@@ -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... "
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user