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 6me=${0##*/} 7TMP="$me.tmp" 8 9# Work in scratch directory 10cd "$OUTDIR" 11 12 13IN=${SCRIPTDIR}/data/bios_link_mp.bin 14BIOS=${TMP}.bios.bin 15 16cp ${IN} ${BIOS} 17 18AREAS="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 24CMDS="" 25for 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" 30done 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} 37for a in ${AREAS}; do 38 cmp $a $a.rand 39done 40 41# cleanup 42rm -f ${TMP}* ${AREAS} *.rand *.good 43exit 0 44