nixpkgs/pkgs/by-name/ra/raspberrypi-eeprom/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.1 KiB
Nix
Raw Normal View History

{ stdenvNoCC
, lib
, fetchFromGitHub
, makeWrapper
, python3
, binutils-unwrapped
, findutils
, gawk
, kmod
, pciutils
, libraspberrypi
2020-05-24 22:24:10 +00:00
}:
stdenvNoCC.mkDerivation (finalAttrs: {
2020-05-24 22:24:10 +00:00
pname = "raspberrypi-eeprom";
version = "2024.02.16-2712";
2020-05-24 22:24:10 +00:00
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "rpi-eeprom";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-R3X7JaS8Ob6KwN1KYaJDZA8aI4Hv6Y3R+nOMSPjt2ew=";
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 \
--replace 'IGNORE_DPKG_CHECKSUMS=''${LOCAL_MODE}' 'IGNORE_DPKG_CHECKSUMS=1' \
2020-05-24 22:24:10 +00:00
--replace '/etc/default' '/etc'
'';
installPhase = ''
mkdir -p "$out/bin"
cp rpi-eeprom-config rpi-eeprom-update rpi-eeprom-digest "$out/bin"
2020-05-24 22:24:10 +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
for i in rpi-eeprom-update rpi-eeprom-config; do
wrapProgram $out/bin/$i \
--set FIRMWARE_ROOT "$out/lib/firmware/raspberrypi/bootloader" \
${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
kmod
pciutils
(placeholder "out")
] ++ lib.optionals stdenvNoCC.isAarch64 [
libraspberrypi
])}"
done
2020-05-24 22:24:10 +00:00
'';
meta = with lib; {
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 ];
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
};
})