Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Commit 9b56cda

Browse files
committed
uboot: add package option
1 parent a993f0c commit 9b56cda

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

rpi/default.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ in
6868
cm4 with an nvme drive.
6969
'';
7070
};
71+
72+
package = mkPackageOption pkgs "uboot-rpi-arm64" {};
7173
};
7274
};
7375
};
@@ -99,6 +101,7 @@ in
99101
TARGET_FIRMWARE_DIR="${firmware-path}"
100102
TARGET_OVERLAYS_DIR="$TARGET_FIRMWARE_DIR/overlays"
101103
TMPFILE="$TARGET_FIRMWARE_DIR/tmp"
104+
UBOOT="${cfg.uboot.package}/u-boot.bin"
102105
KERNEL="${kernel}/Image"
103106
SHOULD_UBOOT=${if cfg.uboot.enable then "1" else "0"}
104107
SRC_FIRMWARE_DIR="${pkgs.raspberrypifw}/share/raspberrypi/boot"
@@ -118,7 +121,7 @@ in
118121
touch "$STATE_DIRECTORY/uboot-migration-in-progress"
119122
cp "$UBOOT" "$TMPFILE"
120123
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/u-boot-rpi-arm64.bin"
121-
echo "${builtins.toString pkgs.uboot-rpi-arm64}" " > "$STATE_DIRECTORY/uboot-version"
124+
echo "${builtins.toString cfg.uboot.package}" " > "$STATE_DIRECTORY/uboot-version"
122125
rm "$STATE_DIRECTORY/uboot-migration-in-progress"
123126
}
124127
''}
@@ -180,7 +183,7 @@ in
180183
181184
${lib.strings.optionalString cfg.uboot.enable ''
182185
if [[ "$SHOULD_UBOOT" -eq 1 ]] && [[ -f "$STATE_DIRECTORY/uboot-migration-in-progress" || ! -f "$STATE_DIRECTORY/uboot-version" || $(< "$STATE_DIRECTORY/uboot-version") != ${
183-
builtins.toString pkgs.uboot-rpi-arm64
186+
builtins.toString cfg.uboot.package
184187
} ]]; then
185188
migrate_uboot
186189
fi

sd-image/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
populate-kernel =
2727
if cfg.uboot.enable
2828
then ''
29-
cp ${pkgs.uboot-rpi-arm64}/u-boot.bin firmware/u-boot-rpi-arm64.bin
29+
cp ${cfg.uboot.package}/u-boot.bin firmware/u-boot-rpi-arm64.bin
3030
''
3131
else ''
3232
cp "${kernel}/Image" firmware/kernel.img

0 commit comments

Comments
 (0)