forked from mirrors/nixpkgs
26286030e8
The rpi-eeprom-update commands relies on a default symlink. This is purely relative and points to critical, but is in fact published by upstream. Without this, the rpi-eeprom-update command fails with an error message - and has no help options to make it easy to figure out the magic flags to get it to do the right thing.
59 lines
1.9 KiB
Nix
59 lines
1.9 KiB
Nix
{ stdenvNoCC, lib, fetchFromGitHub, makeWrapper
|
|
, python3, binutils-unwrapped, findutils, kmod, pciutils, libraspberrypi
|
|
}:
|
|
stdenvNoCC.mkDerivation rec {
|
|
pname = "raspberrypi-eeprom";
|
|
version = "2021.04.29-138a1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "raspberrypi";
|
|
repo = "rpi-eeprom";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-nzAMPa4gqCAcROFa7z34IoMA3aoMHX9fYCsPFde9dac=";
|
|
};
|
|
|
|
buildInputs = [ python3 ];
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
postPatch = ''
|
|
# Don't try to verify md5 signatures from /var/lib/dpkg and
|
|
# fix path to the configuration.
|
|
substituteInPlace rpi-eeprom-update \
|
|
--replace 'IGNORE_DPKG_CHECKSUMS=''${LOCAL_MODE}' 'IGNORE_DPKG_CHECKSUMS=1' \
|
|
--replace '/etc/default' '/etc'
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin $out/share/rpi-eeprom
|
|
|
|
cp rpi-eeprom-config rpi-eeprom-update $out/bin
|
|
cp -r firmware/{beta,critical,old,stable} $out/share/rpi-eeprom
|
|
cp -P firmware/default firmware/latest $out/share/rpi-eeprom
|
|
'';
|
|
|
|
fixupPhase = ''
|
|
patchShebangs $out/bin
|
|
for i in rpi-eeprom-update rpi-eeprom-config; do
|
|
wrapProgram $out/bin/$i \
|
|
--set FIRMWARE_ROOT $out/share/rpi-eeprom \
|
|
${lib.optionalString stdenvNoCC.isAarch64 "--set VCMAILBOX ${libraspberrypi}/bin/vcmailbox"} \
|
|
--prefix PATH : "${lib.makeBinPath ([
|
|
binutils-unwrapped
|
|
findutils
|
|
kmod
|
|
pciutils
|
|
(placeholder "out")
|
|
] ++ lib.optionals stdenvNoCC.isAarch64 [
|
|
libraspberrypi
|
|
])}"
|
|
done
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Installation scripts and binaries for the closed sourced Raspberry Pi 4 EEPROMs";
|
|
homepage = "https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md";
|
|
license = with licenses; [ bsd3 unfreeRedistributableFirmware ];
|
|
maintainers = with maintainers; [ das_j ];
|
|
};
|
|
}
|