linux-kbuild.vger.kernel.org archive mirror
 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>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Theodore Tso <tytso@mit.edu>,
	Arjan van de Ven <arjan@infradead.org>, Greg KH <greg@kroah.com>,
	"Luis R. Rodriguez" <mcgrof@gmail.com>,
	zippel@linux-m68k.org, linux-kbuild@vger.kernel.org,
	Sam Ravnborg <sam@ravnborg.org>, Jonathan Corbet <corbet@lwn.net>,
	Alan Jenkins <sourcejedi.lkml@googlemail.com>,
	Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 10/14] kconfig: search for a config to base the local(mod|yes)config on
Date: Tue, 18 Aug 2009 22:56:44 -0400	[thread overview]
Message-ID: <20090819030038.750665213@goodmis.org> (raw)
In-Reply-To: 20090819025634.987354707@goodmis.org

[-- Attachment #1: 0010-kconfig-search-for-a-config-to-base-the-local-mod-ye.patch --]
[-- Type: text/plain, Size: 2524 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.

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.3.3

-- 

  parent reply	other threads:[~2009-08-19  3:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  2:56 [PATCH 00/14] kconfig: streamline distro configs for testers Steven Rostedt
2009-08-19  2:56 ` [PATCH 01/14] kconfig: add streamline_config.pl to scripts Steven Rostedt
2009-08-19  2:56 ` [PATCH 02/14] kconfig: make localmodconfig to run streamline_config.pl Steven Rostedt
2009-08-19  2:56 ` [PATCH 03/14] kconfig: add make localyesconfig option Steven Rostedt
2009-08-19  2:56 ` [PATCH 04/14] kconfig: streamline_config.pl do not stop with no depends Steven Rostedt
2009-08-19  2:56 ` [PATCH 05/14] kconfig: do not warn about modules built in Steven Rostedt
2009-08-19  2:56 ` [PATCH 06/14] kconfig: enable CONFIG_IKCONFIG from streamline_config.pl Steven Rostedt
2009-08-19  2:56 ` [PATCH 07/14] kconfig: add check if end exists in extract-ikconfig Steven Rostedt
2009-08-19  2:56 ` [PATCH 08/14] kconfig: have extract-ikconfig read ELF files Steven Rostedt
2009-08-19  2:56 ` [PATCH 09/14] kconfig: keep config.gz around even if CONFIG_IKCONFIG_PROC is not set Steven Rostedt
2009-08-19  2:56 ` Steven Rostedt [this message]
2009-08-19  2:56 ` [PATCH 11/14] kconfig: unset IKCONFIG_PROC and clean up nesting Steven Rostedt
2009-08-19  2:56 ` [PATCH 12/14] kconfig: test for /boot/config-uname after /proc/config.gz in localconfig Steven Rostedt
2009-08-19  2:56 ` [PATCH 13/14] kconfig: make local .config default for streamline_config Steven Rostedt
2009-08-19  2:56 ` [PATCH 14/14] kconfig: test if a .config already exists Steven Rostedt
2009-08-19 14:29 ` [PATCH 00/14] kconfig: streamline distro configs for testers Greg KH
2009-08-20 21:30 ` Andrew Morton
2009-08-20 21:43   ` Steven Rostedt
2009-08-20 22:13     ` Andrew Morton
2009-08-21 13:52       ` Ingo Molnar
2009-08-21 15:08         ` Steven Rostedt
2009-08-21 16:32           ` Ingo Molnar
2009-08-21 17:39             ` Steven Rostedt
2009-08-21 21:39   ` Sam Ravnborg
2009-08-21  9:21 ` Amerigo Wang
2009-08-21 14:35 ` Ingo Molnar
2009-08-21 14:50   ` Steven Rostedt
2009-08-21 14:54     ` Ingo Molnar
2009-08-21 16:03       ` Steven Rostedt
2009-08-21 16:05         ` Steven Rostedt
2009-08-21 16:28           ` Ingo Molnar
2009-08-21 16:55             ` Steven Rostedt
2009-08-21 19:51               ` Ingo Molnar
2009-08-21 20:12                 ` Steven Rostedt
2009-08-21 20:32                   ` Greg KH
2009-08-21 20:34                   ` Steven Rostedt
2009-08-21 20:39                     ` Ingo Molnar
2009-08-21 20:52                       ` Steven Rostedt
2009-08-21 21:02                         ` Ingo Molnar
2009-08-21 21:17                           ` Steven Rostedt
2009-08-21 16:52         ` [PATCH] kconfig: add missing dependency of conf to localyesconfig Steven Rostedt

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=20090819030038.750665213@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=corbet@lwn.net \
    --cc=greg@kroah.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@gmail.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=sourcejedi.lkml@googlemail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).