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.
This commit is contained in:
Ricardo M. Correia 2017-01-17 11:19:39 +00:00 committed by Tuomas Tynkkynen
parent 0045f932bb
commit c19b17d14f
2 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -33,7 +33,7 @@ in
boot.loader.raspberryPi.version = mkOption {
default = 2;
type = types.enum [ 1 2 ];
type = types.enum [ 1 2 3 ];
description = ''
'';
};