summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/streamline_config.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/streamline_config.pl')
-rw-r--r--scripts/kconfig/streamline_config.pl63
1 files changed, 62 insertions, 1 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 233464185a92..9fa3f81b1ed9 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -45,7 +45,68 @@
my $config = ".config";
my $linuxpath = ".";
-open(CIN,$config) || die "Can't open current config file: $config";
+my $uname = `uname -r`;
+chomp $uname;
+
+my @searchconfigs = (
+ {
+ "file" => "/proc/config.gz",
+ "exec" => "zcat",
+ },
+ {
+ "file" => "/boot/vmlinuz-$uname",
+ "exec" => "scripts/extract-ikconfig",
+ "test" => "scripts/extract-ikconfig",
+ },
+ {
+ "file" => "vmlinux",
+ "exec" => "scripts/extract-ikconfig",
+ "test" => "scripts/extract-ikconfig",
+ },
+ {
+ "file" => "/lib/modules/$uname/kernel/kernel/configs.ko",
+ "exec" => "scripts/extract-ikconfig",
+ "test" => "scripts/extract-ikconfig",
+ },
+ {
+ "file" => "kernel/configs.ko",
+ "exec" => "scripts/extract-ikconfig",
+ "test" => "scripts/extract-ikconfig",
+ },
+ {
+ "file" => "kernel/configs.o",
+ "exec" => "scripts/extract-ikconfig",
+ "test" => "scripts/extract-ikconfig",
+ },
+ {
+ "file" => ".config",
+ "exec" => "cat",
+ },
+);
+
+sub find_config {
+ foreach my $conf (@searchconfigs) {
+ my $file = $conf->{"file"};
+
+ next if ( ! -f "$file");
+
+ if (defined($conf->{"test"})) {
+ `$conf->{"test"} $conf->{"file"} 2>/dev/null`;
+ next if ($?);
+ }
+
+ my $exec = $conf->{"exec"};
+
+ print STDERR "using config: '$file'\n";
+
+ open(CIN, "$exec $file |") || die "Failed to run $exec $file";
+ return;
+ }
+ die "No config file found";
+}
+
+find_config;
+
my @makefiles = `find $linuxpath -name Makefile`;
my %depends;
my %selects;