Repository navigation
sysupgrade: carry the settings on the split NOR layout after the hand-off - #2677
Conversation
…-off Since #2648 every NOR rootfs write hands PID 1 to the RAM root, and the second phase's release_old_root lazily unmounts /mnt -- the old root and the jffs2 overlay under it. do_update_firmware_split then looked for rootfs_data in /proc/mounts, found nothing, took the camera for one without settings and staged an empty blob, still printing "Settings staged". The first boot honours an empty blob by erasing the overlay: every split NOR upgrade since 2026-10-21 came back on defaults (reported on a gk7205v300, nightly-20261022 and -20261023). The first phase now records that the overlay was mounted (split_overlay_mounted, exported into the RAM phase). Finding it gone, the RAM phase mounts rootfs_data read-only and copies the settings from that, as rewrite_ubifs does on UBI. Nothing holds the partition by then. If that mount fails, the run stops before the write: a reboot with nothing written, not an upgrade to defaults. -n and an overlay that was never mounted (a tmpfs one) still stage an empty blob. Tests: test_sysupgrade.sh (336 checks pass) gains the handed-off RAM phase on the split layout: the settings are carried, an unmountable overlay refuses before writing, -n stays empty, and the first phase records the mount. Without this change the first of those reproduces the field result exactly (blob length 000000000000). QEMU (qemu-hisilicon hi3516ev300, split layout, OpenIPC U-Boot): a boot script in the jffs2 overlay writes a marker and runs sysupgrade -z --archive with the hi3516ev300 split package; both runs hand PID 1 off. - master's sysupgrade: "Clearing settings after an upgrade...", and the script (part of the overlay) is gone after the reboot; - this one: "Restoring settings carried over by an upgrade...", and the script runs again from the carried overlay. Not run on hardware.
PR Summary by QodoPreserve split NOR settings after the RAM handoff
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Camera changes lack real-camera proof
|
…et go The temporary read-only mount of rootfs_data has to be released before the flash under it is rewritten; if busybox umount fails, die before the write instead of going on. The jffs2 mount stub now serves files from a directory named for the device it is asked to mount, so the handed-off test checks that the settings come from rootfs_data (mtdblock5) rather than from the stub. A new test injects the unmount failure: refused, nothing written. test_sysupgrade.sh: 337 checks pass.
…s last rounds (#631) * nor-split, sysupgrade, install pages: catch up with the split layout's last rounds - nor-split-layout: the 3.0 and 3.4 kernels without a device tree (the Hi3516CV100 family, Hi3520DV200, GK7102/GK7102S) find the layout from the images and log the offsets; the fixed-slot package note covers every SoC that ships both packages; the settings sysupgrade lost on split upgrades from 2026-10-21 to 10-24 (OpenIPC/firmware#2677) and the split upgrade on 3.x kernels without sysfs partition offsets (#2683); a "Recovery from U-Boot" section: fwupd takes firmware.bin.<soc>, else the fixed-slot pair, and a split kernel that fails its CRC starts recovery by itself. - sysupgrade: points a camera that came back on defaults then to that note. - install-goke: the split layout does not need the OpenIPC U-Boot; any U-Boot that loads the kernel from 0x50000 boots it, as nor-split-layout already says. - install-novatek: OpenIPC U-Boot builds for NT98562 and NT98566 are published since 2026-10-27, QEMU only so far. * nor-split: recovery needs a split-mode U-Boot, a pair to fall back on, and erases the settings Review of #631: the recovery section names the U-Boot builds that have it (from OpenIPC/u-boot#77 on the Hi3516CV100 family and Hi3520DV200, #87 on GK7102/GK7102S; earlier ones install only the fixed-slot pair), offers the fixed-slot fallback only where the SoC ships that package (the split-only ones need firmware.bin on the server), and warns that fwupd, by hand or after a failed kernel CRC, erases the settings.
Every split NOR upgrade since #2648 (2026-10-21) has reset the camera's settings. This was reported on a gk7205v300 upgrading to nightly-20261022 and nightly-20261023.
Cause
release_old_rootrunsumount -l /mnt, which removes the old root and the jffs2 overlay with it.do_update_firmware_splitthen finds norootfs_datain/proc/mounts. It treats the camera as having no settings, stages an empty blob, and still prints "Settings staged"./inithandles the empty blob as-nand erases the overlay.Fix
split_overlay_mounted, exported into the RAM phase).rootfs_dataread-only and copies the settings from it, asrewrite_ubifsalready does on UBI.-n, and an overlay that was never mounted (tmpfs), still stage an empty blob.Cameras fetch
sysupgradefrom master when they upgrade (self_update), so this fixes upgrades to any build once it is merged. Settings already lost cannot be recovered: the first boot erased them.Verification
test_sysupgrade.sh: all 336 checks pass. New checks cover the split layout's handed-off RAM phase:-nstays empty;Run against master's
sysupgrade, the first check reproduces the field result: blob length000000000000.QEMU (qemu-hisilicon hi3516ev300, split layout): a boot script in the jffs2 overlay writes a marker and runs
sysupgrade -z --archivewith the hi3516ev300 split package. Both runs hand PID 1 off.Clearing settings after an upgrade..., and the overlay's script is gone after the reboot.Restoring settings carried over by an upgrade..., and the script runs again from the carried overlay.Not run on hardware.