#!/bin/sh
# Flash the Arch image. The phone must be in fastboot (Volume Down + Power).
# boot     = known-good postmarketOS boot image (6.16.4 kernel + dtb + initramfs) with the cmdline from arch/boot-cmdline.txt
# userdata = arch-begonia.sparse.img (MBR with 4096-byte sectors: p1 ext2 pmOS_boot, p2 ext4 pmOS_root)
set -e
BOOT=${1:?usage: flash.sh <boot.img> <arch-begonia.sparse.img>}
USERDATA=${2:?usage: flash.sh <boot.img> <arch-begonia.sparse.img>}
fastboot flash boot "$BOOT"
fastboot flash userdata "$USERDATA"
fastboot reboot
