Merge pull request #1945 from JamieMagee/fix/raspberry-pi-firmware-cross

raspberry-pi: fix cross-compiled SD images
This commit is contained in:
Doron Behar authored and GitHub committed 2026-07-15 07:31:06 +00:00
commit fccfa9031a
1 file changed
+9 -3
+9 -3
View File
@@ -24,9 +24,11 @@ let
# install-rpi-firmware <target-dir> # install-rpi-firmware <target-dir>
# Idempotent: copies via temp file + rename, and prunes stale DTBs/overlays. # Idempotent: copies via temp file + rename, and prunes stale DTBs/overlays.
installScript = pkgs.writeShellApplication { mkInstallScript =
scriptPkgs:
scriptPkgs.writeShellApplication {
name = "install-rpi-firmware"; name = "install-rpi-firmware";
runtimeInputs = [ pkgs.coreutils ]; runtimeInputs = [ scriptPkgs.coreutils ];
text = '' text = ''
target="$1" target="$1"
shopt -s nullglob shopt -s nullglob
@@ -99,6 +101,10 @@ let
echo "rpi-firmware: done ($target)" echo "rpi-firmware: done ($target)"
''; '';
}; };
# Target tools for activation, build tools for images.
installScript = mkInstallScript pkgs;
imageInstallScript = mkInstallScript pkgs.buildPackages;
in in
{ {
options.hardware.raspberry-pi.firmware = { options.hardware.raspberry-pi.firmware = {
@@ -189,7 +195,7 @@ in
# sd-image module is imported. mkForce so we override (not merge with) # 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. # sd-image-aarch64.nix, which also sets this and would clobber config.txt.
(lib.optionalAttrs (options ? sdImage) { (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 { (lib.mkIf cfg.enable {
system.activationScripts.raspberry-pi-firmware = lib.stringAfter [ "specialfs" ] '' system.activationScripts.raspberry-pi-firmware = lib.stringAfter [ "specialfs" ] ''