diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-04-30 14:39:48 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-08-18 22:02:00 -0400 |
commit | cdfc47950a531199a553cebab0ac481aa7062948 (patch) | |
tree | 23a1dfc287c61144ef3a7fcf83980a8fa50831f6 | |
parent | de481560eb0bd9d940b90311eba85711e4b1150b (diff) |
kconfig: search for a config to base the local(mod|yes)config on
Instead of using the .config in the local directory. This patch
changes streamline_config.pl to search various locations for a config.
Here's the list and order of search:
/proc/config.gz
/boot/vmlinuz-`uname -r`
vmlinux # local to the directory
/lib/modules/`uname -r`/kernel/kernel/configs.ko
kernel/configs.ko
kernel/configs.o
.config
Once it finds a file that contains a config (it checks if the binary
objects have configs first) it then uses it to create the .config
with minimum modules needed.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | scripts/kconfig/streamline_config.pl | 63 |
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 @@ | |||
45 | my $config = ".config"; | 45 | my $config = ".config"; |
46 | my $linuxpath = "."; | 46 | my $linuxpath = "."; |
47 | 47 | ||
48 | open(CIN,$config) || die "Can't open current config file: $config"; | 48 | my $uname = `uname -r`; |
49 | chomp $uname; | ||
50 | |||
51 | my @searchconfigs = ( | ||
52 | { | ||
53 | "file" => "/proc/config.gz", | ||
54 | "exec" => "zcat", | ||
55 | }, | ||
56 | { | ||
57 | "file" => "/boot/vmlinuz-$uname", | ||
58 | "exec" => "scripts/extract-ikconfig", | ||
59 | "test" => "scripts/extract-ikconfig", | ||
60 | }, | ||
61 | { | ||
62 | "file" => "vmlinux", | ||
63 | "exec" => "scripts/extract-ikconfig", | ||
64 | "test" => "scripts/extract-ikconfig", | ||
65 | }, | ||
66 | { | ||
67 | "file" => "/lib/modules/$uname/kernel/kernel/configs.ko", | ||
68 | "exec" => "scripts/extract-ikconfig", | ||
69 | "test" => "scripts/extract-ikconfig", | ||
70 | }, | ||
71 | { | ||
72 | "file" => "kernel/configs.ko", | ||
73 | "exec" => "scripts/extract-ikconfig", | ||
74 | "test" => "scripts/extract-ikconfig", | ||
75 | }, | ||
76 | { | ||
77 | "file" => "kernel/configs.o", | ||
78 | "exec" => "scripts/extract-ikconfig", | ||
79 | "test" => "scripts/extract-ikconfig", | ||
80 | }, | ||
81 | { | ||
82 | "file" => ".config", | ||
83 | "exec" => "cat", | ||
84 | }, | ||
85 | ); | ||
86 | |||
87 | sub find_config { | ||
88 | foreach my $conf (@searchconfigs) { | ||
89 | my $file = $conf->{"file"}; | ||
90 | |||
91 | next if ( ! -f "$file"); | ||
92 | |||
93 | if (defined($conf->{"test"})) { | ||
94 | `$conf->{"test"} $conf->{"file"} 2>/dev/null`; | ||
95 | next if ($?); | ||
96 | } | ||
97 | |||
98 | my $exec = $conf->{"exec"}; | ||
99 | |||
100 | print STDERR "using config: '$file'\n"; | ||
101 | |||
102 | open(CIN, "$exec $file |") || die "Failed to run $exec $file"; | ||
103 | return; | ||
104 | } | ||
105 | die "No config file found"; | ||
106 | } | ||
107 | |||
108 | find_config; | ||
109 | |||
49 | my @makefiles = `find $linuxpath -name Makefile`; | 110 | my @makefiles = `find $linuxpath -name Makefile`; |
50 | my %depends; | 111 | my %depends; |
51 | my %selects; | 112 | my %selects; |