Commit Graph

11 Commits

Author SHA1 Message Date
Philip Taron
1f120c454a
Avoid top-level with ...; in lib/kernel.nix 2024-03-11 11:24:17 -07:00
Alyssa Ross
12e08bd339 lib.kernel.unset: init
Previously, there was no way to unset an option when overriding a
kernel, apart from writing out the attrset yourself.  Now it's
possible with lib.mkForce lib.kernel.unset.  It's important to be able
to do this, because setting an option in the override may cause other
options to become unused, which would fail the config build unless
they were overridden too.
2023-05-01 10:23:42 +00:00
Florian Klink
cfb4d0dfe3
Merge pull request #84032 from teto/fix_kernel_merge
Fix kernel configuration merge
2020-05-22 13:32:22 +02:00
Emily
d6fe0a4e2d linux/hardened: move files into directory 2020-05-08 15:49:35 +01:00
Matthieu Coudron
b9a4e6953d kernel: fix config generation
Addresses https://github.com/NixOS/nixpkgs/issues/71803:
Kernel options are not merged as described, especially the "optional"
aspects. The error silences legitimate warnings.
2020-04-01 22:25:57 +02:00
Matthieu Coudron
a4fe469d39 lib.kernel: scoped whenXXX helpers
whenAtLeast/whenBetween are made available in lib/kernel.nix but are now
scoped under whenXXX.
2019-10-01 16:09:07 +09:00
Matthieu Coudron
afa0e02d64 lib.kernel: make public
Remove the "version" parameter in order to make it more widely
available.
Starts making some kernel configuration helpers available.
The intent is to be able to better build and check the linux kernel
configuration.
2019-10-01 15:57:14 +09:00
volth
08f68313a4 treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
Matthieu Coudron
7aacbdb898 linux: convert hardened-config to a structured one 2019-01-28 09:07:24 +09:00
Matthieu Coudron
3bb7b3f02e linux: ability to merge structured configs
This should make the composability of kernel configurations more straigthforward.

- now distinguish freeform options from tristate ones
- will look for a structured config in kernelPatches too
one can now access the structuredConfig from a kernel via linux_test.configfile.structuredConfig
in order to reinject it into another kernel, no need to rewrite the config from scratch

The following merge strategies are used in case of conflict:
-- freeform items must be equal or they conflict (mergeEqualOption)
-- for tristate (y/m/n) entries, I use the mergeAnswer strategy which takes the best available value, "best" being defined by the user (by default "y" > "m" > "n", e.g. if one entry is both marked "y" and "n", "y" wins)
-- if one item is both marked optional/mandatory, mandatory wins (mergeFalseByDefault)
2019-01-28 09:06:33 +09:00
Dan Peebles
ff9999ad1b linux: translate config to structured config
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.

[initial idea by copumpkin in 2016, a major rebase to 2018 by teto]
2018-06-30 16:01:41 +03:00