kernel: buildLinux replaces import ./generic.nix
- defined buildLinux as generic.nix instead of manual-config.nix. This makes kernel derivations a tad more similar to your typical derivations. - moved $buildRoot to within the source folder, this way it doesn't have to be created before the unpackPhase and make it easier to work on kernel source without running the unpackPhase
This commit is contained in:
@@ -13,18 +13,18 @@ use strict;
|
||||
use IPC::Open2;
|
||||
use Cwd;
|
||||
|
||||
my $wd = getcwd;
|
||||
|
||||
# exported via nix
|
||||
my $debug = $ENV{'DEBUG'};
|
||||
my $autoModules = $ENV{'AUTO_MODULES'};
|
||||
my $preferBuiltin = $ENV{'PREFER_BUILTIN'};
|
||||
|
||||
my $ignoreConfigErrors = $ENV{'ignoreConfigErrors'};
|
||||
my $buildRoot = $ENV{'BUILD_ROOT'};
|
||||
$SIG{PIPE} = 'IGNORE';
|
||||
|
||||
# Read the answers.
|
||||
my %answers;
|
||||
my %requiredAnswers;
|
||||
open ANSWERS, "<$ENV{KERNEL_CONFIG}" or die;
|
||||
open ANSWERS, "<$ENV{KERNEL_CONFIG}" or die "Could not open answer file";
|
||||
while (<ANSWERS>) {
|
||||
chomp;
|
||||
s/#.*//;
|
||||
@@ -40,7 +40,7 @@ close ANSWERS;
|
||||
sub runConfig {
|
||||
|
||||
# Run `make config'.
|
||||
my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$wd config SHELL=bash ARCH=$ENV{ARCH}");
|
||||
my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$buildRoot config SHELL=bash ARCH=$ENV{ARCH}");
|
||||
|
||||
# Parse the output, look for questions and then send an
|
||||
# appropriate answer.
|
||||
@@ -122,7 +122,7 @@ runConfig;
|
||||
# there. `make config' often overrides answers if later questions
|
||||
# cause options to be selected.
|
||||
my %config;
|
||||
open CONFIG, "<.config" or die;
|
||||
open CONFIG, "<$buildRoot/.config" or die "Could not read .config";
|
||||
while (<CONFIG>) {
|
||||
chomp;
|
||||
if (/^CONFIG_([A-Za-z0-9_]+)="(.*)"$/) {
|
||||
@@ -137,7 +137,7 @@ while (<CONFIG>) {
|
||||
close CONFIG;
|
||||
|
||||
foreach my $name (sort (keys %answers)) {
|
||||
my $f = $requiredAnswers{$name} && $ENV{'ignoreConfigErrors'} ne "1"
|
||||
my $f = $requiredAnswers{$name} && $ignoreConfigErrors ne "1"
|
||||
? sub { die "error: " . $_[0]; } : sub { warn "warning: " . $_[0]; };
|
||||
&$f("unused option: $name\n") unless defined $config{$name};
|
||||
&$f("option not set correctly: $name (wanted '$answers{$name}', got '$config{$name}')\n")
|
||||
|
||||
Reference in New Issue
Block a user