mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Arnaud Lacombe <lacombar@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: [PATCH 2/2] Enable 'make CONFIG_FOO=y oldconfig'
Date: Sun, 31 Jul 2011 00:14:29 +0100	[thread overview]
Message-ID: <1312067670.22074.61.camel@i7.infradead.org> (raw)
In-Reply-To: <1312067499.22074.59.camel@i7.infradead.org>

This allows you to set (and clear) config options on the make command
line, for all config targets. For example:

   make CONFIG_64BIT=n randconfig
   make CONFIG_64BIT=n allmodconfig
   make CONFIG_64BIT=y CONFIG_SATA_MV=y oldconfig

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
 scripts/kconfig/conf.c     |    7 ++++++-
 scripts/kconfig/confdata.c |   26 ++++++++++++++++++++++++++
 scripts/kconfig/lkc.h      |    1 +
 3 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 006ad81..2b91e3b 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -456,7 +456,7 @@ static struct option long_opts[] = {
 	{NULL, 0, NULL, 0}
 };
 
-int main(int ac, char **av)
+int main(int ac, char **av, char **ep)
 {
 	int opt;
 	const char *name;
@@ -563,6 +563,11 @@ int main(int ac, char **av)
 		break;
 	}
 
+	for ( ; *ep;  ep++) {
+		if (!strncmp(*ep, CONFIG_, strlen(CONFIG_)))
+			conf_set_symbol_from_env(*ep);
+	}
+
 	if (sync_kconfig) {
 		if (conf_get_changed()) {
 			name = getenv("KCONFIG_NOSILENTUPDATE");
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index a518ab3..c64eb33 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -342,6 +342,32 @@ setsym:
 	return 0;
 }
 
+void conf_set_symbol_from_env(char *str)
+{
+	char *p = strchr(str, '=');
+	struct symbol *sym;
+	int def = S_DEF_USER;
+	int def_flags = SYMBOL_DEF << def;
+
+	if (!p)
+		return;
+
+	*p = 0;
+	sym = sym_find(str + strlen(CONFIG_));
+	*p++ = '=';
+
+	if (!sym)
+		return;
+
+	sym_calc_value(sym);
+	if (!sym_set_string_value(sym, p))
+		return;
+
+	conf_message(CONFIG_ "%s set to %s from environment", sym->name, p);
+	if (sym_is_choice_value(sym))
+		conf_validate_choice_val(sym, def, def_flags);
+}
+
 int conf_read(const char *name)
 {
 	struct symbol *sym, *choice_sym;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index f34a0a9..fc2f3ad 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -89,6 +89,7 @@ char *conf_get_default_confname(void);
 void sym_set_change_count(int count);
 void sym_add_change_count(int count);
 void conf_set_all_new_symbols(enum conf_def_mode mode);
+void conf_set_symbol_from_env(char *);
 
 /* confdata.c and expr.c */
 static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
-- 
1.7.6




  parent reply	other threads:[~2011-07-30 23:14 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1312067499.22074.59.camel@i7.infradead.org>
2011-07-30 23:13 ` [PATCH 1/2] kconfig: Factor out conf_validate_choice_val() function from conf_read_simple() David Woodhouse
2011-07-31  2:17   ` Arnaud Lacombe
2011-07-31 22:21     ` David Woodhouse
2011-07-30 23:14 ` David Woodhouse [this message]
2011-07-30 23:44   ` [PATCH 2/2] Enable 'make CONFIG_FOO=y oldconfig' Arnaud Lacombe
2011-07-30 23:53     ` H. Peter Anvin
2011-07-31  0:05       ` Arnaud Lacombe
2011-07-31  0:29         ` H. Peter Anvin
2011-07-31  1:06           ` Arnaud Lacombe
2011-07-31  1:28             ` H. Peter Anvin
2011-07-31  2:09               ` Arnaud Lacombe
2011-07-31  5:21                 ` Arnaud Lacombe
2011-07-31 22:18                 ` David Woodhouse
2011-08-09 15:22                   ` Arnaud Lacombe
2011-07-31  7:33             ` David Woodhouse
2011-07-31 16:37               ` Randy Dunlap
2011-07-31 16:57                 ` David Woodhouse
2011-07-31 17:08                   ` Randy Dunlap
2011-07-31 17:40                     ` David Woodhouse
2011-08-09 14:14         ` Michal Marek
2011-08-09 15:26           ` Arnaud Lacombe
2011-08-10 12:59             ` Michal Marek
2011-08-10 13:07               ` David Woodhouse
2011-08-10 14:15                 ` Arnaud Lacombe
2011-08-10 14:17                   ` David Woodhouse
2011-08-10 14:34                     ` Arnaud Lacombe
2011-08-10 16:33                       ` David Woodhouse
2011-08-10 17:00                         ` Emmanuel Deloget
2011-08-10 17:52                           ` H. Peter Anvin
2011-08-10 17:44                         ` Arnaud Lacombe
2011-08-10 17:54                           ` H. Peter Anvin
2011-08-10 17:59                           ` David Woodhouse
2011-08-10 18:40                             ` Arnaud Lacombe
2011-08-10 18:52                               ` David Woodhouse
2011-08-10 22:33                                 ` Arnaud Lacombe
2011-08-10 23:16                                   ` David Woodhouse
2011-08-11  3:29                                     ` Arnaud Lacombe
2011-08-11  8:42                                       ` David Woodhouse
2011-08-11  8:58                                         ` Michal Marek
2011-08-11 11:10                                           ` David Woodhouse
2011-08-11 11:15                                             ` Andreas Schwab
2011-08-11 11:40                                               ` David Woodhouse
2011-08-11 11:56                                                 ` Michal Marek
2011-08-11 13:20                                                   ` David Woodhouse
2011-08-11 14:57                                                   ` Arnaud Lacombe
2011-08-11 15:07                                                     ` David Woodhouse
2011-08-11 15:24                                                       ` Michal Marek
2011-08-11 15:50                                                         ` David Woodhouse
2011-08-10 17:01                   ` Randy Dunlap
2011-08-10 17:25                     ` David Woodhouse

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=1312067670.22074.61.camel@i7.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®