2020-05-24 22:24:10 +00:00
|
|
|
{ stdenvNoCC, lib, fetchFromGitHub, makeWrapper
|
2023-10-01 08:32:19 +00:00
|
|
|
, python3, binutils-unwrapped, findutils, gawk, kmod, pciutils, libraspberrypi
|
2020-05-24 22:24:10 +00:00
|
|
|
}:
|
2021-05-31 18:21:06 +00:00
|
|
|
stdenvNoCC.mkDerivation rec {
|
2020-05-24 22:24:10 +00:00
|
|
|
pname = "raspberrypi-eeprom";
|
2023-11-19 10:57:16 +00:00
|
|
|
version = "2023.10.30-2712";
|
2020-05-24 22:24:10 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "raspberrypi";
|
|
|
|
repo = "rpi-eeprom";
|
2023-10-19 13:59:36 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-11-19 10:57:16 +00:00
|
|
|
hash = "sha256-TKvby0qIXidM5Qk7q+ovLk0DpHsCbdQe7xndrgKrSXk=";
|
2020-05-24 22:24:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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 \
|
2021-05-31 18:21:06 +00:00
|
|
|
--replace 'IGNORE_DPKG_CHECKSUMS=''${LOCAL_MODE}' 'IGNORE_DPKG_CHECKSUMS=1' \
|
2020-05-24 22:24:10 +00:00
|
|
|
--replace '/etc/default' '/etc'
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-10-19 13:59:36 +00:00
|
|
|
mkdir -p "$out/bin"
|
|
|
|
cp rpi-eeprom-config rpi-eeprom-update rpi-eeprom-digest "$out/bin"
|
2020-05-24 22:24:10 +00:00
|
|
|
|
2023-10-19 13:59:36 +00:00
|
|
|
mkdir -p "$out/lib/firmware/raspberrypi"
|
|
|
|
for dirname in firmware-*; do
|
|
|
|
dirname_suffix="''${dirname/#firmware-}"
|
|
|
|
cp -rP "$dirname" "$out/lib/firmware/raspberrypi/bootloader-$dirname_suffix"
|
|
|
|
done
|
2020-05-24 22:24:10 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
fixupPhase = ''
|
|
|
|
patchShebangs $out/bin
|
2021-08-21 19:20:57 +00:00
|
|
|
for i in rpi-eeprom-update rpi-eeprom-config; do
|
|
|
|
wrapProgram $out/bin/$i \
|
2023-10-19 13:59:36 +00:00
|
|
|
--set FIRMWARE_ROOT "$out/lib/firmware/raspberrypi/bootloader" \
|
2021-08-21 19:20:57 +00:00
|
|
|
${lib.optionalString stdenvNoCC.isAarch64 "--set VCMAILBOX ${libraspberrypi}/bin/vcmailbox"} \
|
|
|
|
--prefix PATH : "${lib.makeBinPath ([
|
|
|
|
binutils-unwrapped
|
|
|
|
findutils
|
2023-10-01 08:32:19 +00:00
|
|
|
gawk
|
2021-08-21 19:20:57 +00:00
|
|
|
kmod
|
|
|
|
pciutils
|
|
|
|
(placeholder "out")
|
|
|
|
] ++ lib.optionals stdenvNoCC.isAarch64 [
|
|
|
|
libraspberrypi
|
|
|
|
])}"
|
|
|
|
done
|
2020-05-24 22:24:10 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-10-19 13:59:36 +00:00
|
|
|
description = "Installation scripts and binaries for the closed sourced Raspberry Pi 4 and 5 bootloader EEPROMs";
|
|
|
|
homepage = "https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-4-boot-eeprom";
|
2020-05-24 22:24:10 +00:00
|
|
|
license = with licenses; [ bsd3 unfreeRedistributableFirmware ];
|
2023-10-19 14:55:37 +00:00
|
|
|
maintainers = with maintainers; [ das_j Luflosi ];
|
2023-12-12 10:54:24 +00:00
|
|
|
platforms = platforms.linux;
|
2020-05-24 22:24:10 +00:00
|
|
|
};
|
|
|
|
}
|