1{ stdenv, fetchFromGitHub }:
2
3stdenv.mkDerivation rec {
4 name = "raspberrypi-firmware-${version}";
5 version = "1.20171029";
6
7 src = fetchFromGitHub {
8 owner = "raspberrypi";
9 repo = "firmware";
10 rev = version;
11 sha256 = "12aisha8rlr28310hakps04z9p45kd2wvks0w1vxw1kwfh1ncy9s";
12 };
13
14 dontStrip = true; # Stripping breaks some of the binaries
15
16 installPhase = ''
17 mkdir -p $out/share/raspberrypi/boot
18 cp -R boot/* $out/share/raspberrypi/boot
19 cp -R hardfp/opt/vc/* $out
20 cp opt/vc/LICENCE $out/share/raspberrypi
21
22 for f in $out/bin/*; do
23 if isELF "$f"; then
24 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f"
25 patchelf --set-rpath "$out/lib" "$f"
26 fi
27 done
28 '';
29
30 meta = with stdenv.lib; {
31 description = "Firmware for the Raspberry Pi board";
32 homepage = https://github.com/raspberrypi;
33 license = licenses.unfree;
34 platforms = [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
35 maintainers = with maintainers; [ viric tavyc ];
36 };
37}