raspberry-pi/common: fix firmware install when cross-compiling
This commit is contained in:
parent
8efb4337e8
commit
f185edb4e9
1 changed files with 69 additions and 63 deletions
|
|
@ -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" ] ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue