git.iko.soy/typeable/nixpkgs
on master help sign in
raspberrypi-bootloader: support Raspberry Pi 3 w/o U-Boot and explicitly support

Raspberry Pi Zero

commit1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e authorBen Wolsieffer <benwolsieffer@gmail.com> dateMon 10 Sep 2018, 23:21 (8 years ago) parentbcb9e17
5 files changed+18−19
nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix+2−2 nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh+2−6 nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix+7−5 nixos/modules/system/boot/loader/raspberrypi/builder_uboot.nix → nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix+7−6 nixos/modules/system/boot/loader/raspberrypi/builder_uboot.sh → nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh
nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix+2−2
@@ -1,4 +1,4 @@
1−{ pkgs, version, configTxt }:
1+{ pkgs, configTxt }:
22
33pkgs.substituteAll {
44 src = ./raspberrypi-builder.sh;
@@ -6,5 +6,5 @@ pkgs.substituteAll {
66 inherit (pkgs) bash;
77 path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
88 firmware = pkgs.raspberrypifw;
9− inherit version configTxt;
9+ inherit configTxt;
1010}
nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh+2−6
@@ -85,13 +85,9 @@ addEntry() {
8585 echo $kernel > $outdir/$generation-kernel
8686
8787 if test "$generation" = "default"; then
88− if [ @version@ -eq 1 ]; then
89− copyForced $kernel $target/kernel.img
90− else
91− copyForced $kernel $target/kernel7.img
92− fi
88+ copyForced $kernel $target/kernel.img
9389 copyForced $initrd $target/initrd
94− for dtb in $dtb_path/bcm*.dtb; do
90+ for dtb in $dtb_path/{broadcom,}/bcm*.dtb; do
9591 dst="$target/$(basename $dtb)"
9692 copyForced $dtb "$dst"
9793 filesCopied[$dst]=1
nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix+7−5
@@ -7,8 +7,8 @@ let
77
88 inherit (pkgs.stdenv.hostPlatform) platform;
99
10− builderUboot = import ./builder_uboot.nix { inherit config pkgs configTxt; };
11− builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; inherit (cfg) version; };
10+ builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; };
11+ builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; };
1212
1313 builder =
1414 if cfg.uboot.enable then
@@ -34,9 +34,11 @@ let
3434 '' + optional isAarch64 ''
3535 # Boot in 64-bit mode.
3636 arm_control=0x200
37− '' + optional cfg.uboot.enable ''
37+ '' + (if cfg.uboot.enable then ''
3838 kernel=u-boot-rpi.bin
39− '' + optional (cfg.firmwareConfig != null) cfg.firmwareConfig);
39+ '' else ''
40+ kernel=kernel.img
41+ '') + optional (cfg.firmwareConfig != null) cfg.firmwareConfig);
4042
4143in
4244
@@ -56,7 +58,7 @@ in
5658
5759 version = mkOption {
5860 default = 2;
59− type = types.enum [ 1 2 3 ];
61+ type = types.enum [ 0 1 2 3 ];
6062 description = ''
6163 '';
6264 };
nixos/modules/system/boot/loader/raspberrypi/builder_uboot.nix → nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nixrenamed+7−6
@@ -1,13 +1,14 @@
1−{ config, pkgs, configTxt }:
1+{ pkgs, version, configTxt }:
22
33let
4− cfg = config.boot.loader.raspberryPi;
54 isAarch64 = pkgs.stdenv.isAarch64;
65
76 uboot =
8− if cfg.version == 1 then
7+ if version == 0 then
8+ pkgs.ubootRaspberryPiZero
9+ else if version == 1 then
910 pkgs.ubootRaspberryPi
10− else if cfg.version == 2 then
11+ else if version == 2 then
1112 pkgs.ubootRaspberryPi2
1213 else
1314 if isAarch64 then
@@ -21,7 +22,7 @@ let
2122 };
2223in
2324pkgs.substituteAll {
24− src = ./builder_uboot.sh;
25+ src = ./uboot-builder.sh;
2526 isExecutable = true;
2627 inherit (pkgs) bash;
2728 path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
@@ -29,6 +30,6 @@ pkgs.substituteAll {
2930 inherit uboot;
3031 inherit configTxt;
3132 inherit extlinuxConfBuilder;
32− version = cfg.version;
33+ inherit version;
3334}
3435
nixos/modules/system/boot/loader/raspberrypi/builder_uboot.sh → nixos/modules/system/boot/loader/raspberrypi/uboot-builder.shrenamed

The content is the same.