Re: kconfig frontend updates

Previous thread: [git head] Should X86_PAT really default to yes? by Frans Pop on Friday, May 2, 2008 - 12:22 pm. (34 messages)

Next thread: [PATCH] md: fix raid5 'repair' operations by Dan Williams on Friday, May 2, 2008 - 2:27 pm. (1 message)
From: Sam Ravnborg
Date: Friday, May 2, 2008 - 1:47 pm

The following patchset implments the following:

o Inputfiles to all*config can be specified with K=
o less chatty oldconfig mode
o Drop useless warnings

This is work-in-progress aimed for next mergewindow.
Posted here mainly to get some feedback and a
bit of review.

Patches follows to lkml + kbuild lists

	Sam
--

From: sam
Date: Friday, May 2, 2008 - 1:49 pm

From: Sam Ravnborg <sam@uranus.ravnborg.org>

Input file to all*config, randconfig and defconfig can
be specified using the environment variable 'K'.
It is expected to be used like this:

make K=my_config alldefconfig

This replaces the KCONFIL_ALLCONFIG support
and the input files named: all*.config

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/Makefile |   31 ++---
 scripts/kconfig/aconf.c  |  316 ++++++++++++++++++++++++++++++++++++++++++++++
 scripts/kconfig/aconf.sh |   30 +++++
 3 files changed, 360 insertions(+), 17 deletions(-)
 create mode 100644 scripts/kconfig/aconf.c
 create mode 100755 scripts/kconfig/aconf.sh

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index fa1a7d5..3e560a4 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -47,30 +47,25 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
 	$(Q)rm -f arch/um/Kconfig.arch
 	$(Q)rm -f $(obj)/config.pot
 
-PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
+aconf-targets := allnoconfig allyesconfig allmodconfig alldefconfig randconfig
+PHONY += $(aconf-targets) defconfig
 
-randconfig: $(obj)/conf
-	$< -r $(Kconfig)
+$(aconf-targets): $(src)/aconf.sh $(obj)/aconf
+	$(Q)$(CONFIG_SHELL) $< $@ $(Kconfig)
 
-allyesconfig: $(obj)/conf
-	$< -y $(Kconfig)
+%_defconfig: $(src)/aconf.sh $(obj)/aconf
+	$(Q)K=arch/$(SRCARCH)/configs/$@ \
+	$(CONFIG_SHELL) $< alldefconfig $(Kconfig)
 
-allnoconfig: $(obj)/conf
-	$< -n $(Kconfig)
-
-allmodconfig: $(obj)/conf
-	$< -m $(Kconfig)
-
-defconfig: $(obj)/conf
 ifeq ($(KBUILD_DEFCONFIG),)
+defconfig: $(obj)/conf
 	$< -d $(Kconfig)
 else
-	@echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
-	$(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
+defconfig: $(src)/aconf.sh $(obj)/aconf
+	$(Q)K=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) \
+	$(CONFIG_SHELL) $< alldefconfig $(Kconfig)
 endif
 
-%_defconfig: $(obj)/conf
-	$(Q)$< -D ...
From: sam
Date: Friday, May 2, 2008 - 1:49 pm

From: Sam Ravnborg <sam@uranus.ravnborg.org>

With the introduction of aconf we can now kill all
the old all*config support code in conf.c
Modified Makefile so defconfig is now handled by
aconf always.
This removed the feature that kconfig could look
up a default configuration in one of the files listed
in DEFCONFIG_LIST.
But this was only used by archs that did not define
KBUILD_DEFCONFIG so no harm done.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/Makefile |   12 ++--
 scripts/kconfig/conf.c   |  128 +---------------------------------------------
 2 files changed, 7 insertions(+), 133 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 3e560a4..47d5df8 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -57,14 +57,14 @@ $(aconf-targets): $(src)/aconf.sh $(obj)/aconf
 	$(Q)K=arch/$(SRCARCH)/configs/$@ \
 	$(CONFIG_SHELL) $< alldefconfig $(Kconfig)
 
-ifeq ($(KBUILD_DEFCONFIG),)
-defconfig: $(obj)/conf
-	$< -d $(Kconfig)
-else
+defconfig-file := $(if $(KBUILD_DEFCONFIG),            \
+        arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG),   \
+        arch/$(SRCARCH)/defconfig)
+defconfig-file := $(strip $(defconfig-file))
+
 defconfig: $(src)/aconf.sh $(obj)/aconf
-	$(Q)K=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) \
+	$(Q)K=$(defconfig-file) \
 	$(CONFIG_SHELL) $< alldefconfig $(Kconfig)
-endif
 
 
 # Help text used by make help
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index fda6313..7aabe0b 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -22,13 +22,7 @@ enum {
 	ask_all,
 	ask_new,
 	ask_silent,
-	set_default,
-	set_yes,
-	set_mod,
-	set_no,
-	set_random
 } input_mode = ask_all;
-char *defconfig_file;
 
 static int indent = 1;
 static int valid_stdin = 1;
@@ -76,7 +70,6 @@ static void check_stdin(void)
 static int conf_askvalue(struct symbol *sym, const char *def)
 {
 	enum symbol_type type = sym_get_type(sym);
-	tristate val;
 ...
From: sam
Date: Friday, May 2, 2008 - 1:49 pm

From: Sam Ravnborg <sam@uranus.ravnborg.org>

No one really used the output generated during a
oldconfig run. So drop it and behave like the
old 'silentoldconfig' always did.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile                 |    2 +-
 scripts/kconfig/Makefile |    5 +----
 scripts/kconfig/conf.c   |   42 ++++++++++++++----------------------------
 3 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index d3634cd..99fcf12 100644
--- a/Makefile
+++ b/Makefile
@@ -473,7 +473,7 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
 # we execute the config step to be sure to catch updated Kconfig files
 include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
-	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
+	$(Q)$(MAKE) -f $(srctree)/Makefile oldconfig
 else
 # external modules needs include/linux/autoconf.h and include/config/auto.conf
 # but do not care if they are up-to-date. Use auto.conf to trigger the test
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 47d5df8..1ccd584 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -18,12 +18,9 @@ menuconfig: $(obj)/mconf
 config: $(obj)/conf
 	$< $(Kconfig)
 
-oldconfig: $(obj)/conf
+oldconfig silentoldconfig: $(obj)/conf
 	$< -o $(Kconfig)
 
-silentoldconfig: $(obj)/conf
-	$< -s $(Kconfig)
-
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
 # The symlink is used to repair a deficiency in arch/um
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 7aabe0b..263165d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -21,7 +21,6 @@ static void check_conf(struct menu *menu);
 enum {
 	ask_all,
 	ask_new,
-	ask_silent,
 } input_mode = ask_all;
 
 static int indent = 1;
@@ -59,12 +58,12 @@ static void strip(char *str)
 
 static void ...
From: sam
Date: Friday, May 2, 2008 - 1:49 pm

From: Sam Ravnborg <sam@uranus.ravnborg.org>

---
 scripts/kconfig/.gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore
index b49584c..ae664f9 100644
--- a/scripts/kconfig/.gitignore
+++ b/scripts/kconfig/.gitignore
@@ -13,6 +13,7 @@ lkc_defs.h
 # configuration programs
 #
 conf
+aconf
 mconf
 qconf
 gconf
-- 
1.5.4.1.143.ge7e51

--

From: sam
Date: Friday, May 2, 2008 - 1:49 pm

From: Sam Ravnborg <sam@uranus.ravnborg.org>

The warning is only annoying and not used.
So drop it.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/confdata.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index ee5fe94..ea44754 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -222,10 +222,8 @@ load:
 				continue;
 			if (def == S_DEF_USER) {
 				sym = sym_find(line + 9);
-				if (!sym) {
-					conf_warning("trying to assign nonexistent symbol %s", line + 9);
+				if (!sym)
 					break;
-				}
 			} else {
 				sym = sym_lookup(line + 9, 0);
 				if (sym->type == S_UNKNOWN)
@@ -261,10 +259,8 @@ load:
 			}
 			if (def == S_DEF_USER) {
 				sym = sym_find(line + 7);
-				if (!sym) {
-					conf_warning("trying to assign nonexistent symbol %s", line + 7);
+				if (!sym)
 					break;
-				}
 			} else {
 				sym = sym_lookup(line + 7, 0);
 				if (sym->type == S_UNKNOWN)
-- 
1.5.4.1.143.ge7e51

--

From: Sam Ravnborg
Date: Friday, May 2, 2008 - 2:01 pm

git added a bad email address in cc:
Just ignore the error or edit away the
"sam@uranus.ravnborg.org" address.

git config is fixed so it should not happen again.

	Sam
--

From: Sam Ravnborg
Date: Sunday, May 4, 2008 - 11:57 am

New set of patches (2) will follow.
The warning "trying to assign nonexistent symbol" remains for now.
I do not want to mix the two things.

The patches are also pushed to kbuild.git so they
will appear in -next and -mm.
Let's see how many scripts will break due to this ;-)

Comments /testing welcome.

	Sam
--

From: Sam Ravnborg
Date: Sunday, May 4, 2008 - 11:59 am

From 9122065d7fe0c8a9823794e91b16b2493122df80 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sun, 4 May 2008 20:32:11 +0200
Subject: [PATCH] kconfig: introduce K= support

The base configuration can now be specified for
the targets: randconfig, all*config using following syntax:

   make K=base-config allnoconfig

The configuration will be based on the file base-config.

Also add a new target: alldefconfig
   alldefconfig will set all values to default vaules.

Make defconfig has changed such that it only searches
KBUILD_DEFCONFIG or arch/$ARCH/defconfig for the
baseconfig.

The verbose output generated as part of an
randconfig, all*config build has been dropped.

To implement this a new program 'aconf' is used which
is based on conf.c.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 README                     |   28 ++--
 scripts/kconfig/.gitignore |    1 +
 scripts/kconfig/Makefile   |   72 ++++++-----
 scripts/kconfig/aconf.c    |  317 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 374 insertions(+), 44 deletions(-)
 create mode 100644 scripts/kconfig/aconf.c

diff --git a/README b/README
index 159912c..f31f19b 100644
--- a/README
+++ b/README
@@ -171,11 +171,9 @@ CONFIGURING the kernel:
 	"make oldconfig"   Default all questions based on the contents of
 			   your existing ./.config file and asking about
 			   new config symbols.
-	"make silentoldconfig"
-			   Like above, but avoids cluttering the screen
-			   with questions already answered.
-	"make defconfig"   Create a ./.config file by using the default
-			   symbol values from arch/$ARCH/defconfig.
+	"make defconfig"   Create a ./.config file by using the base
+			   configuration found in the file specified by
+			   the environment variable KBUILD_DEFCONFIG.
 	"make allyesconfig"
 			   Create a ./.config file by setting symbol
 			   values to 'y' as much as possible.
@@ -184,17 +182,21 @@ CONFIGURING the kernel:
 			   values to 'm' as much as ...
From: Roman Zippel
Date: Monday, May 5, 2008 - 7:55 pm

Hi,

On Sun, 4 May 2008, Sam Ravnborg wrote:

Below is patch which adds a library function to set the default values in 
a much simpler way.
The behaviour is slightly different, now it's closer to generating a 
.config with all possible symbols set to some value and using that to 
generate the final config. It has the advantage of not being as dependend 
on the order of the symbols, e.g. with allmodconfig this sets a few more 


Even if it has only a single option, please keep using getopt().

bye, Roman


[PATCH] set all new symbols automatically

Add conf_set_all_new_symbols() which set all symbols (which don't have a 
value yet) to a specifed value.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---
 scripts/kconfig/confdata.c |   72 ++++++++++++++++++++++++++++++++++++++++++++-
 scripts/kconfig/lkc.h      |    9 +++++
 2 files changed, 80 insertions(+), 1 deletion(-)

Index: linux-2.6/scripts/kconfig/confdata.c
===================================================================
--- linux-2.6.orig/scripts/kconfig/confdata.c
+++ linux-2.6/scripts/kconfig/confdata.c
@@ -510,7 +510,7 @@ int conf_write(const char *name)
 			case S_HEX:
 				str = sym_get_string_value(sym);
 				if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
-					fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
+					fprintf(out, "CONFIG_%s=0x%s\n", sym->name, str);
 					break;
 				}
 			case S_INT:
@@ -812,3 +812,73 @@ void conf_set_changed_callback(void (*fn
 {
 	conf_changed_callback = fn;
 }
+
+
+void conf_set_all_new_symbols(enum conf_def_mode mode)
+{
+	struct symbol *sym, *csym;
+	struct property *prop;
+	struct expr *e;
+	int i, cnt, def;
+
+	for_all_symbols(i, sym) {
+		if (sym_has_value(sym))
+			continue;
+		switch (sym_get_type(sym)) {
+		case S_BOOLEAN:
+		case S_TRISTATE:
+			switch (mode) {
+			case def_yes:
+				sym->def[S_DEF_USER].tri = yes;
+				break;
+			case def_mod:
+				sym->def[S_DEF_USER].tri = mod;
+				break;
+			case ...
From: Sam Ravnborg
Date: Monday, May 5, 2008 - 9:34 pm

The plan is to drop arch/$(SRCARCH)/defconfig and solely rely
on KBUILD_DEFCONFIG.
And I see KBUILD_DEFCONFIG thus for a "make defconfig" the
DEFCONFIG_LIST becomes unused.

But I guess your point is that we should dropt KBUILD_DEFCONFIG
entirely and rely on DEFCONFIG_LIST instead.


OK.

Thanks for your feedback.
PS. I will post the updated patches in the weekend. Not that they
are difficult but I'm on the way out of the door for a few days
travelling.

	Sam
--

From: Sam Ravnborg
Date: Sunday, May 4, 2008 - 11:59 am

From 48ff933e08c7c5b625a82ffdae5ece9c0f4e0a87 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sun, 4 May 2008 20:50:14 +0200
Subject: [PATCH] kconfig: make oldconfig less chatty and clean up conf.c

Moving randconfg, all*config support to aconf.c
allowed conf.c to be cleaned up.
While cleaning up conf.c the chatty oldconfig mode
was killed and conf.c is now only used for two purposes:

make config:
	Interactively ask for each config option

make oldconfig
	Interactively ask for each new config option

We now check for valid stadin in both cases and this
may break a script here and there.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile                 |    2 +-
 scripts/kconfig/Makefile |    5 +-
 scripts/kconfig/conf.c   |  168 ++++------------------------------------------
 3 files changed, 16 insertions(+), 159 deletions(-)

diff --git a/Makefile b/Makefile
index 4492984..1e91804 100644
--- a/Makefile
+++ b/Makefile
@@ -473,7 +473,7 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
 # we execute the config step to be sure to catch updated Kconfig files
 include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
-	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
+	$(Q)$(MAKE) -f $(srctree)/Makefile oldconfig
 else
 # external modules needs include/linux/autoconf.h and include/config/auto.conf
 # but do not care if they are up-to-date. Use auto.conf to trigger the test
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 70b329d..fa4f746 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -18,12 +18,9 @@ menuconfig: $(obj)/mconf
 config: $(obj)/conf
 	$< $(Kconfig)
 
-oldconfig: $(obj)/conf
+oldconfig silentoldconfig: $(obj)/conf
 	$< -o $(Kconfig)
 
-silentoldconfig: $(obj)/conf
-	$< -s $(Kconfig)
-
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig ...
From: Roman Zippel
Date: Monday, May 5, 2008 - 8:08 pm

Hi,


I strongly disagree with this, please preserve the old behaviour. It took 
a while to work out the current behaviour.
Only silentoldconfig checks for stdin because it's used as hook during 
kbuild to verify the config. For all other interactive targets the user 
has to know what he's doing, e.g. it's valid to do "yes '' | make 

This isn't yet in aconf.c.

bye, Roman
--

From: Sam Ravnborg
Date: Monday, May 5, 2008 - 9:37 pm

I will test a bit more and may revert to the old behaviour.
One good thing with the new behaviour is that
make oldconfig > /dev/null
does not hang if there is new symbols - and I would like to keep
On purpose. It is very very seldom used and with K=file
it is now much easier to specify a base configuration.
So no need for all the special filenames.

	Sam
--

From: Jan Engelhardt
Date: Tuesday, May 6, 2008 - 2:03 am

Noting that `yes | make oldconfig` is often not the right thing anyway
(you want modules most of the time) or does not even work (things
that can only be modules [M/n] cannot take y).

--

Previous thread: [git head] Should X86_PAT really default to yes? by Frans Pop on Friday, May 2, 2008 - 12:22 pm. (34 messages)

Next thread: [PATCH] md: fix raid5 'repair' operations by Dan Williams on Friday, May 2, 2008 - 2:27 pm. (1 message)