All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Theodore Tso <tytso@mit.edu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	zippel@linux-m68k.org, linux-kbuild@vger.kernel.org,
	Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 7/7] kconfig: search for a config to base the local(mod|yes)config on
Date: Thu, 30 Apr 2009 14:50:29 -0400	[thread overview]
Message-ID: <20090430185223.792841532@goodmis.org> (raw)
In-Reply-To: 20090430185022.122124349@goodmis.org

[-- Attachment #1: 0007-kconfig-search-for-a-config-to-base-the-local-mod-y.patch --]
[-- Type: text/plain, Size: 2567 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

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.

[ Impact: use mostly the current config ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 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 2334641..9fa3f81 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;
-- 
1.6.2.1

-- 

  parent reply	other threads:[~2009-04-30 18:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 18:50 [PATCH 0/7] kconfig: more featured minimum module configs Steven Rostedt
2009-04-30 18:50 ` [PATCH 1/7] kconfig: streamline_config.pl do not stop with no depends Steven Rostedt
2009-04-30 18:50 ` [PATCH 2/7] kconfig: do not warn about modules built in Steven Rostedt
2009-04-30 18:50 ` [PATCH 3/7] kconfig: enable CONFIG_IKCONFIG from streamline_config.pl Steven Rostedt
2009-04-30 21:51   ` Alan Jenkins
2009-04-30 21:51     ` Alan Jenkins
2009-04-30 22:53     ` Steven Rostedt
2009-04-30 22:53       ` Steven Rostedt
2009-04-30 18:50 ` [PATCH 4/7] kconfig: add check if end exists in extract-ikconfig Steven Rostedt
2009-04-30 18:50 ` [PATCH 5/7] kconfig: have extract-ikconfig read ELF files Steven Rostedt
2009-04-30 18:50 ` [PATCH 6/7] kconfig: keep config.gz around even if CONFIG_IKCONFIG_PROC is not set Steven Rostedt
2009-04-30 18:50 ` Steven Rostedt [this message]
2009-04-30 22:04   ` [PATCH 7/7] kconfig: search for a config to base the local(mod|yes)config on Alan Jenkins
2009-04-30 22:04     ` Alan Jenkins
2009-04-30 22:54     ` Steven Rostedt
2009-04-30 22:54       ` Steven Rostedt
2009-05-04 12:15   ` Andi Kleen
2009-05-04 12:28     ` Peter Zijlstra
2009-05-04 14:46       ` Steven Rostedt
2009-05-04 14:59       ` Andi Kleen
2009-04-30 19:10 ` [PATCH 0/7] kconfig: more featured minimum module configs Ingo Molnar
2009-04-30 22:55   ` Steven Rostedt
2009-05-01 12:01     ` Ingo Molnar
2009-05-01 23:27       ` Steven Rostedt
2009-05-06 12:15         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090430185223.792841532@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.