Repository navigation
initramfs: load packed modules once, only where needed - #195
Conversation
BusyBox can fall back from finit_module to init_module after an error. A hardware probe may already have changed device state before failing, so a second initialization defeats a staged bring-up experiment. Build module-load-once with both initramfs toolchains and put it on Dropbear's command path. It accepts an uncompressed module and optional parameters, makes one finit_module call, and preserves the loading error. Open nonblocking so a FIFO reaches the regular-file check without hanging. The intercepted-syscall tests and tests/all pass. Both ARM64 initramfs builds pass. QEMU confirms one attempt on ENOSYS; the same Alpine BusyBox falls back to init_module. Pixel 6 usage, invalid-file and unprivileged error paths pass, with exact cleanup and phone-smoke. No valid module was loaded and the new initramfs images were not booted. Assisted-by: Codex <noreply@openai.com>
|
Thanks, the retry hazard is real and the tests are carefully made. As it stands, though, the tool has no caller but ships in every phone's boot image, the 7 Pro's included. The place where busybox would retry is |
The helper previously had no caller but shipped in every boot image. Build it only when INITRAMFS_MODULES requests modules and call it from load_modules, preserving the board gate, ordered loading and failure reporting without a BusyBox retry. Drop the general diagnostic mandate. Exercise the real shell caller with success, failure, missing-helper, wrong-board and absent-list cases. Both compiler paths build static ARM64 helpers with module fixtures; cheetah and oriole images omit it. No revised initramfs has been booted on a phone. Assisted-by: OpenAI GPT-6 Astra
|
Thanks, this is the shape I hoped for, and the tests are good. It changes raven's boot only, so I'll ask the raven owner for one boot before merging: the six modules loaded, no loader errors, and phone-smoke. |
|
Thanks, this is the shape now: gated on INITRAMFS_MODULES and called from |
Keep the loader error in the boot log so failed module initialization can be diagnosed without retrying it.
|
Thanks, @Gr-linkk. The error now reaches the boot log, and the test checks the message, so the first real failure will be diagnosable. That's all I wanted on the code side. The one thing left is the raven boot: three packed modules loaded, no "failed" line, and a phone-smoke report. I'll ask the raven owner for it, and merge with a hand-written message once it's in. |
|
@robotosaith, could you give this one boot on your Pixel 6 Pro when you have a moment? It's the last thing #195 needs: an initramfs built from this branch ( |
|
Ran this on raven today: the initramfs from 781687c (
phone-smoke: ravenKernel
Packages: hyprland 0.57.0-3.1, libcamera 0.7.2-4.22, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamessages 0.2.1-1, omamobile-apps 0.2.2-1, omamobile-audio 0.5.15-1, omamobile-device-raven 0.1.35-1, omamobile-firstboot 0.1.3-1, omamobile-gnss 0.2.7-1, omamobile-keyring 20261026-1, omamobile-mirror 0.1.1-1, omamobile-mmd 0.1.4-1, omamobile-modem 0.1.17-1, omamobile-modem-sit 0.3.36-1, omamobile-omarchy 0.1.31-1, omamobile-owl-widgets 0.1.2-1, omamobile-sensors 0.2.1-1, omamobile-shell 0.2.94-1, omamobile-voice 0.1.0-1, omaphone 0.2.2-1, omarchy 4.0.6-1, omatel-agent 0.2.4-2, quickshell 0.3.2.r7.g2b4501a-1 |
|
Thank you, @robotosaith: that's exactly the boot this needed, and swapping only the ramdisk into the running @Gr-linkk, thanks for your patience and for the careful tests. I'm merging this with a hand-written message. One thing changed while this waited: the OnePlus 6 descriptor landed on 11-07, and it also packs modules into the shared initramfs (its USB gadget: |
|
Checked on the OnePlus 6. I did a
|
…od retry (derekross#195) busybox insmod retries through init_module after a failed finit_module, and by then a module may already have touched hardware. The initramfs now loads each packed module with one finit_module call from a small helper, with no fallback, and the error reaches the boot log. The helper is built and packed only where a descriptor sets INITRAMFS_MODULES (the Pixel 6 Pro and the OnePlus 6); nothing is packed and nothing changes for the other phones. Tested on a Pixel 6 Pro on 2026-11-10 with this head: six modules live, no failure line. Not yet booted on a OnePlus 6.
What and why
BusyBox insmod can retry initialization through init_module after finit_module fails. An initramfs module may already have touched hardware before returning an error.
The shared init's existing load_modules path now calls module-load-once once per packed module, preserving the board check, packed order, and failure reporting. The helper is built and included only when the device descriptor sets INITRAMFS_MODULES. Raven is the current caller; cheetah and oriole images do not acquire an unused helper. There is no fallback to insmod if the helper fails or is missing.
The helper preserves syscall errors and parameters and rejects empty/non-regular files without blocking on FIFOs. The previous general AGENTS rule and command-shell symlink are removed.
Review follow-up (2026-10-31)
This follows the requested INITRAMFS_MODULES integration. Current upstream main was merged without rewriting the submitted history. No packages, kernel configuration, storage policy, or automatic module list changed.
Checks
Hardware evidence and remaining check
The earlier Pixel 6 test used temporary files as UID 1000 on kernel
7.3.0-rc6-oriole-hsi1-late-dev0-g4bd35d34abb9-dirty. Its invalid fixture returned EPERM. That was unprivileged error-path coverage only; it did not exercise module initialization.The revised initramfs has not been booted on Raven or another phone. Raven's existing module list is exynos-mailbox, acpm-protocol, sec-acpm, max77759, nvmem-max77759 and nvmem-reboot-mode. An affected-device boot should confirm those modules loaded, no module-load-once failure messages, and the normal phone-smoke result using the device's established guarded boot/rollback procedure. No Raven device is available in this setup. No phone operation was performed for this revision.