about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorAlois Wohlschlager <alois1@gmx-topmail.de>2024-03-22 17:14:13 +0100
committerAlois Wohlschlager <alois1@gmx-topmail.de>2024-03-22 17:14:13 +0100
commit1bfe0f3c08ab26834567cb8f2b86735857016158 (patch)
tree540a8e832f7c99391692a424ab4454153fc4c889 /pkgs/os-specific
parent20f77aa09916374aa3141cbc605c955626762c9a (diff)
kernel/common-config: throw on duplicate configuration option definitions
Previously, when a kernel configuration option was defined multiple times (in
different sections), only the first value was honored and all subsequent ones
were silently ignored. Remove this footgun by throwing in this situation
instead.
In addition, fix all instances where an option was in fact defined multiple
times. In two cases (`RCU_TORTURE_TEST` and `CRASH_DUMP`), the value was
effectively the same both times. In the other two cases (`SCHEDSTATS` and
`DRM_SIMPLEDRM`) the value was in fact different; the one that was actually
applied was kept here to prevent a rebuild.
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix8
1 files changed, 1 insertions, 7 deletions
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index 1e50fc3dfa15e..f46f413f9e0a7 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -23,7 +23,7 @@ let
 
 
   # configuration items have to be part of a subattrs
-  flattenKConf =  nested: mapAttrs (_: head) (zipAttrs (attrValues nested));
+  flattenKConf = nested: mapAttrs (name: values: if length values == 1 then head values else throw "duplicate kernel configuration option: ${name}") (zipAttrs (attrValues nested));
 
   whenPlatformHasEBPFJit =
     mkIf (stdenv.hostPlatform.isAarch32 ||
@@ -111,9 +111,6 @@ let
       # Enable CPU energy model for scheduling
       ENERGY_MODEL                     = whenAtLeast "5.0" yes;
 
-      # Enable scheduling stats collection
-      SCHEDSTATS                       = yes;
-
       # Enable thermal interface netlink API
       THERMAL_NETLINK                  = whenAtLeast "5.9" yes;
 
@@ -413,7 +410,6 @@ let
       whenHasDevicePrivate = mkIf (!stdenv.isx86_32 && versionAtLeast version "5.1");
     in {
       DRM_LEGACY = whenOlder "6.8" no;
-      DRM_SIMPLEDRM = yes;
 
       NOUVEAU_LEGACY_CTX_SUPPORT = whenBetween "5.2" "6.3" no;
 
@@ -890,7 +886,6 @@ let
       NOTIFIER_ERROR_INJECTION = option no;
       RCU_PERF_TEST            = whenOlder "5.9" no;
       RCU_SCALE_TEST           = whenAtLeast "5.10" no;
-      RCU_TORTURE_TEST         = option no;
       TEST_ASYNC_DRIVER_PROBE  = option no;
       WW_MUTEX_SELFTEST        = option no;
       XZ_DEC_TEST              = option no;
@@ -999,7 +994,6 @@ let
       # Removed on 5.17 as it was unused
       # upstream: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0a4ee518185e902758191d968600399f3bc2be31
       CLEANCACHE = whenOlder "5.17" (option yes);
-      CRASH_DUMP = option no;
 
       FSCACHE_STATS = yes;