2018-09-10 20:21:41 -07:00
|
|
|
{ pkgs, version, configTxt }:
|
2018-04-01 15:28:50 -07:00
|
|
|
|
|
|
|
let
|
2018-12-28 11:55:55 -08:00
|
|
|
isAarch64 = pkgs.stdenv.hostPlatform.isAarch64;
|
2018-04-01 15:28:50 -07:00
|
|
|
|
|
|
|
uboot =
|
2018-09-10 20:21:41 -07:00
|
|
|
if version == 0 then
|
|
|
|
pkgs.ubootRaspberryPiZero
|
|
|
|
else if version == 1 then
|
2018-04-01 15:28:50 -07:00
|
|
|
pkgs.ubootRaspberryPi
|
2018-09-10 20:21:41 -07:00
|
|
|
else if version == 2 then
|
2018-04-01 15:28:50 -07:00
|
|
|
pkgs.ubootRaspberryPi2
|
2019-08-17 09:42:22 -07:00
|
|
|
else if version == 3 then
|
2018-04-01 15:28:50 -07:00
|
|
|
if isAarch64 then
|
|
|
|
pkgs.ubootRaspberryPi3_64bit
|
|
|
|
else
|
2019-08-17 09:42:22 -07:00
|
|
|
pkgs.ubootRaspberryPi3_32bit
|
|
|
|
else
|
|
|
|
throw "U-Boot is not yet supported on the raspberry pi 4.";
|
2018-04-01 15:28:50 -07:00
|
|
|
|
|
|
|
extlinuxConfBuilder =
|
|
|
|
import ../generic-extlinux-compatible/extlinux-conf-builder.nix {
|
2019-05-31 12:51:29 -07:00
|
|
|
inherit pkgs;
|
2018-04-01 15:28:50 -07:00
|
|
|
};
|
|
|
|
in
|
|
|
|
pkgs.substituteAll {
|
2018-09-10 20:21:41 -07:00
|
|
|
src = ./uboot-builder.sh;
|
2018-04-01 15:28:50 -07:00
|
|
|
isExecutable = true;
|
2019-05-31 12:51:29 -07:00
|
|
|
inherit (pkgs) bash;
|
|
|
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
|
2018-04-01 15:28:50 -07:00
|
|
|
firmware = pkgs.raspberrypifw;
|
|
|
|
inherit uboot;
|
|
|
|
inherit configTxt;
|
|
|
|
inherit extlinuxConfBuilder;
|
2018-09-10 20:21:41 -07:00
|
|
|
inherit version;
|
2018-04-01 15:28:50 -07:00
|
|
|
}
|
2019-05-31 12:51:29 -07:00
|
|
|
|