Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions sd_fuse/sd_fusing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
#

abort() {
echo $1
echo "$1"
exit 1
}

[ -z $1 ] && abort "usage: $0 <your/memory/card/device>"
[ -z ${UBOOT} ] && UBOOT=${PWD}/u-boot.bin
[ ! -f ${UBOOT} ] && abort "error: ${UBOOT} is not exist"
[ -z "$1" ] && abort "usage: $0 <your/memory/card/device>"
[ -z "$UBOOT" ] && UBOOT="${PWD}/u-boot.bin"
if [ ! -f "$UBOOT" ] ; then
UBOOT="$(echo "$0" | perl -pe 's/[^\/]*$//g')u-boot.bin"
fi
[ ! -f "$UBOOT" ] && abort "error: $UBOOT is not exist"

sudo dd if=$UBOOT of=$1 conv=fsync,notrunc bs=512 seek=1
sudo dd if="$UBOOT" of="$1" conv=fsync,notrunc bs=512 seek=1

sync

sudo eject $1
echo Finished.
sudo eject "$1"
echo "Finished."