New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] linux: translate config to structured config #41393
Conversation
Success on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
I updated the default config so that it reflects exaclty (notwithstanding my mistakes) the current common-config.nix. |
Success on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
I've updated common-config to reflect all the changes since copumpkin PRs and was able to compile 4.17. I updated the initial message too, removing out of scope changes. It should be ready for review (apart from the messy history) |
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
lib/kernel.nix
Outdated
# returns a string, expr should be an attribute set | ||
# generateNixKConf = exprs: | ||
# generateNixKConfAdvanced exprs null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo remove
@@ -59,8 +63,10 @@ let | |||
netfilterRPFilter = true; | |||
} // features) kernelPatches; | |||
|
|||
config = import ./common-config.nix { | |||
inherit stdenv version ; | |||
# returns a config of the form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
@@ -24,7 +24,7 @@ in { | |||
modDirVersion ? version, | |||
# The kernel source (tarball, git checkout, etc.) | |||
src, | |||
# Any patches | |||
# a list of { name=..., patch=..., } patches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add "extraConfig"
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to dependencies? If I set module A to "n" but module B to "y" despite B depending on A, the kernel config will error out, correct?
Is there something simple we can do to detect this? (I can't see a simple way)
DEBUG_DEVRES = no; | ||
TIMER_STATS = whenOlder "4.11" yes; | ||
DEBUG_NX_TEST = whenOlder "4.11" no; | ||
CPU_NOTIFIER_ERROR_INJECT = whenOlder "4.4" (option no); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are no kernels <4.4, should we maybe just remove all the options for really old kernels?
And things such as whenAtLeast "3.4" yes
may as well just be yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that it's there I would say keep it, some people might run their own 3.X kernel and might appreciate it ? I am good either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we will do that in a future PR. I highly doubt somebody uses master
/ future-18.09 with a 3.x kernel :D
X86_INTEL_LPSS = whenAtLeast "3.11" yes; | ||
X86_INTEL_PSTATE = whenAtLeast "3.10" yes; | ||
INTEL_IDLE = yes; | ||
CPU_FREQ_DEFAULT_GOV_PERFORMANCE = yes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to add the other governors as options here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do such changes separately from the structured-options refactoring; that way it is much easier to verify there weren't unintended changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, I had to remove some copumpkin CONFIG_ additions that would generate errors on recent kernels.
I discovered yesterday https://github.com/ulfalizer/Kconfiglib which might help in that regard at a later date, I am not sure. The kernel has also a script to merge different configs https://github.com/torvalds/linux/blob/master/scripts/kconfig/merge_config.sh, I wonder if this could be used to fix some of our dependencies problem. But I would rather leave this exploration to future PRs. |
I noticed some minor differences in the configs, feel free to squash the fixes from https://github.com/NixOS/nixpkgs/compare/master...dezgeg:structured-kernel-conf-fixes?expand=1 |
wow thanks that's super nice, you caught quite a few ones. I squashed and rebased. I added a commit to remove references to any kernel < 4.4 so that it can be reverted later. |
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
Instead of using a string to describe kernel config, use a nix attribute set, then converted to a string. - allows to override the config, aka convert 'yes' into 'modules' or vice-versa - while for now merging different configs is still crude (last spec wins), at least there should be only one CONFIG_XYZ value compared to the current string config where the first defined would be used and others ignored.
The oldest kernel in nixpkgs being 4.4, we get rid of checks for older kernels.
with import ../../../../lib/kernel.nix { inherit (stdenv) lib; inherit version; }; | ||
|
||
let | ||
# temporary hack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, what's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when reworking the original PR, the features system had changed a bit and I came up with the hack to remove later. I had forgotten about it; I pushed a 3rd commit which uses features.xdom0 instead. It should fix it.
Success on aarch64-linux (full log) Attempted: linux Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: linux Partial log (click to expand)
|
I verified with scripts that after a minor fix I squashed in there's no change to the effective configs on x86_64, i686, aarch64 and armv7l. So merged. |
Follow up of #12158 @copumpkin . I am looking for comments before polishing as compiling kernels is not especially fast here.
The set is then converted into a string so backwards compatibility kinda applies (users can still specify their kernel extraConfig as a string) but it should be deprecated in favor of sets.
Motivation for this change
will end up with
yes
. Even though this PR doesn't solve this problem, it paves the way for some kind of mkMerge mechanism.Things done
extraConfig
as a string for backawards compatibility, structuredExtraConfig must be a flat set e.g.{ BPF = yes; BPF_SYSCALL = y; }
mkValuePreprocess
allows to override each setting, aka convert 'yes' into 'modules' or vice-versaI test the changes with this overlay expression and tried compiling a few kernels (can't do all though with my poor machine).
Future work
[ ] Convert patches to this new format
[ ] make packages describe their kernel requirements (bcc needs BPF, openvswitch needs OPENVSWITCH etc)
For instance the openvswitch package could contain hints to the configuration:
and have the module actually enforce that configuration:
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)