summary refs log tree commit diff
path: root/nixos/modules/system/boot
diff options
context:
space:
mode:
authorRicardo M. Correia <rcorreia@wizy.org>2017-01-17 11:19:39 +0000
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2017-02-12 02:48:57 +0200
commitc19b17d14ff25a86bc4b563999bfa3569344d16a (patch)
tree79bb7e0769362503a22cf7287fccc907448f1077 /nixos/modules/system/boot
parent0045f932bba018345cbb2f03bb5d4d17d01850b1 (diff)
downloadnixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.tar
nixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.tar.gz
nixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.tar.bz2
nixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.tar.lz
nixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.tar.xz
nixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.tar.zst
nixlib-c19b17d14ff25a86bc4b563999bfa3569344d16a.zip
raspberryPi boot loader: fix booting Raspberry Pi 3
The Raspberry Pi 3 seems to need the .DTB file when booting the kernel,
so we must copy it to /boot when installing a new kernel.
Diffstat (limited to 'nixos/modules/system/boot')
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/builder.sh12
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix2
2 files changed, 10 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/loader/raspberrypi/builder.sh b/nixos/modules/system/boot/loader/raspberrypi/builder.sh
index ccb88ca1c529..1a02bf231709 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/builder.sh
+++ b/nixos/modules/system/boot/loader/raspberrypi/builder.sh
@@ -61,12 +61,13 @@ addEntry() {
 
     local kernel=$(readlink -f $path/kernel)
     local initrd=$(readlink -f $path/initrd)
+    local dtb_path=$(readlink -f $path/kernel-modules/dtbs)
 
     if test -n "@copyKernels@"; then
         copyToKernelsDir $kernel; kernel=$result
         copyToKernelsDir $initrd; initrd=$result
     fi
-    
+
     echo $(readlink -f $path) > $outdir/$generation-system
     echo $(readlink -f $path/init) > $outdir/$generation-init
     cp $path/kernel-params $outdir/$generation-cmdline.txt
@@ -80,6 +81,11 @@ addEntry() {
         copyForced $kernel /boot/kernel7.img
       fi
       copyForced $initrd /boot/initrd
+      for dtb in $dtb_path/bcm*.dtb; do
+        dst="/boot/$(basename $dtb)"
+        copyForced $dtb "$dst"
+        filesCopied[$dst]=1
+      done
       cp "$(readlink -f "$path/init")" /boot/nixos-init
       echo "`cat $path/kernel-params` init=$path/init" >/boot/cmdline.txt
 
@@ -108,8 +114,8 @@ copyForced $fwdir/start_cd.elf  /boot/start_cd.elf
 copyForced $fwdir/start_db.elf  /boot/start_db.elf
 copyForced $fwdir/start_x.elf   /boot/start_x.elf
 
-# Remove obsolete files from /boot/old.
-for fn in /boot/old/*linux* /boot/old/*initrd*; do
+# Remove obsolete files from /boot and /boot/old.
+for fn in /boot/old/*linux* /boot/old/*initrd* /boot/bcm*.dtb; do
     if ! test "${filesCopied[$fn]}" = 1; then
         rm -vf -- "$fn"
     fi
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
index eb8ea6130972..f246d04284ca 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
@@ -33,7 +33,7 @@ in
 
     boot.loader.raspberryPi.version = mkOption {
       default = 2;
-      type = types.enum [ 1 2 ];
+      type = types.enum [ 1 2 3 ];
       description = ''
       '';
     };