Merge pull request #1945 from JamieMagee/fix/raspberry-pi-firmware-cross
raspberry-pi: fix cross-compiled SD images
This commit is contained in:
commit
fccfa9031a
1 changed files with 69 additions and 63 deletions
|
|
@ -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" ] ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue