Skip to content

Instantly share code, notes, and snippets.

@kbingham
Created December 15, 2020 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbingham/f7d08077e8aa5d9f307b7546e2da4e1e to your computer and use it in GitHub Desktop.
Save kbingham/f7d08077e8aa5d9f307b7546e2da4e1e to your computer and use it in GitHub Desktop.
SD Card writer (can also write USB sticks)
#!/bin/bash
## Usage sd-card-writer image <target>
IMAGE=$1
TARGET=${2:-/dev/mmcblk0}
if [ ! -b $TARGET ] ; then
echo "$TARGET is not a block device"
exit
fi
set -x
dd \
if=$IMAGE \
of=$TARGET \
bs=4M \
status=progress \
conv=sparse \
oflag=sync
sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment