1{ pkgs, version, configTxt }:
2
3let
4 isAarch64 = pkgs.stdenv.hostPlatform.isAarch64;
5
6 uboot =
7 if version == 0 then
8 pkgs.ubootRaspberryPiZero
9 else if version == 1 then
10 pkgs.ubootRaspberryPi
11 else if version == 2 then
12 pkgs.ubootRaspberryPi2
13 else if version == 3 then
14 if isAarch64 then
15 pkgs.ubootRaspberryPi3_64bit
16 else
17 pkgs.ubootRaspberryPi3_32bit
18 else
19 throw "U-Boot is not yet supported on the raspberry pi 4.";
20
21 extlinuxConfBuilder =
22 import ../generic-extlinux-compatible/extlinux-conf-builder.nix {
23 pkgs = pkgs.buildPackages;
24 };
25in
26pkgs.substituteAll {
27 src = ./uboot-builder.sh;
28 isExecutable = true;
29 inherit (pkgs) bash;
30 path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
31 firmware = pkgs.raspberrypifw;
32 inherit uboot;
33 inherit configTxt;
34 inherit extlinuxConfBuilder;
35 inherit version;
36}
37