From ce27877473d41592b7bc3be515c074acb3a257c0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 2 May 2023 11:31:36 +0100 Subject: add flash script --- bin/flash | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bin/flash diff --git a/bin/flash b/bin/flash new file mode 100755 index 0000000..42910a9 --- /dev/null +++ b/bin/flash @@ -0,0 +1,19 @@ +#!/bin/bash + +SOURCE=${BASH_SOURCE[0]} +while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) + SOURCE=$(readlink "$SOURCE") + [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) + +F="$1" +CHIP_SIZE=2048 + +dd if=/dev/zero ibs=1k count=${CHIP_SIZE} | tr "\000" "\377" | cat $F - | dd ibs=1k count=${CHIP_SIZE} | ${DIR}/../sbin/flashrom --programmer ft2232_spi:type=tumpalite,gpiol0=L -w - + + +#${DIR}/sbin/flashrom --programmer ft2232_spi:type=tumpalite,gpiol0=L -w padded.bin + + -- cgit v1.2.3