Nico Huber has uploaded a new change for review. ( https://review.coreboot.org/19352 )
Change subject: Simple, clumsy script to test layout handling ......................................................................
Simple, clumsy script to test layout handling
Not for merge.
First parameter are flashrom options, second an optional layout file (if not provided, `--ifd` will be used). e.g.
sh util/test_layout "-p dummy:emulate=MX25L6436,image=/tmp/dummy.rom -c MX25L6436E/MX25L6445E/MX25L6465E/MX25L6473E" util/test.layout
Change-Id: I37124455071bf3395384a58ad236c998f738c418 Signed-off-by: Nico Huber nico.huber@secunet.com --- A util/test.layout A util/test_layout 2 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/52/19352/1
diff --git a/util/test.layout b/util/test.layout new file mode 100644 index 0000000..3139f05 --- /dev/null +++ b/util/test.layout @@ -0,0 +1,4 @@ +00000000:00000fff Flash_Descriptor +00001000:00002fff GbE +00003000:0057ffef Intel_ME +0057fff0:007fffff BIOS diff --git a/util/test_layout b/util/test_layout new file mode 100644 index 0000000..d328bcc --- /dev/null +++ b/util/test_layout @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +TMP=$(mktemp -d --tmpdir layout-test.XXXXXX) +echo ${TMP} + +FLASHROM_ARGS="$1" +if [ $# -ge 2 ]; then + LAYOUT_ARGS="${FLASHROM_ARGS} --layout $2" +else + LAYOUT_ARGS="${FLASHROM_ARGS} --ifd" +fi + +flashrom() { + echo flashrom $* + ./flashrom -V ${LAYOUT_ARGS} $* 2>&1 | tee -a ${TMP}/layout.log | grep VERIFIED +} + +./flashrom ${FLASHROM_ARGS} -r ${TMP}/backup.rom +dd if=/dev/urandom of=${TMP}/random.rom bs=$(stat -c%s ${TMP}/backup.rom) count=1 + +test_layout() { + all_regions="Flash_Descriptor GbE Intel_ME BIOS" + included="$*" + + for i in $included; do + flashrom -i $i -A -w ${TMP}/random.rom + done + for i in $all_regions; do + if echo $included | grep -q "<${i}>"; then + f=${TMP}/random.rom + else + f=${TMP}/backup.rom + fi + flashrom -i $i -v $f + done + ./flashrom ${FLASHROM_ARGS} -w ${TMP}/backup.rom +} + +test_layout GbE +test_layout Intel_ME +test_layout GbE BIOS +test_layout GbE Intel_ME