build-release.sh builds the Pi image and the MT6000 root + FIT into release/guix-router-DATE-REV/ (zstd), with both installers, checksums of the compressed and uncompressed images, BUILD-INFO and INSTALL.md. install-mt6000.sh installs a release on a GL-MT6000 with stock U-Boot: it serves OpenWrt's official initramfs (downloaded, checksum-pinned) by TFTP in the sysupgrade form GL's U-Boot accepts, waits for the power cycle, writes p7/p6 from the OpenWrt running in RAM, verifies both and reboots into Guix. flash-rpi.sh takes .zst images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
913 B
Bash
Executable File
22 lines
913 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Flash the Pi 4 image to an SD card / USB SSD.
|
|
# Usage: sudo ./flash-rpi.sh /dev/sdX [image[.gz|.zst]] (check `lsblk` first!)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
DEV="${1:?usage: sudo ./flash-rpi.sh /dev/sdX}"
|
|
IMG="${2:-guix-rpi4-claude.img}"
|
|
case "$DEV" in
|
|
/dev/nvme[0-9]*n1|/dev/mmcblk[0-9]|/dev/sd[a-z]) ;;
|
|
*) echo "refusing suspicious device $DEV (partition? use the whole disk)" >&2; exit 1 ;;
|
|
esac
|
|
[ -e "$DEV" ] || { echo "no such device $DEV" >&2; exit 1; }
|
|
read -rp "About to OVERWRITE $DEV with $IMG. Type the device name to confirm: " ok
|
|
[ "$ok" = "$DEV" ] || { echo "aborted"; exit 1; }
|
|
case "$IMG" in
|
|
*.gz) gzip -dc "$IMG" | sudo dd of="$DEV" bs=4M status=progress conv=fsync ;;
|
|
*.zst) zstd -dc --long=27 "$IMG" | sudo dd of="$DEV" bs=4M status=progress conv=fsync ;;
|
|
*) sudo dd if="$IMG" of="$DEV" bs=4M status=progress conv=fsync ;;
|
|
esac
|
|
sudo sync
|
|
echo "done"
|