Commit 3c208d95 authored by Guido Gunther's avatar Guido Gunther

Add helper to update uboot

parent 8db94b49
#!/bin/sh
set -e
dtmodel="/sys/firmware/devicetree/base/model"
if [ -z "$TARGET" ] && [ -f "${dtmodel}" ]; then
case $(cat "${dtmodel}") in
"Purism Librem 5 devkit")
TARGET="/usr/lib/u-boot/librem5_devkit"
;;
"Purism Librem 5")
TARGET="/usr/lib/u-boot/librem5"
;;
*)
echo >&2 "ERROR: Unknown system: ${dtmodel}"
echo >&2 "Specify target: TARGET=/usr/lib/u-boot/UBOOT"
exit 1
;;
esac
fi
UBOOT_IMAGE=${UBOOT_IMAGE:-"u-boot.imx"}
DEV="$1"
if [ -z "$DEV" ] || ! shift || [ -n "$*" ]; then
echo >&2 "Usage: $0 /dev/your-sd-or-mmc-or-image"
exit 1
fi
if [ ! -w "$DEV" ] && [ -z "$FORCE" ]; then
echo >&2 "$0: device/image ($DEV) must be writable"
exit 1
fi
echo "Writing u-boot image"
dd if=/dev/zero of="$DEV" bs=1024 count=1055 seek=2
dd if="${TARGET}/${UBOOT_IMAGE}" conv=notrunc of="$DEV" bs=1024 seek=33
sync "$DEV"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment