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,7 @@
# Configuration for fw_printenv/fw_setenv.
# The factory U-Boot saved environment: redundant 8 KiB copies in the
# eMMC user area (matches the factory firmware's own fw_env config and
# CONFIG_ENV_OFFSET/CONFIG_ENV_OFFSET_REDUND in the bootloader).
# Block device Device offset Env. size
/dev/mmcblk2 0x80000 0x2000
/dev/mmcblk2 0x82000 0x2000