Files
makronix/mobile/tools/flash-root.sh
T
lotherkandClaude Sonnet 5.5 73c9de51a6 licence: the CNCL line in every file Makronix wrote (tools, docs, www, mobile, top level)
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>
2026-11-14 11:50:26 +00:00

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"