[flashrom] [PATCH 0/1] Add support for reading the current flash contents from a file

Paul Kocialkowski contact at paulk.fr
Mon Feb 29 19:44:32 CET 2016


Here is an example script that I'm using to read the flash contents to a file
once and update it as I flash newer versions of the software:

#!/bin/sh

flashrom="flashrom"
programmer="ft2232_spi:type=openmoko,divisor=8"

contents="/home/paulk/embedded-freedom/Devices/G505s/kb9012/flashrom/flash-contents.img"
image="$1"

if [ -z $image ]
then
	echo "Reading initial flash contents"

	timeb=$( date +%s )
	$flashrom -p $programmer -r $contents
	timea=$( date +%s )

	echo "Time: "$(( $timea - $timeb ))" seconds"
else
	echo "Writing new flash contents"

	timeb=$( date +%s )
	$flashrom -p $programmer -w $image -C $contents --noverify
	rc=$?
	timea=$( date +%s )

	if [ "$rc" -eq "0" ]
	then
		echo "Copying new flash contents"
		cp $image $contents
	fi

	echo "Time: "$(( $timea - $timeb ))" seconds"
fi





More information about the flashrom mailing list