Merge pull request #1945 from JamieMagee/fix/raspberry-pi-firmware-cross
Some checks are pending
Test / nixfmt (push) Waiting to run
Test / tests (push) Blocked by required conditions

raspberry-pi: fix cross-compiled SD images
This commit is contained in:
Doron Behar 2026-07-15 07:31:06 +00:00 committed by GitHub
commit fccfa9031a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,9 +24,11 @@ let
# install-rpi-firmware <target-dir>
# Idempotent: copies via temp file + rename, and prunes stale DTBs/overlays.
installScript = pkgs.writeShellApplication {
mkInstallScript =
scriptPkgs:
scriptPkgs.writeShellApplication {
name = "install-rpi-firmware";
runtimeInputs = [ pkgs.coreutils ];
runtimeInputs = [ scriptPkgs.coreutils ];
text = ''
target="$1"
shopt -s nullglob
@ -99,6 +101,10 @@ let
echo "rpi-firmware: done ($target)"
'';
};
# Target tools for activation, build tools for images.
installScript = mkInstallScript pkgs;
imageInstallScript = mkInstallScript pkgs.buildPackages;
in
{
options.hardware.raspberry-pi.firmware = {
@ -189,7 +195,7 @@ in
# sd-image module is imported. mkForce so we override (not merge with)
# sd-image-aarch64.nix, which also sets this and would clobber config.txt.
(lib.optionalAttrs (options ? sdImage) {
sdImage.populateFirmwareCommands = lib.mkForce "${lib.getExe installScript} ./firmware\n";
sdImage.populateFirmwareCommands = lib.mkForce "${lib.getExe imageInstallScript} ./firmware\n";
})
(lib.mkIf cfg.enable {
system.activationScripts.raspberry-pi-firmware = lib.stringAfter [ "specialfs" ] ''