Repository navigation
omamobile-modem 0.1.15: keep the modem's own NV writes in a per-phone overlay - #382
Merged
Merged
Conversation
… overlay The modem keeps the carrier profile it applies from the AP (0x4600 after its 0x4602), its cell and band memory and its IMS state in NV, and asks for a reset to load a new profile. With RAM copies of the backup that are dropped at stop, the reboot that answers the reset throws the profile away again, so IMS never gets its carrier settings and SMS and VoLTE fail on networks that need them. Seeding NV from a stock boot isn't an answer: users must never boot stock to make Linux work, and NV is per phone, so nothing can be shipped. The partitions stay exactly as protected as before: the ro=1 and unmounted refusal, the RAM copies checked against the backup's checksums, the stock salted checksum and the baseband guard are unchanged. New is omamobile-modem-nv-overlay, per file because rfsd keeps NV as files in the f2fs copies: at start, after the copies are verified and before the stock checksum check, it lays the overlay in /var/lib/omamobile/modem-nv-overlay (root, 0700) over them, only if every file is on the allow-list (efs/nv_normal.bin with its salted MD5), none is protected (nv_protected.*, efs_backup, identity- or calibration-like names), the store matches its own checksums and it is bound to the current modem-nv.sha256. Otherwise the overlay is set aside with a journal line and the modem starts from the backup alone. The modem's writes are captured after the CP power-off in the unit's stop and every 30 minutes from a timer the unit pulls in, atomically (objects, then MANIFEST by fsync and rename); writes to files off the allow-list are logged and dropped. `omamobile-modem nv-overlay status|diff|capture| reset` is the interface. Off until /etc/omamobile/modem-nv-overlay-enable exists; MODEM-PLAN gets the design and the gated first hardware test, AGENTS.md section 1 the rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d
…p of 0.1.13 main moved under this PR: #386 made omamobile-modem.service Type=notify with the sleep inhibitor (Requires=/After= omamobile-modem-inhibit.service), the modem-boot target and the two markers in lib/omamobile-modem-start; #384, #387 and #388 brought the modem-sit keys that registered IMS on the 7 Pro on 2026-11-03. Resolved: - omamobile-modem.service keeps main's Requires=/After= and adds the overlay's Wants=omamobile-modem-nv-overlay.timer, so the timer hangs off the real unit; the stop's capture still runs in profile_stop after the CP power-off (profiles/modem.conf merged clean). - install: one loop over the five units; the .install note keeps both the boot-target line and the overlay line. - AGENTS.md section 4: main's longer "never restart" bullet (the modem-up marker), the overlay's NV bullet. - version 0.1.15: main is 0.1.13 and #389 claims 0.1.14. - MODEM-PLAN: the NV overlay section says what 2026-11-03 showed (IMS registers without NV persistence; what the overlay still buys). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d
… the runbook points at main's modem-sit Review of #382. apply() computed the binding and scanned every file of the three mounted copies, then wrote base.json and start.json under /run, before it looked at the enable file, and profile_setup dies on a non-zero exit; so "off" cost a read of the copies and two files per modem start on every phone with the package. apply now returns 0 before any read or write when /etc/omamobile/modem-nv-overlay-enable is absent. An enable file created after the modem started therefore finds no base record for that boot: capture and diff say so and exit 0 (nothing is kept until the reboot) instead of failing on the missing base.json. test/nv-overlay step 10 checks that an unenabled apply and capture leave nothing under /run, and that a capture and a diff after a mid-boot enable keep nothing and exit 0. MODEM-PLAN: the runbook's "Before" asked for omamobile-modem-sit 0.3.14 from the modem-sit-attach-apn branch, which is long on main (0.3.28); it now points there and at #373's automatic path (0.3.29). The design's "Start" bullet says that off returns before any read or write. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d
derekross
added a commit
that referenced
this pull request
Nov 3, 2026
…0: the Pixel 7 Pro's modem stack on by default (#398) * omamobile-modem 0.1.16, device-cheetah 0.1.43, omamobile-shell 0.2.98: the Pixel 7 Pro's modem stack on by default The maintainer's decision of 2026-11-03: the next release ships the modem working out of the box (calls, texts and data on the tested network, M4.6 through three reboots). The switch of M4.6, omamobile-modem-boot.target, is now on by default on cheetah, and a boot that can't or shouldn't start the modem costs as little as possible: - omamobile-device-cheetah 0.1.43 enables the target with a vendor wants link under multi-user.target.wants, as it does for the AoC and Wi-Fi units; the four units the target wants get no link of their own, and omamobile-modem itself still enables nothing (its test holds it to that; tegu and raven are untouched). Off: systemctl mask the target. The stack's packages (omamobile-modem-sit, omamobile-mmd) join cheetah's ROOTFS_PACKAGES so the release image carries them. - A phone that isn't provisioned costs nothing: the modem and inhibit units carry ConditionPathExists= for the chroot, the NV checksums and the board id (what tools/phone-provision puts there), so both are skipped, not failed, and the inhibitor isn't held. The inhibitor needs its own copy because the modem unit's Requires= pulls it in even when that unit's conditions skip it. sitd skips itself without /dev/umts_ipc0; sit-data now does too, through a device drop-in: without it a condition-skipped sitd counted as started for sit-data's Requires=, and the fallback would have failed after 60 s and restarted every 10 s all boot. The start script checks the same three paths first, for a start by hand. - The modem-up guard clears itself after one refused boot: a stale marker still refuses that boot and logs where to look (journalctl -b -1), then moves to modem-up.refused-<time>-<pid> (the last three kept) so the next boot starts the modem again. A phone that hangs with the modem up every time loses the modem on every other boot at most, never for good. /etc/omamobile/modem-hold restores the old hard stop; --retry still clears both markers; the bring-up latch keeps its hard stop. - Every refusal leaves one short line in /run/omamobile/modem-refused, and the shell's Mobile data tile shows it under its name instead of "No modem" (omamobile-shell 0.2.98, tile-state.sh): no new notification path, the journal has the rest. Versions: #372 and #380 claim device-cheetah 0.1.42, #389 omamobile-modem 0.1.14 and #382 0.1.15, main has omamobile-shell 0.2.97 (#394); hence 0.1.43, 0.1.16 and 0.2.98. Docs: RELEASES (ROOTFS_PACKAGES, decision 12 amended, checklist step 6), the release notes draft (the modem known issue becomes what works and what still needs a hand), INSTALL, DEVICES, and MODEM-PLAN M4.6b with the runbook: install, two reboots, a refused-boot drill by planting a stale marker, the hold flag. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * omamobile-modem 0.1.16, device-cheetah 0.1.43, omamobile-shell 0.2.100: review round 2, the modem-up guard bounded The review of #398 asked for three changes and a few corrections. The self-clearing modem-up guard was unbounded: a phone that hangs because the modem is up went up, hang, refused, up, hang, refused, for ever, with only a tile line on the boots in between. Now the refused copy the script already keeps is the counter: one automatic retry, then a hold. refuse_unclean keeps the marker and refuses "(held)" when a modem-up.refused-* copy exists (no clean stop since the last refusal); --stopped on this boot's marker removes the copies, so a clean stop resets the count; --retry clears both markers and the copies. The test's "four unclean boots in a row" block becomes "the second refusal holds, a clean stop resets", and M4.6b gets drill B9b for it. systemctl is-enabled reads "disabled" for a unit started by a vendor wants link alone (it reports /etc and /run links only), so B6's pass and stop lines expected the wrong answer and would have stopped a correct install; B6 now expects "enabled" before and "disabled" after the disable, and proves the link with ls -l of the /usr/lib link and systemctl list-dependencies --plain multi-user.target. The README, the target's header and the install message say the same, so nobody reads "disabled" and skips the mask. The read-only NV checksum check (M3.5) opens B6 as well as closing the runbook (AGENTS.md section 1). B8's is-active expectation is "failed inactive inactive active" (mmd runs). omamobile-shell takes 0.2.100: main is 0.2.98 after #397 and #373 is taking 0.2.99. The DEVICES cheetah fingerprint cell reads "works": #358 made it on by default. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * omamobile-modem 0.1.16: the start script's test stops after the marker decision The case "the boot after a refused one starts the modem again" (and the --retry case) ran lib/omamobile-modem-start past the marker refusals and relied on the machine to stop it: on the laptop and in CI no sleep inhibitor is held, so the script refused there before any driver. On the phone, where tools/phone-install-package builds the package as an unprivileged user, the inhibitor is held, so the test went on into the real bring-up and failed on /sys/module/pcie_aspm/parameters/policy (permission denied) and then on omamobile-vendor's "run as root". The script takes a test-only OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS=1 (documented in its header; no unit or install step sets it) and exits 0 right after the marker decision, before the link driver's sysfs read, the inhibitor wait, the first modprobe and the profile. The two cases use it and assert the decision itself: exit 0, the stale marker moved aside with its refused copy kept, no latch written, the earlier reason left for the tile (it is removed only once every refusal has passed, which the stop point comes before). The test also checks that the stop point sits between the marker decision and the sysfs read, the inhibitor and the latch, and that no unit sets the variable. Verified: packages/omamobile-modem/test/all as uid 1000, with and without a systemd-inhibit stand-in that reports the inhibitor held (the phone's case); tools/pr-check origin/main. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * release notes: the carrier APNs come from the SIM, not by hand Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
robotosaith
added a commit
to robotosaith/omarchy-mobile
that referenced
this pull request
Nov 3, 2026
…ekross#373 and derekross#398 main took modem-sit 0.3.29 (derekross#373) and modem 0.1.15 and 0.1.16 (derekross#382, derekross#398) while this waited: the sitd exit lands as 0.3.30 and the modem changes as 0.1.17. The NV overlay's note now says the copies are f2fs on gs201 and ext4 on gs101; it works on the mounted copies, so nothing else in it changes for raven. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robotosaith
added a commit
to robotosaith/omarchy-mobile
that referenced
this pull request
Nov 10, 2026
…ekross#373, derekross#398 and derekross#416 main took modem-sit 0.3.29 (derekross#373) and 0.3.30 (derekross#416), and modem 0.1.15 and 0.1.16 (derekross#382, derekross#398), while this waited: the sitd exit lands as 0.3.31 and the modem changes as 0.1.17. The NV overlay's note now says the copies are f2fs on gs201 and ext4 on gs101; it works on the mounted copies, so nothing else in it changes for raven. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robotosaith
added a commit
to robotosaith/omarchy-mobile
that referenced
this pull request
Nov 11, 2026
…ekross#373, derekross#398 and derekross#416 main took modem-sit 0.3.29 (derekross#373) and 0.3.30 (derekross#416), and modem 0.1.15 and 0.1.16 (derekross#382, derekross#398), while this waited: the sitd exit lands as 0.3.31 and the modem changes as 0.1.17. The NV overlay's note now says the copies are f2fs on gs201 and ext4 on gs101; it works on the mounted copies, so nothing else in it changes for raven. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas
pushed a commit
to robertzas/omarchy-mobile
that referenced
this pull request
Nov 14, 2026
… overlay, off by default (derekross#382) * omamobile-modem 0.1.12: keep the modem's own NV writes in a per-phone overlay The modem keeps the carrier profile it applies from the AP (0x4600 after its 0x4602), its cell and band memory and its IMS state in NV, and asks for a reset to load a new profile. With RAM copies of the backup that are dropped at stop, the reboot that answers the reset throws the profile away again, so IMS never gets its carrier settings and SMS and VoLTE fail on networks that need them. Seeding NV from a stock boot isn't an answer: users must never boot stock to make Linux work, and NV is per phone, so nothing can be shipped. The partitions stay exactly as protected as before: the ro=1 and unmounted refusal, the RAM copies checked against the backup's checksums, the stock salted checksum and the baseband guard are unchanged. New is omamobile-modem-nv-overlay, per file because rfsd keeps NV as files in the f2fs copies: at start, after the copies are verified and before the stock checksum check, it lays the overlay in /var/lib/omamobile/modem-nv-overlay (root, 0700) over them, only if every file is on the allow-list (efs/nv_normal.bin with its salted MD5), none is protected (nv_protected.*, efs_backup, identity- or calibration-like names), the store matches its own checksums and it is bound to the current modem-nv.sha256. Otherwise the overlay is set aside with a journal line and the modem starts from the backup alone. The modem's writes are captured after the CP power-off in the unit's stop and every 30 minutes from a timer the unit pulls in, atomically (objects, then MANIFEST by fsync and rename); writes to files off the allow-list are logged and dropped. `omamobile-modem nv-overlay status|diff|capture| reset` is the interface. Off until /etc/omamobile/modem-nv-overlay-enable exists; MODEM-PLAN gets the design and the gated first hardware test, AGENTS.md section 1 the rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * omamobile-modem 0.1.15: an unenabled NV overlay apply is a no-op, and the runbook points at main's modem-sit Review of derekross#382. apply() computed the binding and scanned every file of the three mounted copies, then wrote base.json and start.json under /run, before it looked at the enable file, and profile_setup dies on a non-zero exit; so "off" cost a read of the copies and two files per modem start on every phone with the package. apply now returns 0 before any read or write when /etc/omamobile/modem-nv-overlay-enable is absent. An enable file created after the modem started therefore finds no base record for that boot: capture and diff say so and exit 0 (nothing is kept until the reboot) instead of failing on the missing base.json. test/nv-overlay step 10 checks that an unenabled apply and capture leave nothing under /run, and that a capture and a diff after a mid-boot enable keep nothing and exit 0. MODEM-PLAN: the runbook's "Before" asked for omamobile-modem-sit 0.3.14 from the modem-sit-attach-apn branch, which is long on main (0.3.28); it now points there and at derekross#373's automatic path (0.3.29). The design's "Start" bullet says that off returns before any read or write. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
robertzas
pushed a commit
to robertzas/omarchy-mobile
that referenced
this pull request
Nov 14, 2026
…0: the Pixel 7 Pro's modem stack on by default (derekross#398) * omamobile-modem 0.1.16, device-cheetah 0.1.43, omamobile-shell 0.2.98: the Pixel 7 Pro's modem stack on by default The maintainer's decision of 2026-11-03: the next release ships the modem working out of the box (calls, texts and data on the tested network, M4.6 through three reboots). The switch of M4.6, omamobile-modem-boot.target, is now on by default on cheetah, and a boot that can't or shouldn't start the modem costs as little as possible: - omamobile-device-cheetah 0.1.43 enables the target with a vendor wants link under multi-user.target.wants, as it does for the AoC and Wi-Fi units; the four units the target wants get no link of their own, and omamobile-modem itself still enables nothing (its test holds it to that; tegu and raven are untouched). Off: systemctl mask the target. The stack's packages (omamobile-modem-sit, omamobile-mmd) join cheetah's ROOTFS_PACKAGES so the release image carries them. - A phone that isn't provisioned costs nothing: the modem and inhibit units carry ConditionPathExists= for the chroot, the NV checksums and the board id (what tools/phone-provision puts there), so both are skipped, not failed, and the inhibitor isn't held. The inhibitor needs its own copy because the modem unit's Requires= pulls it in even when that unit's conditions skip it. sitd skips itself without /dev/umts_ipc0; sit-data now does too, through a device drop-in: without it a condition-skipped sitd counted as started for sit-data's Requires=, and the fallback would have failed after 60 s and restarted every 10 s all boot. The start script checks the same three paths first, for a start by hand. - The modem-up guard clears itself after one refused boot: a stale marker still refuses that boot and logs where to look (journalctl -b -1), then moves to modem-up.refused-<time>-<pid> (the last three kept) so the next boot starts the modem again. A phone that hangs with the modem up every time loses the modem on every other boot at most, never for good. /etc/omamobile/modem-hold restores the old hard stop; --retry still clears both markers; the bring-up latch keeps its hard stop. - Every refusal leaves one short line in /run/omamobile/modem-refused, and the shell's Mobile data tile shows it under its name instead of "No modem" (omamobile-shell 0.2.98, tile-state.sh): no new notification path, the journal has the rest. Versions: derekross#372 and derekross#380 claim device-cheetah 0.1.42, derekross#389 omamobile-modem 0.1.14 and derekross#382 0.1.15, main has omamobile-shell 0.2.97 (derekross#394); hence 0.1.43, 0.1.16 and 0.2.98. Docs: RELEASES (ROOTFS_PACKAGES, decision 12 amended, checklist step 6), the release notes draft (the modem known issue becomes what works and what still needs a hand), INSTALL, DEVICES, and MODEM-PLAN M4.6b with the runbook: install, two reboots, a refused-boot drill by planting a stale marker, the hold flag. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * omamobile-modem 0.1.16, device-cheetah 0.1.43, omamobile-shell 0.2.100: review round 2, the modem-up guard bounded The review of derekross#398 asked for three changes and a few corrections. The self-clearing modem-up guard was unbounded: a phone that hangs because the modem is up went up, hang, refused, up, hang, refused, for ever, with only a tile line on the boots in between. Now the refused copy the script already keeps is the counter: one automatic retry, then a hold. refuse_unclean keeps the marker and refuses "(held)" when a modem-up.refused-* copy exists (no clean stop since the last refusal); --stopped on this boot's marker removes the copies, so a clean stop resets the count; --retry clears both markers and the copies. The test's "four unclean boots in a row" block becomes "the second refusal holds, a clean stop resets", and M4.6b gets drill B9b for it. systemctl is-enabled reads "disabled" for a unit started by a vendor wants link alone (it reports /etc and /run links only), so B6's pass and stop lines expected the wrong answer and would have stopped a correct install; B6 now expects "enabled" before and "disabled" after the disable, and proves the link with ls -l of the /usr/lib link and systemctl list-dependencies --plain multi-user.target. The README, the target's header and the install message say the same, so nobody reads "disabled" and skips the mask. The read-only NV checksum check (M3.5) opens B6 as well as closing the runbook (AGENTS.md section 1). B8's is-active expectation is "failed inactive inactive active" (mmd runs). omamobile-shell takes 0.2.100: main is 0.2.98 after derekross#397 and derekross#373 is taking 0.2.99. The DEVICES cheetah fingerprint cell reads "works": derekross#358 made it on by default. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * omamobile-modem 0.1.16: the start script's test stops after the marker decision The case "the boot after a refused one starts the modem again" (and the --retry case) ran lib/omamobile-modem-start past the marker refusals and relied on the machine to stop it: on the laptop and in CI no sleep inhibitor is held, so the script refused there before any driver. On the phone, where tools/phone-install-package builds the package as an unprivileged user, the inhibitor is held, so the test went on into the real bring-up and failed on /sys/module/pcie_aspm/parameters/policy (permission denied) and then on omamobile-vendor's "run as root". The script takes a test-only OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS=1 (documented in its header; no unit or install step sets it) and exits 0 right after the marker decision, before the link driver's sysfs read, the inhibitor wait, the first modprobe and the profile. The two cases use it and assert the decision itself: exit 0, the stale marker moved aside with its refused copy kept, no latch written, the earlier reason left for the tile (it is removed only once every refusal has passed, which the stop point comes before). The test also checks that the stop point sits between the marker decision and the sysfs read, the inhibitor and the latch, and that no unit sets the variable. Verified: packages/omamobile-modem/test/all as uid 1000, with and without a systemd-inhibit stand-in that reports the inhibitor held (the phone's case); tools/pr-check origin/main. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d * release notes: the carrier APNs come from the SIM, not by hand Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On 2026-11-02 (Verizon-network SIM, now #384 on main) the modem turned out to keep three things in NV: the carrier profile it applies from the AP (OEM_SET_CARRIER_CONFIG_MANIFEST 0x4600, sent after its 0x4602), its cell and band memory, and its IMS state. Loading a profile makes it ask for a reset (IND_PHONE_RESET). Our profile runs on RAM copies of the backup and drops them at stop, so the reboot that answers the reset throws the profile away again. Every boot is then a cold first boot with the backup's carrier, and IMS never gets its carrier settings, so SMS and VoLTE fail on carriers that need them. Seeding NV from a stock boot doesn't work as a fix: users must never boot stock, and NV is per phone (IMEI, calibration), so nothing can be shipped.
Since then (2026-11-03, NOTES and IMS-SHANNON §11-12): IMS registered and carried an SMS on the 7 Pro with no NV persistence at all. What it took was stock's bearer order (
ims_first = yes,internet_cid = 3,attach_apn = none, modem-sit 0.3.24+, #384), and the carrier manifest mattered for the registration order, not for the P-CSCF. So IMS no longer hinges on this overlay at each boot. What it still buys, and what the runbook's N2-N6 measure: no IND_PHONE_RESET and no reapplied profile at every boot, and the CP's cell, band and IMS memory across reboots. N3's read-onlydiffis also the first look at what the CP writes at all. MODEM-PLAN's "NV overlay" section now says so.What changes, and what doesn't
The rule: Linux never writes the modem's NV partitions. The modem's own NV writes persist only in a per-phone overlay on userdata, only for the files on its allow-list, and never for identity or calibration files. Deleting the overlay (
omamobile-modem nv-overlay reset, then a reboot) returns the modem to the backup alone.Unchanged: the
ro=1and unmounted refusal, the RAM copies read from the partitions and checked against/etc/omamobile/modem-nv.sha256, the stock salted checksum check before rfsd, the baseband-version guard, M3.5 after every run, and the rule that the chroot never sees a real block device.Granularity: whole files. rfsd keeps NV as files in the three f2fs copies:
nv_normal.binandnv_protected.bininefs,nv_protected.bakinefs_backup, each with a salted MD5 beside it. A block-level overlay of the images would carry f2fs metadata and every file at once. It could neither refuse the protected registry while keeping the normal one, nor be checked file by file.Allow-list:
efs/nv_normal.binand its.md5, kept as one group. A group is kept only if its salted MD5 matches and its size equals the base file's. Never kept:efs/nv_protected.*and all ofefs_backup(the RF calibration and the factory items), plus any identity- or calibration-like name (*imei*,*cal*,*factory*, ...). This deny list is checked even if the allow-list is edited: the tool refuses to load when the two overlap. The IMEIs aren't in these filesystems at all, because cbd reads them from/chosen/config. Writes to anything off the allow-list are logged once per boot (names only, long digit runs masked) and dropped, as before.Flow (
lib/omamobile-modem-nv-overlay,bin/omamobile-modem,profiles/modem.conf):Start (
apply, inprofile_setup): runs after the RAM copies are verified and mounted, before the stock checksum check and before any daemon. It records the base, then lays the overlay over it only if all of these hold:modem-nv.sha256(a new backup, or newmodem_afirmware, invalidates it);Files go to temporary names first, then are renamed into place. If any check fails, the overlay is moved to
modem-nv-overlay.set-aside-<time>(the newest 3 are kept) with a journal line, and the modem starts from the backup alone.Capture: runs in
profile_stopafter the CP power-off, before the namespace goes, bounded at 15 s. It also runs every 30 minutes fromomamobile-modem-nv-overlay.timer, which the modem unit pulls in (Wants=,PartOf=). Both enter the profile's mount namespace and only read there.MANIFEST.tmp, fsync, rename, fsync of the directory, then old objects removed. A lock keeps the stop's and the timer's captures apart.nv_normal.binnever empties the overlay.Reset: deletes the store (
--all: the set-aside copies too) and marks the boot so that no capture, the stop's included, recreates it.Status and diff: both read-only.
difflists what the modem changed since its start (names and sizes) and the verdict for each.Off by default in 0.1.15: nothing is laid over the copies and nothing is kept until
/etc/omamobile/modem-nv-overlay-enableexists. The runbook turns it on. A later version can turn it on by default once the runbook has passed on two boots.Found while writing it:
reboot-to(and sobin/omamobile push) stops no unit, so the stop's capture doesn't run. Before such a reboot, runomamobile-modem nv-overlay captureby hand, or usesystemctl reboot. This is now in AGENTS.md and the plan.Docs
device/cheetah/MODEM-PROVIDER-PROFILES.mdlanded on main with #384 after this PR was written; its section 6 "NV persistence" and section 7 step 1 are left as they are here (they record the decision as open), to be changed once the runbook has run:omamobile-modem0.1.15, MODEM-PLAN "NV overlay".systemctl reboot(oromamobile-modem nv-overlay capturefirst); the overlay keeps the profile."nv_normal.bin(0.1.15, when enabled)".Not determinable offline
nv_normal.binor partly inmodem_userdata. Runbook step N3 (nv-overlay diff, read-only) decides this before anything is kept. Widening the allow-list would be a separate change, needing the maintainer's approval.nv_normal.binandnv_protected.binmust change together. If the CP changes the protected one, N3 shows it and it's a stop.efslayout is the same. Expected, but unconfirmed; the overlay is off there.Runbook, first steps (MODEM-PLAN "NV overlay")
status: "enabled: no", "state: none".carrier_manifest) up as in the SIM test. Expect "Carrier manifest … sent", the 0x4601 status, and IND_PHONE_RESET.omamobile-modem nv-overlay diff. Pass:efs/nv_normal.binand its.md5changed, "kept". Stop ifnv_normal.bindidn't change, if the protected registry changed, or if profile-like files inmodem_userdatachanged.capture.status: valid, 2 files, bound to this backup, 0700/0600 root.systemctl reboot. Expect "overlay applied: 2 file(s)", the stock checksums matching, rfsd "Verified", and no clear, Expand or Create.omamobile-modem nv-overlay reset, then a reboot.Versions and collisions
omamobile-modem.servicekeeps main'sType=notify,Requires=/After=omamobile-modem-inhibit.serviceandExecStopPost, and adds the overlay'sWants=omamobile-modem-nv-overlay.timer, so the timer hangs off the real unit. The stop's capture still runs inprofile_stopafter the CP power-off (profiles/modem.confmerged clean, main's marker changes are all inlib/omamobile-modem-start).installloops over the five units; the.installnote keeps both main's boot-target line and the overlay line. AGENTS.md section 4 keeps main's longer "never restart" bullet (the modem-up marker) and this PR's NV bullet.Checks
packages/omamobile-modem/test/allpasses, including the newtest/nv-overlay. It uses synthetic NV-like files only and covers layering, protected-file refusal, corrupt, tampered, world-readable and symlinked stores falling back, a new backup invalidating the overlay, atomic writes under injected failures, missing and resized files, read-only diff, off-by-default, reset, the bound on set-aside copies, and the profile's order.tests/allandtools/pr-check origin/mainpass (re-run after the merge with main, 2026-11-03).🤖 Generated with Claude Code
https://claude.ai/code/session_01BeEcdVeSfyLCbijF8XQF1d