The Raspberry Pi SD installer remains in nixpkgs, but its
sd-image-raspberrypi.nix configuration still selects
linuxKernel.packages.linux_rpi1. Commit b1c58b82b98f ("linux-rpi*: remove")
removed that kernel from nixpkgs, leaving the installer unable to
evaluate. Move the Pi 1 image configuration to nixos-hardware alongside
the vendor kernel.
The shared vendor kernel builder accepts rpiVersion = 1, but there is no
corresponding board profile. Add an ARMv6 profile with 32-bit U-Boot and
the shared firmware installer. Use the legacy boot and initrd settings
without the graphics defaults for newer boards. Provide SD-image and
installer modules adapted from the nixpkgs image, and exclude the
profile from checks without ARMv6 coverage.
The image has been cross-compiled but has not been tested on a board, as
no Pi 1 hardware was available.
Link: https://github.com/NixOS/nixpkgs/blob/b1c58b82b98ff287751c78ee2b96dc5c4384e3b3/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix#L20
Link: https://github.com/NixOS/nixpkgs/commit/b1c58b82b98ff287751c78ee2b96dc5c4384e3b3
Signed-off-by: Cryolitia PukNgae <cryolitia@mercallure.com>
Nixpkgs enables optional kernel modules by default, including the RP1 PWM
and camera drivers and the DesignWare I2C driver. The ARM32 build fails in
modpost when these drivers reference __aeabi_uldivmod and __aeabi_ldivmod,
which are unavailable to kernel modules.
Disable the affected drivers when rpiVersion is 1. The Pi 1 uses BCM2835
peripherals and has no RP1 or DesignWare I2C controller, so these drivers
are not needed. The BCM2835 PWM and camera drivers remain enabled.
OpenWrt excludes the DesignWare I2C core on its older 32-bit Raspberry Pi
targets for the same reason.
Link: https://github.com/openwrt/openwrt/commit/11de7145c95259899d8880f4d53f933c591fbd00
Link: https://github.com/NixOS/nixpkgs/issues/464515
Signed-off-by: Cryolitia PukNgae <cryolitia@mercallure.com>
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
Adds hardware.raspberry-pi.firmware to stage the Pi's pre-Linux boot files (GPU boot code, DTBs, overlays, config.txt, optionally U-Boot) onto the firmware partition. Boards still boot via generic-extlinux-compatible; this only supplies the files it needs, through populateCmd for image builders or an opt-in activation script.
DTB/overlay copy adapted from nvmd/nixos-raspberrypi.
The Pi 3 profile didn't import ../common/default.nix, so it skipped
the shared boot.initrd.availableKernelModules (usb-storage, usbhid,
vc4). Every other board profile imports common/. Bring Pi 3 in line.
PR #1788 added hardware.raspberry-pi.configtxt and a defaults file,
but nothing imported them, so the options had no effect. Import both
from common/default.nix. Board profiles that already import common/
(2, 4, 5) now apply the pi-gen-equivalent defaults.
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before #1841.
Fixes#1859.
Override the nixpkgs common-config.nix values that conflict with the RPi
vendor defconfigs. Without these the kernel config silently differs from
the vendor defconfig.
mkForce is used only on options where nixpkgs common-config sets a
conflicting value at normal priority.
Ref: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs