Increase test coverage for dump_fmap

This checks some additional cases where the FMAP is a bit messed up.

BUG=chromium:224734
BRANCH=ToT
TEST=make runtests

Change-Id: Ic2b16bd8afdd1247d1f24c9f976d967764cadb73
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207719
This commit is contained in:
Bill Richardson
2014-07-09 21:11:12 -07:00
committed by chrome-internal-fetch
parent d2d08b2cc6
commit bc2d2b21d9
7 changed files with 101 additions and 16 deletions

View File

@@ -686,7 +686,7 @@ all: fwlib $(if ${VBOOT2},fwlib2) $(if ${FIRMWARE_ARCH},,host_stuff) \
# Host targets
.PHONY: host_stuff
host_stuff: utillib cgpt utils futil hostlib tests
host_stuff: utillib hostlib cgpt utils futil tests
.PHONY: clean
clean:

Binary file not shown.

View File

@@ -0,0 +1,4 @@
ERROR: RO_VPD and RO_UNUSED overlap
RO_VPD: 0x1a0000 - 0x1b0000
RO_UNUSED: 0x1af000 - 0x200000
Use more -h args to ignore this error

View File

@@ -0,0 +1,29 @@
ERROR: RO_VPD and RO_UNUSED overlap
RO_VPD: 0x1a0000 - 0x1b0000
RO_UNUSED: 0x1af000 - 0x200000
# name start end size
RW_PRIVATE 003fc000 00400000 00004000
RW_ENVIRONMENT 003fc000 00400000 00004000 // DUPLICATE
RW_SHARED 003f8000 003fc000 00004000
SHARED_DATA 003f8000 003fc000 00004000 // DUPLICATE
RW_VPD 003f0000 003f8000 00008000
RW_SECTION_B 00300000 003f0000 000f0000
RW_FWID_B 003eff00 003f0000 00000100
FW_MAIN_B 00302000 003eff00 000edf00
VBLOCK_B 00300000 00302000 00002000
RW_SECTION_A 00200000 002f0000 000f0000
RW_FWID_A 002eff00 002f0000 00000100
FW_MAIN_A 00202000 002eff00 000edf00
VBLOCK_A 00200000 00202000 00002000
WP_RO 00000000 00200000 00200000
RO_UNUSED 001af000 00200000 00051000
RO_VPD 001a0000 001b0000 00010000
RO_SECTION 00000000 0019f000 0019f000
GBB 000b0000 0019f000 000ef000
RO_FRID 000aff00 000b0000 00000100
FMAP 000a0000 000a1000 00001000
U_BOOT 00006000 000a0000 0009a000
BL2 SPL 00002000 00006000 00004000
BL1 PRE_BOOT 00000000 00002000 00002000
WARNING: unused regions found. Use -H to see them

View File

@@ -0,0 +1,32 @@
ERROR: RO_VPD and RO_UNUSED overlap
RO_VPD: 0x1a0000 - 0x1b0000
RO_UNUSED: 0x1af000 - 0x200000
# name start end size
-entire flash- 00000000 00400000 00400000
RW_PRIVATE 003fc000 00400000 00004000
RW_ENVIRONMENT 003fc000 00400000 00004000 // DUPLICATE
RW_SHARED 003f8000 003fc000 00004000
SHARED_DATA 003f8000 003fc000 00004000 // DUPLICATE
RW_VPD 003f0000 003f8000 00008000
RW_SECTION_B 00300000 003f0000 000f0000
RW_FWID_B 003eff00 003f0000 00000100
FW_MAIN_B 00302000 003eff00 000edf00
VBLOCK_B 00300000 00302000 00002000
002f0000 00300000 00010000 // gap in -entire flash-
RW_SECTION_A 00200000 002f0000 000f0000
RW_FWID_A 002eff00 002f0000 00000100
FW_MAIN_A 00202000 002eff00 000edf00
VBLOCK_A 00200000 00202000 00002000
WP_RO 00000000 00200000 00200000
RO_UNUSED 001af000 00200000 00051000
001b0000 001af000 fffff000 // gap in WP_RO
RO_VPD 001a0000 001b0000 00010000
0019f000 001a0000 00001000 // gap in WP_RO
RO_SECTION 00000000 0019f000 0019f000
GBB 000b0000 0019f000 000ef000
RO_FRID 000aff00 000b0000 00000100
000a1000 000aff00 0000ef00 // gap in RO_SECTION
FMAP 000a0000 000a1000 00001000
U_BOOT 00006000 000a0000 0009a000
BL2 SPL 00002000 00006000 00004000
BL1 PRE_BOOT 00000000 00002000 00002000

View File

@@ -0,0 +1,12 @@
hit at 0x00000800
fmap_signature __FMAP__
fmap_version: 1.0
fmap_base: 0x0
fmap_size: 0x00800000 (8388608)
fmap_name: FMAP
fmap_nareas: 30
area: 2
area_offset: 0x00000000
area_size: 0x00001000 (4096)
area_name: SI_DESC
saved as "SI_DESC"

View File

@@ -1,17 +1,15 @@
#!/bin/bash -eu
#!/bin/bash -eux
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
me=${0##*/}
if [ -e "$OLDDIR/dump_fmap" ] ; then
echo old dump_fmap binary still exists 1>&2
exit 1
fi
TMP="$OUTDIR/$me.tmp"
# Work in scratch directory
cd "$OUTDIR"
TMP="$me.tmp"
# Good FMAP
"$FUTILITY" dump_fmap -f "${SCRIPTDIR}/data_fmap.bin" > "$TMP"
cmp "${SCRIPTDIR}/data_fmap_expect_f.txt" "$TMP"
@@ -23,14 +21,24 @@ cmp "${SCRIPTDIR}/data_fmap_expect_h.txt" "$TMP"
# This should fail because the input file is truncated and doesn't really
# contain the stuff that the FMAP claims it does.
cd "$OUTDIR" # TODO: we really need a directory argument for dump_fmap.
if "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP ; then
echo Wait, that was supposed to fail. 1>&2
exit 1
else
rm -f FMAP
fi
! "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP
# However, this should work.
"$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" SI_DESC > "$TMP"
cmp "${SCRIPTDIR}/data_fmap_expect_x.txt" "$TMP"
# This FMAP has problems, and will fail.
! "$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
cmp "${SCRIPTDIR}/data_fmap2_expect_h.txt" "$TMP"
"$FUTILITY" dump_fmap -hh "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
cmp "${SCRIPTDIR}/data_fmap2_expect_hh.txt" "$TMP"
"$FUTILITY" dump_fmap -hhH "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
cmp "${SCRIPTDIR}/data_fmap2_expect_hhH.txt" "$TMP"
# cleanup
rm -f "$TMP"
rm -f "$TMP" FMAP SI_DESC
exit 0