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.
This commit is contained in:
Nikolay Amiantov 2017-03-23 03:03:37 +03:00 committed by Tuomas Tynkkynen
parent 1b94c30beb
commit c0e77dba0e
2 changed files with 4 additions and 2 deletions

View file

@ -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";

View file

@ -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";