summary refs log tree commit diff
path: root/pkgs/os-specific/linux/kernel/generate-config.pl
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/kernel/generate-config.pl')
-rw-r--r--pkgs/os-specific/linux/kernel/generate-config.pl14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl
index 5bce3af9429..f886fcfdc35 100644
--- a/pkgs/os-specific/linux/kernel/generate-config.pl
+++ b/pkgs/os-specific/linux/kernel/generate-config.pl
@@ -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")