summary refs log tree commit diff
path: root/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@viric.name>2015-05-09 17:05:24 +0000
committerLluís Batlle i Rossell <viric@viric.name>2015-05-09 17:05:24 +0000
commitd8a2bb86c0e52bd5c41b2404ed3bbc7f80768842 (patch)
treed0ec4a44e0291f27d2045b95c18b4a42ce5908a3 /nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
parent916b95b82989ee86dad62cb4a310ff82e784b404 (diff)
downloadnixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.tar
nixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.tar.gz
nixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.tar.bz2
nixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.tar.lz
nixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.tar.xz
nixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.tar.zst
nixpkgs-d8a2bb86c0e52bd5c41b2404ed3bbc7f80768842.zip
Raspberry Pi 2 changes to make it boot.
It boots, but some things still don't work:
1) Installation of DTBs
2) Boot of initrd

Booting still needs a proper config.txt in /boot, which could probably be
managed by NixOS.
Diffstat (limited to 'nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix')
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
index 1ea3ddd8867..b7400e333e2 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
@@ -3,6 +3,7 @@
 with lib;
 
 let
+  cfg = config.boot.loader.raspberryPi;
 
   builder = pkgs.substituteAll {
     src = ./builder.sh;
@@ -10,6 +11,7 @@ let
     inherit (pkgs) bash;
     path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
     firmware = pkgs.raspberrypifw;
+    version = cfg.version;
   };
 
   platform = pkgs.stdenv.platform;
@@ -29,11 +31,23 @@ in
       '';
     };
 
+    boot.loader.raspberryPi.version = mkOption {
+      default = 2;
+      type = types.int;
+      description = ''
+      '';
+    };
+
   };
 
   config = mkIf config.boot.loader.raspberryPi.enable {
     system.build.installBootLoader = builder;
     system.boot.loader.id = "raspberrypi";
     system.boot.loader.kernelFile = platform.kernelTarget;
+    assertions = [
+      { assertion = (cfg.version == 1 || cfg.version == 2);
+        message = "loader.raspberryPi.version should be 1 or 2";
+      }
+    ];
   };
 }