1{ lib, buildLinux, fetchurl
2, kernelPatches ? [ ]
3, structuredExtraConfig ? {}
4, extraMeta ? {}
5, argsOverride ? {}
6, ... } @ args:
7
8let
9 version = "6.6.41-rt37"; # updated by ./update-rt.sh
10 branch = lib.versions.majorMinor version;
11 kversion = builtins.elemAt (lib.splitString "-" version) 0;
12in buildLinux (args // {
13 inherit version;
14 pname = "linux-rt";
15
16 # modDirVersion needs a patch number, change X.Y-rtZ to X.Y.0-rtZ.
17 modDirVersion = if (builtins.match "[^.]*[.][^.]*-.*" version) == null then version
18 else lib.replaceStrings ["-"] [".0-"] version;
19
20 src = fetchurl {
21 url = "mirror://kernel/linux/kernel/v6.x/linux-${kversion}.tar.xz";
22 sha256 = "1vrjw0yhzmmnbrxyzjrfyz1s8bixciv1ly9pkgcqbasqh5brrjcy";
23 };
24
25 kernelPatches = let rt-patch = {
26 name = "rt";
27 patch = fetchurl {
28 url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
29 sha256 = "0b2l0bdyb49x7by8wamqfr3yhy722pz55k5a9bvq8pvmqn9s8a3b";
30 };
31 }; in [ rt-patch ] ++ kernelPatches;
32
33 structuredExtraConfig = with lib.kernel; {
34 PREEMPT_RT = yes;
35 # Fix error: unused option: PREEMPT_RT.
36 EXPERT = yes; # PREEMPT_RT depends on it (in kernel/Kconfig.preempt)
37 # Fix error: option not set correctly: PREEMPT_VOLUNTARY (wanted 'y', got 'n').
38 PREEMPT_VOLUNTARY = lib.mkForce no; # PREEMPT_RT deselects it.
39 # Fix error: unused option: RT_GROUP_SCHED.
40 RT_GROUP_SCHED = lib.mkForce (option no); # Removed by sched-disable-rt-group-sched-on-rt.patch.
41 } // structuredExtraConfig;
42
43 extraMeta = extraMeta // {
44 inherit branch;
45 };
46} // argsOverride)