1 #!/bin/bash -eux 2 # Copyright 2014 The Chromium OS Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style license that can be 4 # found in the LICENSE file. 5 6 me=${0##*/} 7 TMP="$me.tmp" 8 9 # Work in scratch directory 10 cd "$OUTDIR" 11 12 13 IN=${SCRIPTDIR}/data/bios_link_mp.bin 14 BIOS=${TMP}.bios.bin 15 16 cp ${IN} ${BIOS} 17 18 AREAS="RW_SECTION_A VBLOCK_B BOOT_STUB" 19 20 # Extract good blobs first 21 ${FUTILITY} dump_fmap -x ${BIOS} ${AREAS} 22 23 # Save the good blobs, make same-size random blobs, create command 24 CMDS="" 25 for a in ${AREAS}; do 26 size=$(stat -c '%s' $a) 27 mv $a $a.good 28 dd if=/dev/urandom of=$a.rand bs=$size count=1 29 CMDS="$CMDS $a:$a.rand" 30 done 31 32 # Poke the new blobs in 33 ${FUTILITY} load_fmap ${BIOS} ${CMDS} 34 35 # Pull them back out and see if they match 36 ${FUTILITY} dump_fmap -x ${BIOS} ${AREAS} 37 for a in ${AREAS}; do 38 cmp $a $a.rand 39 done 40 41 # cleanup 42 rm -f ${TMP}* ${AREAS} *.rand *.good 43 exit 0 44