diff options
author | Matthieu Coudron <mattator@gmail.com> | 2018-01-29 03:50:18 +0900 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2018-02-07 10:07:13 +0900 |
commit | f620b1b693ec25af1aadcb0508710dc22e92453a (patch) | |
tree | 9b5260147aed77ad4e3696e1b0c400fbe95734fc /pkgs/os-specific/linux/kernel/generate-config.pl | |
parent | d80057f245e65e5ef07ec7e488941ac3d4fc3ee3 (diff) | |
download | nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.gz nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.bz2 nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.lz nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.xz nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.zst nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.zip |
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
Diffstat (limited to 'pkgs/os-specific/linux/kernel/generate-config.pl')
-rw-r--r-- | pkgs/os-specific/linux/kernel/generate-config.pl | 14 |
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") |