rustdesk-flutter: add pipewire gstreame plugin (#379587)
[NixPkgs.git] / pkgs / os-specific / linux / kernel / linux-rpi.nix
blobfb229afe8314606fa926d7a2a6775b0aea6b73d6
2   stdenv,
3   lib,
4   buildPackages,
5   fetchFromGitHub,
6   fetchpatch,
7   perl,
8   buildLinux,
9   rpiVersion,
10   ...
11 }@args:
13 let
14   # NOTE: raspberrypifw & raspberryPiWirelessFirmware should be updated with this
15   modDirVersion = "6.6.51";
16   tag = "stable_20241008";
18 lib.overrideDerivation
19   (buildLinux (
20     args
21     // {
22       version = "${modDirVersion}-${tag}";
23       inherit modDirVersion;
24       pname = "linux-rpi";
26       src = fetchFromGitHub {
27         owner = "raspberrypi";
28         repo = "linux";
29         rev = tag;
30         hash = "sha256-phCxkuO+jUGZkfzSrBq6yErQeO2Td+inIGHxctXbD5U=";
31       };
33       defconfig =
34         {
35           "1" = "bcmrpi_defconfig";
36           "2" = "bcm2709_defconfig";
37           "3" = if stdenv.hostPlatform.isAarch64 then "bcmrpi3_defconfig" else "bcm2709_defconfig";
38           "4" = "bcm2711_defconfig";
39         }
40         .${toString rpiVersion};
42       features = {
43         efiBootStub = false;
44       } // (args.features or { });
46       extraMeta =
47         if (rpiVersion < 3) then
48           {
49             platforms = with lib.platforms; arm;
50             hydraPlatforms = [ ];
51           }
52         else
53           {
54             platforms = with lib.platforms; arm ++ aarch64;
55             hydraPlatforms = [ "aarch64-linux" ];
56           };
57       ignoreConfigErrors = true;
58     }
59     // (args.argsOverride or { })
60   ))
61   (oldAttrs: {
62     postConfigure = ''
63       # The v7 defconfig has this set to '-v7' which screws up our modDirVersion.
64       sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
65       sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
66     '';
68     # Make copies of the DTBs named after the upstream names so that U-Boot finds them.
69     # This is ugly as heck, but I don't know a better solution so far.
70     postFixup =
71       ''
72         dtbDir=${if stdenv.hostPlatform.isAarch64 then "$out/dtbs/broadcom" else "$out/dtbs"}
73         rm $dtbDir/bcm283*.dtb
74         copyDTB() {
75           cp -v "$dtbDir/$1" "$dtbDir/$2"
76         }
77       ''
78       + lib.optionalString (lib.elem stdenv.hostPlatform.system [ "armv6l-linux" ]) ''
79         copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero.dtb
80         copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb
81         copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
82         copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
83         copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
84         copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus.dtb
85         copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb
86         copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb
87         copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
88       ''
89       + lib.optionalString (lib.elem stdenv.hostPlatform.system [ "armv7l-linux" ]) ''
90         copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
91       ''
92       +
93         lib.optionalString
94           (lib.elem stdenv.hostPlatform.system [
95             "armv7l-linux"
96             "aarch64-linux"
97           ])
98           ''
99             copyDTB bcm2710-rpi-zero-2.dtb bcm2837-rpi-zero-2.dtb
100             copyDTB bcm2710-rpi-zero-2-w.dtb bcm2837-rpi-zero-2-w.dtb
101             copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
102             copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-a-plus.dtb
103             copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
104             copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
105             copyDTB bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb
106           '';
107   })