From c0e77dba0e1c16e6ddae4edfd073804e3ab7b30c Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 23 Mar 2017 03:03:37 +0300 Subject: [PATCH] linux: add kernelPreferBuiltin platform option This allows to use kernelAutoModules but still compile in any options that are set so in template config. It's helpful for ARM and maybe other platforms where defaul configurations are useful because they compile in modules that we and udev cannot autodetect now. --- pkgs/os-specific/linux/kernel/generate-config.pl | 3 ++- pkgs/os-specific/linux/kernel/generic.nix | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl index 5574cc937af..5bce3af9429 100644 --- a/pkgs/os-specific/linux/kernel/generate-config.pl +++ b/pkgs/os-specific/linux/kernel/generate-config.pl @@ -17,6 +17,7 @@ my $wd = getcwd; my $debug = $ENV{'DEBUG'}; my $autoModules = $ENV{'AUTO_MODULES'}; +my $preferBuiltin = $ENV{'PREFER_BUILTIN'}; $SIG{PIPE} = 'IGNORE'; @@ -73,7 +74,7 @@ sub runConfig { my $question = $1; my $name = $2; my $alts = $3; my $answer = ""; # Build everything as a module if possible. - $answer = "m" if $autoModules && $alts =~ /\/m/; + $answer = "m" if $autoModules && $alts =~ /\/m/ && !($preferBuiltin && $alts =~ /Y/); $answer = $answers{$name} if defined $answers{$name}; print STDERR "QUESTION: $question, NAME: $name, ALTS: $alts, ANSWER: $answer\n" if $debug; print OUT "$answer\n"; diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index af14434b08f..16b35e9aa3e 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -55,6 +55,7 @@ let kernelBaseConfig = stdenv.platform.kernelBaseConfig; kernelTarget = stdenv.platform.kernelTarget; autoModules = stdenv.platform.kernelAutoModules; + preferBuiltin = stdenv.platform.kernelPreferBuiltin or false; arch = stdenv.platform.kernelArch; crossAttrs = let @@ -92,7 +93,7 @@ let echo "generating kernel configuration..." echo "$kernelConfig" > kernel-config DEBUG=1 ARCH=$arch KERNEL_CONFIG=kernel-config AUTO_MODULES=$autoModules \ - SRC=../$sourceRoot perl -w $generateConfig + PREFER_BUILTIN=$preferBuiltin SRC=../$sourceRoot perl -w $generateConfig ''; installPhase = "mv .config $out";