#!/bin/bash dtparam spi=on gpioset `gpiofind GPIO24`=1 sleep 0.1 gpioset `gpiofind GPIO24`=0 tr '\0' '\377' < /dev/zero | dd bs=1M count=4 of=image iflag=fullblock dd if=${1} conv=notrunc of=image flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=20000 -w image #workaround first time fails after initial programming #flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=20000 -w image dtparam spi=off gpioset `gpiofind GPIO24`=1 #gpioget `gpiofind GPIO24` val="0" while [ "$val" == "0" ] ; do val=`gpioget \`gpiofind GPIO25\`` echo $val sleep 0.1 done dtparam spi=on