Skip to content

NAND root: writeback settings and a root watchdog for Apple's raw NAND - #312

Merged
henrikklee merged 3 commits into
mainfrom
nand-root-from-264
Dec 6, 2026
Merged

henrikklee merged 3 commits into
mainfrom
nand-root-from-264

Conversation

@henrikklee

Copy link
Copy Markdown
Contributor

Brings Berkay's NAND root work from his iPhone 5 integration branch (#264) to every board with Apple's raw NAND (applesftl), with his authorship kept.

What a user notices:

  • Writes to the internal NAND go out in short bursts (writeback from 16 MiB, writers wait at 64 MiB) instead of stalling the desktop, and reads use a 512 KiB read-ahead with no I/O scheduler in front of the translation layer.
  • A device whose NAND root stops answering restarts by itself instead of hanging with a dead root: a small read-only check probes the root every 10 s and feeds a systemd watchdog.

Changed from #264: keyed on the applesftl device through the package's udev rules instead of written into the ARMv7 image, so installed devices get it too; the check ends at once when the root is elsewhere (a RAM boot), so it can't restart such a boot.

Not taken: the 128 MiB /tmp cap (Henrik turned a /tmp cap down in #214), the emergency-mode reboot (it would cut a USB serial rescue session), the global hardware watchdog and sleep target masks (they'd apply to every board, not keyed on the NAND). The N42 shutdown check waits for the kernel's SFTL checkpoint interface, which isn't on main yet. The ARMv7 input event fix is already covered by the C power daemon (#231).

Assisted-by: LLM

brkosebay and others added 3 commits December 6, 2026 12:36
The 32-bit boards' internal storage is raw NAND behind the SFTL
translation layer (applesftl). Its own queue orders the I/O, so it runs
without a scheduler, with a 512 KiB read-ahead, and with small dirty-page
limits (16 MiB background, 64 MiB hard) so writeback comes in bursts the
NAND absorbs instead of stalls of the desktop.

[Orchard: from #264 (257c376, configure-nand-root); keyed on the applesftl
device in the package's udev rules instead of written into the ARMv7 image,
so every board with that storage gets it, installed ones too; the dirty
limits set by the same rule]

Assisted-by: LLM
With the root on Apple's raw NAND, a wedged NAND controller leaves PID 1
running in RAM while every program that needs the root hangs: the device
looks alive and does nothing. omarchy-nand-rootcheck reads one random
4 KiB block of the root past the page cache every 10 s and feeds the
service's watchdog only when the read succeeds; a hung read misses the
60 s watchdog, an I/O error fails the service at once, and either way
FailureAction=reboot-force restarts the device. It only reads, so the
NAND sees no extra page programs.

[Orchard: from #264 (2ada1dd, n42-rootcheck); renamed for every board
with that storage and started by udev when an applesftl disk appears
instead of enabled in the ARMv7 image; it ends successfully when the root
is not on the NAND (a RAM boot), so it can never restart such a boot. Not
taken: the emergency-mode reboot (it would cut a USB serial rescue
session), the global hardware watchdog and the sleep target masks (for
every board, not keyed on the NAND)]

Assisted-by: LLM
@henrikklee
henrikklee merged commit a686363 into main Dec 6, 2026
11 checks passed
@henrikklee
henrikklee deleted the nand-root-from-264 branch December 6, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants