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.

Changed files
+10 -4
nixos
modules
system
boot
loader
+9 -3
nixos/modules/system/boot/loader/raspberrypi/builder.sh
···
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
···
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
···
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
+1 -1
nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
···
boot.loader.raspberryPi.version = mkOption {
default = 2;
-
type = types.enum [ 1 2 ];
+
type = types.enum [ 1 2 3 ];
description = ''
'';
};