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]
This commit is contained in:
committed by
Tuomas Tynkkynen
parent
bae87d5042
commit
ff9999ad1b
File diff suppressed because it is too large
Load Diff
@@ -15,9 +15,12 @@
|
||||
, # Allows overriding the default defconfig
|
||||
defconfig ? null
|
||||
|
||||
, # Overrides to the kernel config.
|
||||
, # Legacy overrides to the intermediate kernel config, as string
|
||||
extraConfig ? ""
|
||||
|
||||
, # kernel intermediate config overrides, as a set
|
||||
structuredExtraConfig ? {}
|
||||
|
||||
, # The version number used for the module directory
|
||||
modDirVersion ? version
|
||||
|
||||
@@ -42,6 +45,7 @@
|
||||
, preferBuiltin ? hostPlatform.platform.kernelPreferBuiltin or false
|
||||
, kernelArch ? hostPlatform.platform.kernelArch
|
||||
|
||||
, mkValueOverride ? null
|
||||
, ...
|
||||
} @ args:
|
||||
|
||||
@@ -59,8 +63,9 @@ let
|
||||
netfilterRPFilter = true;
|
||||
} // features) kernelPatches;
|
||||
|
||||
config = import ./common-config.nix {
|
||||
inherit stdenv version ;
|
||||
intermediateNixConfig = import ./common-config.nix {
|
||||
inherit stdenv version structuredExtraConfig mkValueOverride;
|
||||
|
||||
# append extraConfig for backwards compatibility but also means the user can't override the kernelExtraConfig part
|
||||
extraConfig = extraConfig + lib.optionalString (hostPlatform.platform ? kernelExtraConfig) hostPlatform.platform.kernelExtraConfig;
|
||||
|
||||
@@ -79,7 +84,7 @@ let
|
||||
|
||||
generateConfig = ./generate-config.pl;
|
||||
|
||||
kernelConfig = kernelConfigFun config;
|
||||
kernelConfig = kernelConfigFun intermediateNixConfig;
|
||||
passAsFile = [ "kernelConfig" ];
|
||||
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
|
||||
@@ -24,7 +24,7 @@ in {
|
||||
modDirVersion ? version,
|
||||
# The kernel source (tarball, git checkout, etc.)
|
||||
src,
|
||||
# Any patches
|
||||
# a list of { name=..., patch=..., extraConfig=...} patches
|
||||
kernelPatches ? [],
|
||||
# The kernel .config file
|
||||
configfile,
|
||||
|
||||
Reference in New Issue
Block a user