fix up the rpi-specialized u-boot to actually work when deployed

notably: ship the *correct* rpi-4-b.dtb file alongside u-boot.
This commit is contained in:
2022-06-29 01:14:46 -07:00
parent 0aa0334465
commit af8e11242d
4 changed files with 42 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
{ stdenv, pkgs }:
stdenv.mkDerivation rec {
pname = "bootpart-tow-boot-rpi-aarch64";
pname = "bootpart-u-boot-rpi-aarch64";
version = "1";
buildInputs = with pkgs; [
@@ -18,7 +18,9 @@ stdenv.mkDerivation rec {
installPhase = with pkgs; ''
mkdir "$out"
cp ${ubootRaspberryPi4_64bit}/u-boot.bin "$out"/
cp -R ${raspberrypifw}/share/raspberrypi/boot/*.dtb "$out"/
cp ${ubootRaspberryPi4_64bit}/*.dtb "$out"/
# NB: raspberrypifw dtb's are meant for the kernel, not for u-boot
# cp -R ${raspberrypifw}/share/raspberrypi/boot/*.dtb "$out"/
cp -R ${raspberrypifw}/share/raspberrypi/boot/*.bin "$out"/
cp -R ${raspberrypifw}/share/raspberrypi/boot/*.dat "$out"/
cp -R ${raspberrypifw}/share/raspberrypi/boot/*.img "$out"/

View File

@@ -8,6 +8,10 @@
# not sure why i can't just do pkgs = next here
pkgs = prev // { inherit tow-boot-rpi4; };
};
bootpart-u-boot-rpi-aarch64 = prev.callPackage ./bootpart-u-boot-rpi-aarch64 {
# not sure why i can't just do pkgs = next here
pkgs = prev // { inherit ubootRaspberryPi4_64bit; };
};
#### customized packages
# nixos-unstable pleroma is too far out-of-date for our db

View File

@@ -1,16 +0,0 @@
diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
index eae03bf023..2ded4123ce 100644
--- a/configs/rpi_4_defconfig
+++ b/configs/rpi_4_defconfig
@@ -63,3 +63,11 @@ CONFIG_VIDEO_BCM2835=y
CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_PHYS_TO_BUS=y
CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_CMD_CONFIG=y
+CONFIG_CMD_EFIDEBUG=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_LOG=y
+CONFIG_CMD_READ=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_LOG_MAX_LEVEL=7
+CONFIG_CMD_LSBLK=y

View File

@@ -1,12 +1,39 @@
{ pkgs }:
{ pkgs, fetchurl }:
(pkgs.ubootRaspberryPi4_64bit.overrideAttrs (upstream: {
patches = (upstream.patches or []) ++ [
(pkgs.buildUBoot {
# nixos-22.05 is on 2022.01 at time of writing, which lacks rpi-4 dtb.
# TODO: remove this version/src override once upstream bumps u-boot version.
version = "2022.04";
src = fetchurl {
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-2022.04.tar.bz2";
hash = "sha256-aOBlQTkmd44nbsOr0ouzL6gquqSmiY1XDB9I+9sIvNA=";
};
defconfig = "rpi_4_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
extraConfig = ''
# TODO: this can be removed in 2022.04
CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
# enable some builtin commands to aid in debugging, while we're here
CONFIG_CMD_CONFIG=y
CONFIG_CMD_EFIDEBUG=y
CONFIG_CMD_GPT=y
CONFIG_CMD_LOG=y
CONFIG_CMD_READ=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_LOG_MAX_LEVEL=7
CONFIG_CMD_LSBLK=y
'';
extraMakeFlags = [
"u-boot.dtb"
"u-boot.bin"
];
filesToInstall = [ "u-boot.bin" "u-boot.dtb" ];
postInstall = ''
mv $out/u-boot.dtb $out/bcm2711-rpi-4-b.dtb
'';
extraPatches = [
# enable booting from > 2 TiB drives
./01-skip-lba-check.patch
# enable some builtin commands to aid in debugging, while we're here
./02-extra-cmds.patch
# ./03-verbose-log.patch
];
}))
})