Skip to content

Early-load thunderbolt only where the kernel builds the module - #551

Merged
maralcbr merged 2 commits into
quattro-upstreamfrom
mac/fix-thunderbolt-optional
Sep 25, 2026
Merged

maralcbr merged 2 commits into
quattro-upstreamfrom
mac/fix-thunderbolt-optional

Conversation

@maralcbr

Copy link
Copy Markdown
Member

#542 made the Thunderbolt drop-in optional (MODULES+=(thunderbolt?)) so aarch64 kernels without the module still build. In mkinitcpio 42 that only works for busybox images:

  • add_module accepts name? as optional, and the busybox /config strips the suffix and lists only modules the image got (functions parse_config).
  • The systemd hook writes MODULES into the initramfs's /etc/modules-load.d/MODULES.conf as written (install/systemd). On a systemd initramfs (Apple Silicon's baseline) that line is thunderbolt?, and systemd-modules-load logs Failed to find module 'thunderbolt?' and loads nothing. A kernel without the module still gets the line.

thunderbolt_module.conf now adds plain thunderbolt only when modinfo finds it as a module of the kernel being built, as omarchy-mac-boot's HID drop-in does. x86 kernels build it as a module, so x86 gets MODULES+=(thunderbolt) again, as before #542.

Testing

  • mkinitcpio-hooks-test.sh: the fixtures get a modinfo stand-in, the x86 cases expect thunderbolt again, and new cases cover Apple Silicon (module present), a generic aarch64 kernel without it, a built-in thunderbolt, and a systemd line without it. The old line fails the x86 cases.
  • Real mkinitcpio 42 images in an Arch Linux ARM container, old line against new:
    • busybox baseline, kernel with the module: identical images (/config MODULES="thunderbolt" both times)
    • busybox baseline, kernel without it: identical images
    • Apple systemd baseline, kernel with it: only MODULES.conf changes, thunderbolt? → thunderbolt
    • Apple systemd baseline, kernel without it: only MODULES.conf changes, thunderbolt? → empty
  • The x86 host (omarchy-gpu, kernel 7.2.5-3-omarchy), read-only: modinfo finds thunderbolt.ko.zst, and the new drop-in yields thunderbolt, the same as its installed pre-Runtime settings profile and platform package lists #542 file.
  • Runtime suite (test/all, non-root, Arch Linux ARM container): only the failures the base also has in that container (config-test, hermes-remove, hw-hybrid-gpu, legacy-power-udev-rules-migration, platform-packages, snapper, unowned-system-paths, and the flaky system-sleep-ownership-migration).

Second review: no real problems. It confirmed the exit status, KERNELVERSION resolution for presets and -k, modinfo on mkinitcpio's PATH, and that the tests catch mutations. One wording fix applied. Noted, not changed: like the HID drop-in, the check ignores mkinitcpio -r (module root), which nothing here uses.

mkinitcpio's systemd hook copies MODULES as written into the initramfs's
modules-load.d, so thunderbolt? reached systemd-modules-load, which cannot
find a module by that name, and a kernel without the module listed it too.
thunderbolt_module.conf now adds plain thunderbolt only when modinfo finds it
as a module. Busybox images are unchanged: their /config already dropped the
suffix and any module the image lacks.
@maralcbr
maralcbr merged commit 99ace40 into quattro-upstream Sep 25, 2026
5 checks passed
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.

1 participant