raspberrypi-bootloader: support Raspberry Pi 3 w/o U-Boot and explicitly support

Raspberry Pi Zero
This commit is contained in:
Ben Wolsieffer 2018-09-10 23:21:41 -04:00 committed by Tuomas Tynkkynen
parent bcb9e17bba
commit 1afff7c10b
5 changed files with 18 additions and 19 deletions

View File

@ -1,4 +1,4 @@
{ pkgs, version, configTxt }: { pkgs, configTxt }:
pkgs.substituteAll { pkgs.substituteAll {
src = ./raspberrypi-builder.sh; src = ./raspberrypi-builder.sh;
@ -6,5 +6,5 @@ pkgs.substituteAll {
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;
inherit version configTxt; inherit configTxt;
} }

View File

@ -85,13 +85,9 @@ addEntry() {
echo $kernel > $outdir/$generation-kernel echo $kernel > $outdir/$generation-kernel
if test "$generation" = "default"; then if test "$generation" = "default"; then
if [ @version@ -eq 1 ]; then
copyForced $kernel $target/kernel.img copyForced $kernel $target/kernel.img
else
copyForced $kernel $target/kernel7.img
fi
copyForced $initrd $target/initrd copyForced $initrd $target/initrd
for dtb in $dtb_path/bcm*.dtb; do for dtb in $dtb_path/{broadcom,}/bcm*.dtb; do
dst="$target/$(basename $dtb)" dst="$target/$(basename $dtb)"
copyForced $dtb "$dst" copyForced $dtb "$dst"
filesCopied[$dst]=1 filesCopied[$dst]=1

View File

@ -7,8 +7,8 @@ let
inherit (pkgs.stdenv.hostPlatform) platform; inherit (pkgs.stdenv.hostPlatform) platform;
builderUboot = import ./builder_uboot.nix { inherit config pkgs configTxt; }; builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; };
builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; inherit (cfg) version; }; builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; };
builder = builder =
if cfg.uboot.enable then if cfg.uboot.enable then
@ -34,9 +34,11 @@ let
'' + optional isAarch64 '' '' + optional isAarch64 ''
# Boot in 64-bit mode. # Boot in 64-bit mode.
arm_control=0x200 arm_control=0x200
'' + optional cfg.uboot.enable '' '' + (if cfg.uboot.enable then ''
kernel=u-boot-rpi.bin kernel=u-boot-rpi.bin
'' + optional (cfg.firmwareConfig != null) cfg.firmwareConfig); '' else ''
kernel=kernel.img
'') + optional (cfg.firmwareConfig != null) cfg.firmwareConfig);
in in
@ -56,7 +58,7 @@ in
version = mkOption { version = mkOption {
default = 2; default = 2;
type = types.enum [ 1 2 3 ]; type = types.enum [ 0 1 2 3 ];
description = '' description = ''
''; '';
}; };

View File

@ -1,13 +1,14 @@
{ config, pkgs, configTxt }: { pkgs, version, configTxt }:
let let
cfg = config.boot.loader.raspberryPi;
isAarch64 = pkgs.stdenv.isAarch64; isAarch64 = pkgs.stdenv.isAarch64;
uboot = uboot =
if cfg.version == 1 then if version == 0 then
pkgs.ubootRaspberryPiZero
else if version == 1 then
pkgs.ubootRaspberryPi pkgs.ubootRaspberryPi
else if cfg.version == 2 then else if version == 2 then
pkgs.ubootRaspberryPi2 pkgs.ubootRaspberryPi2
else else
if isAarch64 then if isAarch64 then
@ -21,7 +22,7 @@ let
}; };
in in
pkgs.substituteAll { pkgs.substituteAll {
src = ./builder_uboot.sh; src = ./uboot-builder.sh;
isExecutable = true; isExecutable = true;
inherit (pkgs) bash; inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
@ -29,6 +30,6 @@ pkgs.substituteAll {
inherit uboot; inherit uboot;
inherit configTxt; inherit configTxt;
inherit extlinuxConfBuilder; inherit extlinuxConfBuilder;
version = cfg.version; inherit version;
} }