summary refs log tree commit diff
path: root/nixos/modules/system/boot/loader/raspberrypi
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2018-09-10 23:21:41 -0400
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2018-10-21 17:44:11 +0300
commit1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e (patch)
tree6ff966905b2bee81d5762f92c56b706ce3cdd0bb /nixos/modules/system/boot/loader/raspberrypi
parentbcb9e17bba8857fa5cd63c74ead67e6029e50437 (diff)
downloadnixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.tar
nixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.tar.gz
nixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.tar.bz2
nixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.tar.lz
nixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.tar.xz
nixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.tar.zst
nixlib-1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e.zip
raspberrypi-bootloader: support Raspberry Pi 3 w/o U-Boot and explicitly support
Raspberry Pi Zero
Diffstat (limited to 'nixos/modules/system/boot/loader/raspberrypi')
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix4
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh8
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix12
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix (renamed from nixos/modules/system/boot/loader/raspberrypi/builder_uboot.nix)13
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh (renamed from nixos/modules/system/boot/loader/raspberrypi/builder_uboot.sh)0
5 files changed, 18 insertions, 19 deletions
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix
index 27fea4e623e9..7eb52e3d021f 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix
@@ -1,4 +1,4 @@
-{ pkgs, version, configTxt }:
+{ pkgs, configTxt }:
 
 pkgs.substituteAll {
   src = ./raspberrypi-builder.sh;
@@ -6,5 +6,5 @@ pkgs.substituteAll {
   inherit (pkgs) bash;
   path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
   firmware = pkgs.raspberrypifw;
-  inherit version configTxt;
+  inherit configTxt;
 }
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh
index 68be4e28cd0c..0fb07de10c04 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh
@@ -85,13 +85,9 @@ addEntry() {
     echo $kernel > $outdir/$generation-kernel
 
     if test "$generation" = "default"; then
-      if [ @version@ -eq 1 ]; then
-        copyForced $kernel $target/kernel.img
-      else
-        copyForced $kernel $target/kernel7.img
-      fi
+      copyForced $kernel $target/kernel.img
       copyForced $initrd $target/initrd
-      for dtb in $dtb_path/bcm*.dtb; do
+      for dtb in $dtb_path/{broadcom,}/bcm*.dtb; do
         dst="$target/$(basename $dtb)"
         copyForced $dtb "$dst"
         filesCopied[$dst]=1
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
index bef66bfd41a6..17c09d7c4f60 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
@@ -7,8 +7,8 @@ let
 
   inherit (pkgs.stdenv.hostPlatform) platform;
 
-  builderUboot = import ./builder_uboot.nix { inherit config pkgs configTxt; };
-  builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; inherit (cfg) version; };
+  builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; };
+  builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; };
 
   builder = 
     if cfg.uboot.enable then
@@ -34,9 +34,11 @@ let
     '' + optional isAarch64 ''
       # Boot in 64-bit mode.
       arm_control=0x200
-    '' + optional cfg.uboot.enable ''
+    '' + (if cfg.uboot.enable then ''
       kernel=u-boot-rpi.bin
-    '' + optional (cfg.firmwareConfig != null) cfg.firmwareConfig);
+    '' else ''
+      kernel=kernel.img
+    '') + optional (cfg.firmwareConfig != null) cfg.firmwareConfig);
 
 in
 
@@ -56,7 +58,7 @@ in
 
       version = mkOption {
         default = 2;
-        type = types.enum [ 1 2 3 ];
+        type = types.enum [ 0 1 2 3 ];
         description = ''
         '';
       };
diff --git a/nixos/modules/system/boot/loader/raspberrypi/builder_uboot.nix b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix
index 47f25a9c2b1b..e929c33c6ee3 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/builder_uboot.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix
@@ -1,13 +1,14 @@
-{ config, pkgs, configTxt }:
+{ pkgs, version, configTxt }:
 
 let
-  cfg = config.boot.loader.raspberryPi;
   isAarch64 = pkgs.stdenv.isAarch64;
 
   uboot =
-    if cfg.version == 1 then
+    if version == 0 then
+      pkgs.ubootRaspberryPiZero
+    else if version == 1 then
       pkgs.ubootRaspberryPi
-    else if cfg.version == 2 then
+    else if version == 2 then
       pkgs.ubootRaspberryPi2
     else
       if isAarch64 then
@@ -21,7 +22,7 @@ let
     };
 in
 pkgs.substituteAll {
-  src = ./builder_uboot.sh;
+  src = ./uboot-builder.sh;
   isExecutable = true;
   inherit (pkgs) bash;
   path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
@@ -29,6 +30,6 @@ pkgs.substituteAll {
   inherit uboot;
   inherit configTxt;
   inherit extlinuxConfBuilder;
-  version = cfg.version;
+  inherit version;
 }
 
diff --git a/nixos/modules/system/boot/loader/raspberrypi/builder_uboot.sh b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh
index 36bf15066274..36bf15066274 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/builder_uboot.sh
+++ b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh