blob: b8f14c5f8a6a1d5c6347adb368cce62cb0d8e76e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{ stdenvNoCC
, lib
, fetchFromGitHub
, makeWrapper
, python3
, binutils-unwrapped
, findutils
, gawk
, kmod
, pciutils
, libraspberrypi
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "raspberrypi-eeprom";
version = "2023.10.30-2712";
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "rpi-eeprom";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-TKvby0qIXidM5Qk7q+ovLk0DpHsCbdQe7xndrgKrSXk=";
};
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"
cp rpi-eeprom-config rpi-eeprom-update rpi-eeprom-digest "$out/bin"
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
'';
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
gawk
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 and 5 bootloader EEPROMs";
homepage = "https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-4-boot-eeprom";
license = with licenses; [ bsd3 unfreeRedistributableFirmware ];
maintainers = with maintainers; [ das_j Luflosi ];
platforms = platforms.linux;
};
})
|