ffboot v2: slot inventory, verified atomic env flips, target probe

-l inventories every bootable partition (SD, eMMC slots 1/2, legacy
p4) as machine-parsable key=value lines: firmware type
(forgefirm/factory), version, kernel presence, booted/next markers,
plus the saved-env selection - the shared probe for the installer and
the forgectrl update manager.

Boot switching now writes all four selection variables (mmcdev,
mmchwpart, mmcpart, mmcroot) in one fw_setenv -s transaction and
read-back verifies, falling back from the libubootenv script format
to the classic u-boot-tools format to per-variable writes - the same
script works on factory firmware and ForgeFIRM. mmchwpart was
previously never set and a mixed env could survive a mid-flip power
cut. Switch targets must pass a content probe (rootfs mounts, kernel
present) unless -f. -e picks the newest factory slot by probing,
excluding slots occupied by ForgeFIRM.

The new ffboot recipe installs it as /usr/sbin/ffboot with
/etc/fw_env.config (factory-identical redundant env layout at eMMC
0x80000/0x82000) - previously the image shipped fw_setenv with no
config. Added to forgefirm-image.
This commit is contained in:
ScottW514
2026-08-08 12:08:14 -04:00
parent 9d410c646a
commit 11fec891ed
4 changed files with 218 additions and 69 deletions
@@ -0,0 +1,25 @@
SUMMARY = "Boot-slot selection and inventory for Glowforge factory hardware"
DESCRIPTION = "Inventories the bootable partitions (ffboot -l) and switches \
the boot target by rewriting the saved U-Boot environment with read-back \
verification. Ships the fw_env.config for the factory eMMC environment \
layout."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# ffboot's canonical home is scripts/ffboot in this repo (the factory-side
# installer downloads it from there); the recipe packages that same file.
FILESEXTRAPATHS:prepend := "${THISDIR}/../../../scripts:"
SRC_URI = " \
file://ffboot \
file://fw_env.config \
"
S = "${WORKDIR}"
RDEPENDS:${PN} = "libubootenv-bin"
do_install() {
install -Dm 0755 ${WORKDIR}/ffboot ${D}${sbindir}/ffboot
install -Dm 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
}