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.
This commit is contained in:
Lluís Batlle i Rossell 2015-05-09 17:05:24 +00:00
parent 916b95b829
commit d8a2bb86c0
3 changed files with 28 additions and 7 deletions

View File

@ -60,22 +60,26 @@ addEntry() {
fi fi
local kernel=$(readlink -f $path/kernel) local kernel=$(readlink -f $path/kernel)
# local initrd=$(readlink -f $path/initrd) local initrd=$(readlink -f $path/initrd)
if test -n "@copyKernels@"; then if test -n "@copyKernels@"; then
copyToKernelsDir $kernel; kernel=$result copyToKernelsDir $kernel; kernel=$result
# copyToKernelsDir $initrd; initrd=$result copyToKernelsDir $initrd; initrd=$result
fi fi
echo $(readlink -f $path) > $outdir/$generation-system echo $(readlink -f $path) > $outdir/$generation-system
echo $(readlink -f $path/init) > $outdir/$generation-init echo $(readlink -f $path/init) > $outdir/$generation-init
cp $path/kernel-params $outdir/$generation-cmdline.txt cp $path/kernel-params $outdir/$generation-cmdline.txt
# echo $initrd > $outdir/$generation-initrd echo $initrd > $outdir/$generation-initrd
echo $kernel > $outdir/$generation-kernel echo $kernel > $outdir/$generation-kernel
if test $(readlink -f "$path") = "$default"; then if test $(readlink -f "$path") = "$default"; then
copyForced $kernel /boot/kernel.img if [ @version@ -eq 1 ]; then
# copyForced $initrd /boot/initrd copyForced $kernel /boot/kernel.img
else
copyForced $kernel /boot/kernel7.img
fi
copyForced $initrd /boot/initrd
cp "$(readlink -f "$path/init")" /boot/nixos-init cp "$(readlink -f "$path/init")" /boot/nixos-init
echo "`cat $path/kernel-params` init=$path/init" >/boot/cmdline.txt echo "`cat $path/kernel-params` init=$path/init" >/boot/cmdline.txt
@ -98,8 +102,11 @@ fwdir=@firmware@/share/raspberrypi/boot/
copyForced $fwdir/bootcode.bin /boot/bootcode.bin copyForced $fwdir/bootcode.bin /boot/bootcode.bin
copyForced $fwdir/fixup.dat /boot/fixup.dat copyForced $fwdir/fixup.dat /boot/fixup.dat
copyForced $fwdir/fixup_cd.dat /boot/fixup_cd.dat copyForced $fwdir/fixup_cd.dat /boot/fixup_cd.dat
copyForced $fwdir/fixup_db.dat /boot/fixup_db.dat
copyForced $fwdir/start.elf /boot/start.elf copyForced $fwdir/start.elf /boot/start.elf
copyForced $fwdir/start_cd.elf /boot/start_cd.elf 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. # Remove obsolete files from /boot/old.
for fn in /boot/old/*linux* /boot/old/*initrd*; do for fn in /boot/old/*linux* /boot/old/*initrd*; do

View File

@ -3,6 +3,7 @@
with lib; with lib;
let let
cfg = config.boot.loader.raspberryPi;
builder = pkgs.substituteAll { builder = pkgs.substituteAll {
src = ./builder.sh; src = ./builder.sh;
@ -10,6 +11,7 @@ let
inherit (pkgs) bash; inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
firmware = pkgs.raspberrypifw; firmware = pkgs.raspberrypifw;
version = cfg.version;
}; };
platform = pkgs.stdenv.platform; 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 { config = mkIf config.boot.loader.raspberryPi.enable {
system.build.installBootLoader = builder; system.build.installBootLoader = builder;
system.boot.loader.id = "raspberrypi"; system.boot.loader.id = "raspberrypi";
system.boot.loader.kernelFile = platform.kernelTarget; system.boot.loader.kernelFile = platform.kernelTarget;
assertions = [
{ assertion = (cfg.version == 1 || cfg.version == 2);
message = "loader.raspberryPi.version should be 1 or 2";
}
];
}; };
} }

View File

@ -2,14 +2,14 @@
let let
rev = "3ab17ac25e"; rev = "b7bbd3d1683e9f3bb11ef86b952adee71e83862f";
in stdenv.mkDerivation { in stdenv.mkDerivation {
name = "raspberrypi-firmware-${rev}"; name = "raspberrypi-firmware-${rev}";
src = fetchurl { src = fetchurl {
url = "https://github.com/raspberrypi/firmware/archive/${rev}.tar.gz"; url = "https://github.com/raspberrypi/firmware/archive/${rev}.tar.gz";
sha256 = "080va4zz858bwwgxam8zy58gpwjpxfg7v5h1q5b4cpbzjihsxcx9"; sha256 = "16wpwa1y3imd3la477b3rfbfypssvlh0zjdag3hgkm33aysizijp";
}; };
installPhase = '' installPhase = ''