Skip to content

Instantly share code, notes, and snippets.

@giuliomoro
Created September 23, 2019 12:19
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 giuliomoro/1b8fb3bdba1adb48fa004b606fa94f1a to your computer and use it in GitHub Desktop.
Save giuliomoro/1b8fb3bdba1adb48fa004b606fa94f1a to your computer and use it in GitHub Desktop.
update uboot (locally or remotely) on a single-partition SD card with BeagleBoard image.
#!/bin/bash -ex
MLO=MLO
IMG=u-boot.img
if [ ! "x${SSH_DEST}" = "x" ]; then
SSH_CMD="ssh -tt $SSH_DEST"
scp $MLO ${SSH_DEST}:MLO
scp $IMG ${SSH_DEST}:uboot.img
MLO=MLO
IMG=uboot.img
else
SSH_CMD="bash -c"
fi
if [ ! "x${DISK}" = "x" ] ; then
${SSH_CMD} "[ -e \"${DISK}\" ] &&\
sudo dd if=${MLO} of=${DISK} count=2 seek=1 bs=128k &&\
sudo dd if=${IMG} of=${DISK} count=4 seek=1 bs=384k &&\
sync &&\
sudo reboot ||\
echo Error, maybe DISK=${DISK} does not exist?"
else
echo Error, on DISK= specified
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment