Files
nixos-hardware/raspberry-pi/common
eymeric 34fef44f65 raspberry-pi/firmware: stage vendor overlays independent of dtbSrc
install-rpi-firmware picks a single $dtbSrc for both the base .dtb
files and the overlays/ directory staged onto the firmware partition.
When useGenerationDeviceTree = true, $dtbSrc becomes
/run/current-system/dtbs, the NixOS generation's device-tree output.
That directory never has an overlays/ subdirectory unless the
generation was itself built with hardware.deviceTree.overlays, so the
"stage overlays from $dtbSrc/overlays" step silently does nothing, and
the stale-file prune then deletes any vendor .dtbo already sitting in
the firmware partition's overlays/ from a previous run.

In practice this makes
hardware.raspberry-pi.configtxt.deviceTreeOverlays
non-functional whenever useGenerationDeviceTree = true is also set - a
combination that legitimately occurs, e.g. a Pi 4 profile needing
apply-overlays-dtmerge/tc358743 (which requires the generation's
dtmerge-produced dtb as the base, since
boot.loader.generic-extlinux-compatible.useGenerationDeviceTree is
usually false with U-Boot enabled) together with a stock overlay like
dwc2 applied by the firmware from config.txt.

Stage vendor overlays from $firmwareBoot/overlays unconditionally,
since hardware.raspberry-pi.configtxt.deviceTreeOverlays entries are
matched against that vendor filename set regardless of where the base
dtb comes from. Additionally stage $dtbSrc/overlays when it differs
from $firmwareBoot and exists, so overlays produced by
hardware.deviceTree.overlays on the generation side still take
precedence over same-named vendor ones.

Related: #1946

Assisted-by: Claude sonnet 5 high
2026-09-27 11:00:58 +02:00
..