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 {
src = ./raspberrypi-builder.sh;
@ -6,5 +6,5 @@ pkgs.substituteAll {
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
firmware = pkgs.raspberrypifw;
inherit version configTxt;
inherit configTxt;
}

View file

@ -85,13 +85,9 @@ addEntry() {
echo $kernel > $outdir/$generation-kernel
if test "$generation" = "default"; then
if [ @version@ -eq 1 ]; then
copyForced $kernel $target/kernel.img
else
copyForced $kernel $target/kernel7.img
fi
copyForced $kernel $target/kernel.img
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)"
copyForced $dtb "$dst"
filesCopied[$dst]=1

View file

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

View file

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