diff --git a/pkgs/build-support/checker/default.nix b/pkgs/build-support/checker/default.nix new file mode 100644 index 00000000000..989d5813383 --- /dev/null +++ b/pkgs/build-support/checker/default.nix @@ -0,0 +1,26 @@ +# +# Checks that all set options are described. +# +options: configuration: +with builtins; +with (import ../../lib); + +let + findInList = p: list: default: + if (list == []) then default else + if (p (head list)) then (head list) else + findInList p (tail list) default; + + attrSetToList = attrs: if (isAttrs attrs) then (concatLists (map + (s: + (map (l: ([s] ++ l)) + (attrSetToList (getAttr s attrs)))) + (attrNames attrs))) else [[]]; +in +let opts = (map (a: a.name) options); + conf = attrSetToList configuration; +in +let res=findInList (a: (findInList (b: (eqLists a b)) opts null)==null) conf null; +in +#if res==null then null else map (l: ["<"] ++ l ++ [">"]) res +res diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh index 9aec3b0b8de..5a7958e35a8 100644 --- a/pkgs/os-specific/linux/kernel/builder.sh +++ b/pkgs/os-specific/linux/kernel/builder.sh @@ -22,8 +22,24 @@ configurePhase() { cp $config .config chmod u+w .config + echo --extraConfig--; + echo "${extraConfig}"; + + echo "$extraConfig" | while read; do + optionName=$( echo "$REPLY" | sed -e 's/[^A-Z_]//g' ); + echo --optionName--; + echo "$REPLY"; + echo ${optionName}; + if [ -n "${optionName}" ]; then + sed -e s/.'*'${optionName}.'*'/"$REPLY/" -i .config + fi; + done; + echo "$extraConfig" >> .config + echo --finalConfig-- + cat .config + #substituteInPlace scripts/kconfig/lxdialog/check-lxdialog.sh \ # --replace /usr /no-such-path diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 553c8a063b7..94b46e4da1f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -197,6 +197,15 @@ rec { } // extraAttrs co // co.pass // co.flags_prefixed ); */ + # Check absence of non-used options + checker = x: flag: opts: config: + (if flag then let result=( + (import ../build-support/checker) + opts config); in + (if (result==null) then x else + abort (toString result)) + else x); + ### STANDARD ENVIRONMENT @@ -275,7 +284,6 @@ rec { inherit stdenv; }; - ### TOOLS @@ -2766,9 +2774,18 @@ rec { { name = "Enable-NO_HZ"; patch = ../lib/empty.file; - extraConfig = "NO_HZ=y\n"; + extraConfig = "CONFIG_NO_HZ=y\n"; } ] else []) + ++ + (if (getConfig ["kernel" "timer_stats"] false) then [ + { + name = "Enable-TIMER_STATS"; + patch = ../lib/empty.file; + extraConfig = "CONFIG_TIMER_STATS=y\n"; + } + ] else []) + ; };