#!/bin/sh

if [ $# != 2 ];
then
				echo "Usage: $0 <image> <partition>"
				exit 1
fi

image=$1
partition=$2

echo "Unlocking ${partition}"
unprotect ${partition}

echo "Erasing ${partition}"
erase ${partition}

echo "Flashing ${image} to ${partition}"
cp ${image} ${partition}

echo "Locking ${partition}"
protect ${partition}
