installer v2: single-stage slot install; slotmigrate legacy reclaim

install-forgefirm.sh is now single-stage and never repartitions: run
from factory firmware, it archives every factory slot version plus the
recovery boot partitions to /data/forgefirm/archive (manifest with
md5s), verifies the signed forgefirm.fw against the embedded ForgeFIRM
pubkey (raw 32-byte form for the factory's fwup 0.14.2; dev key until
the production key ceremony), applies it to the INACTIVE slot with the
factory's own fwup, post-verifies the written rootfs, installs
/data/ffboot, and flips the saved env with read-back verification. The
booted factory slot stays installed and bootable; /data is untouched
beyond the archive. Fixed release asset name forgefirm.fw (version in
the fwup metadata and release tag).

slotmigrate (new recipe, rcS before mountall) reclaims the legacy
layout on eMMC-slot boots: deletes p4, grows p3 to the end of the
disk (sfdisk + partx BLKPG - works with a sibling partition as root),
then e2fsck+resize2fs. Every step is keyed off the actual disk state,
so interrupted runs resume and factory-layout disks are a no-op; SD
boots never touch the eMMC.
This commit is contained in:
ScottW514
2026-08-08 12:26:33 -04:00
parent 5035b2744e
commit 1097184e13
5 changed files with 313 additions and 152 deletions
@@ -0,0 +1,28 @@
SUMMARY = "Boot-time migration from the legacy ForgeFIRM disk layout"
DESCRIPTION = "Reclaims the legacy ForgeFIRM eMMC partition (p4) and grows \
/data back to the factory footprint. Runs before mountall; state-derived \
and idempotent; a factory-layout disk is a no-op. Acts only when booted \
from an eMMC rootfs slot."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://slotmigrate"
S = "${WORKDIR}"
inherit update-rc.d
INITSCRIPT_NAME = "slotmigrate"
INITSCRIPT_PARAMS = "start 2 S ."
RDEPENDS:${PN} = " \
util-linux-sfdisk \
util-linux-partx \
e2fsprogs-e2fsck \
e2fsprogs-tune2fs \
e2fsprogs-resize2fs \
"
do_install() {
install -Dm 0755 ${WORKDIR}/slotmigrate ${D}${sysconfdir}/init.d/slotmigrate
}