consmirror.c: the BSD notice is replaced (Makronix's own file). Files with changes of other sessions pending are left for their commit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
28 lines
1017 B
Bash
28 lines
1017 B
Bash
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
#
|
|
# Write a root file system image (tools/mkrootimg.sh) to the device's
|
|
# ROOT_PARTITION with fastboot. This replaces whatever the partition holds
|
|
# (on hotdogb: userdata, where pmOS was installed); the boot images in the
|
|
# boot slots are not touched. The device must report FASTBOOT_PRODUCT.
|
|
#
|
|
# Usage: flash-root.sh DEVICEDIR IMAGE
|
|
|
|
set -eu
|
|
. "$(dirname "$0")/lib.sh"
|
|
|
|
[ $# -eq 2 ] || { echo "usage: $0 DEVICEDIR IMAGE" >&2; exit 2; }
|
|
load_device "$1"
|
|
img=$2
|
|
|
|
[ "$FLASH_METHOD" = fastboot ] || die "flash method $FLASH_METHOD not implemented"
|
|
[ -n "${ROOT_PARTITION:-}" ] || die "ROOT_PARTITION not set"
|
|
fastboot_ready
|
|
prod=$(timeout 10 fastboot getvar product 2>&1 | sed -n 's/^product: *//p')
|
|
[ "$prod" = "$FASTBOOT_PRODUCT" ] ||
|
|
die "product is '$prod', expected '$FASTBOOT_PRODUCT'"
|
|
|
|
# a raw image larger than the download buffer is split into sparse chunks by
|
|
# fastboot itself
|
|
fastboot flash "$ROOT_PARTITION" "$img"
|