Skip to contentSkip to conversation

multiple CONFIG y/m/n

RFC/POC In review Randy.Dunlap 5 participants 13 messages Apr 7, 2006 – Apr 12, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

In doing lots of kernel build testing, I often want to enable all options in a sub-menu and their sub-sub-menus. Sound is one of the worst^W longest of these, so I chose a shorter (easier) one to practice on: parport.

For PARPORT, this isn't terribly needed; it's just being a guinea pig for me. The point is to be able to enable all applicable options at one time (one line or one click).

So if no (top-level of a CONFIG, like CONFIG_PARPORT) options are enabled, you can step thru the entire menu and sub-menus, taking a few minutes sometimes (see SOUND or USB), or the kconfig system could enable some way to do this for us. For version 1, all that I have done is modify driver/parport/Kconfig -- no code changes. I haven't even looked at the source code to see if that would be the right thing to do. I'm just taken liberties with the famous Kconfig "select" to make it work.

I can already see that I find this useful, but is there a good (better) way to implement this in kconfig?

As it is here, PARPORT_ENABLE_ALL tracks PARPORT (y/m/n) when the former is enabled/configured. The downside of this Kconfig usage is that almost all lines of "depends" are duplicated as "select" (and that it uses "select"). It would be good if there was some way to automate this.

Comments?
---
~Randy

---
 drivers/parport/Kconfig |   17 +++++++++++++++++
 1 files changed, 17 insertions(+)
drivers/parport/Kconfig +17 -0
@@ -151,5 +151,22 @@ config PARPORT_1284
 	  transfer modes. Also say Y if you want device ID information to
 	  appear in /proc/sys/dev/parport/*/autoprobe*. It is safe to say N.
 
+config PARPORT_ENABLE_ALL
+	tristate "Enable all (non-BROKEN) PARPORT options"
+	depends on PARPORT
+	select PARPORT_PC if (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV
+	select PARPORT_SERIAL if SERIAL_8250 && PARPORT_PC && PCI
+	select PARPORT_PC_FIFO if PARPORT_PC && EXPERIMENTAL
+	select PARPORT_PC_SUPERIO if PARPORT_PC && EXPERIMENTAL
+	select PARPORT_PC_PCMCIA if PCMCIA && PARPORT_PC
+	select PARPORT_ARC if ARM && PARPORT
+	select PARPORT_IP32 if SGI_IP32 && PARPORT && EXPERIMENTAL
+	select PARPORT_AMIGA if AMIGA && PARPORT
+	select PARPORT_MFC3 if ZORRO && PARPORT
+	select PARPORT_ATARI if ATARI && PARPORT
+	select PARPORT_GSC if PARPORT && GSC
+	select PARPORT_SUNBPP if SBUS && PARPORT && EXPERIMENTAL
+	select PARPORT_1284 if PARPORT
+
 endmenu
 
#1 lore raw
Quoted 6 lines · Randy.Dunlap

As it is here, PARPORT_ENABLE_ALL tracks PARPORT (y/m/n) when the former is enabled/configured. The downside of this Kconfig usage is that almost all lines of "depends" are duplicated as "select" (and that it uses "select"). It would be good if there was some way to automate this.

Comments?

Umm... Oh, how about the following? It seems work...

	$ perl -spi -e 's/CONFIG_SND.*//' .config
        $ KCONFIG_ALLCONFIG=.config make allmodconfig or allyesconfig

Thanks.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#2 lore raw
Quoted 7 lines · On Sat, 08 Apr 2006 00:04:26 +0900 OGAWA Hirofumi wrote:
Quoted 5 lines · Randy.Dunlap

As it is here, PARPORT_ENABLE_ALL tracks PARPORT (y/m/n) when the former is enabled/configured. The downside of this Kconfig usage is that almost all lines of "depends" are duplicated as "select" (and that it uses "select"). It would be good if there was some way to automate this.

Quoted 6 lines
Quoted 1 line

Comments?

Umm... Oh, how about the following? It seems work...

	$ perl -spi -e 's/CONFIG_SND.*//' .config
	$ KCONFIG_ALLCONFIG=.config make allmodconfig or allyesconfig

Yes, that seems to do what I want to do.

Very nice, thanks.

---
~Randy

#3 lore raw
In reply to OGAWA Hirofumi
Quoted 8 lines · On Sat, 08 Apr 2006 00:04:26 +0900 OGAWA Hirofumi wrote:
Quoted 1 line · Randy.Dunlap

Comments?

Umm... Oh, how about the following? It seems work...

	$ perl -spi -e 's/CONFIG_SND.*//' .config
        $ KCONFIG_ALLCONFIG=.config make allmodconfig or allyesconfig

Hrm, that points out a lack of documentation for this feature.

Would the kconfig/kbuild people prefer this documentation in the source code (see below) or in Documentation/kbuild/somefile ?

---

---
 scripts/kconfig/conf.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
scripts/kconfig/conf.c +20 -2
@@ -504,6 +504,24 @@ static void check_conf(struct menu *menu
 		check_conf(child);
 }
 
+void usage(char *progname)
+{
+	printf("%s [-o|-s|-d|-D|-n|-m|-y|-r] Kconfig_filename\n", progname);
+	printf("  -o: oldconfig: ask only about new config symbols\n");
+	printf("  -s: silentoldconfig: don't ask about any symbol values\n");
+	printf("  -d: defconfig: use default symbol values\n");
+	printf("  -D: use default symbol values from the specified config file\n");
+	printf("  -n: set unknown symbol values to 'n'\n");
+	printf("  -m: set unknown symbol values to 'm'\n");
+	printf("  -y: set unknown symbol values to 'y'\n");
+	printf("  -r: set unknown symbol values randomly to one of y/m/n\n");
+	printf("The n/m/y/r options can also use the environment variable KCONFIG_ALLCONFIG\n");
+	printf("  to specify a filename that contains config options that are\n");
+	printf("  to be set to a specific value.  Otherwise config checks for\n");
+	printf("  all{no,mod,yes,random}.config and all.config\n");
+	exit(0);
+}
+
 int main(int ac, char **av)
 {
 	int i = 1;
@@ -546,8 +564,8 @@ int main(int ac, char **av)
 			break;
 		case 'h':
 		case '?':
-			printf("%s [-o|-s] config\n", av[0]);
-			exit(0);
+			usage(av[0]);
+			break;
 		}
 	}
   	name = av[i];
#4 lore raw

Hi,

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 509

Quoted 3 lines · Randy.Dunlap
scripts/kconfig/conf.c +3 -0
+void usage(char *progname)
+{
+	printf("%s [-o|-s|-d|-D|-n|-m|-y|-r] Kconfig_filename\n", progname);

|-D <config>|

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 511

Quoted 2 lines
scripts/kconfig/conf.c +2 -0
+	printf("  -o: oldconfig: ask only about new config symbols\n");
+	printf("  -s: silentoldconfig: don't ask about any symbol values\n");

It does ask about them, but suppresses a lot of prints.

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 512

Quoted 1 line
scripts/kconfig/conf.c +1 -0
+	printf("  -d: defconfig: use default symbol values\n");

To be precise it uses arch/$ARCH/defconfig as default values.

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 516

Quoted 3 lines
scripts/kconfig/conf.c +3 -0
+	printf("  -n: set unknown symbol values to 'n'\n");
+	printf("  -m: set unknown symbol values to 'm'\n");
+	printf("  -y: set unknown symbol values to 'y'\n");

It actually tries to set all values to n/m/y.

scripts/kconfig/conf.c int main(int ac, char **av) · line 568

Quoted 8 lines
scripts/kconfig/conf.c +2 -2
@@ -546,8 +564,8 @@ int main(int ac, char **av)
 			break;
 		case 'h':
 		case '?':
-			printf("%s [-o|-s] config\n", av[0]);
-			exit(0);
+			usage(av[0]);
+			break;

That's indeed a little obsolete. :-)

bye, Roman

#5 lore raw
Quoted 25 lines · On Wed, 12 Apr 2006 13:00:22 +0200 (CEST) Roman Zippel wrote:

Hi,

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 509

Quoted 3 lines · Randy.Dunlap
scripts/kconfig/conf.c +3 -0
+void usage(char *progname)
+{
+	printf("%s [-o|-s|-d|-D|-n|-m|-y|-r] Kconfig_filename\n", progname);

|-D <config>|

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 511

Quoted 2 lines
scripts/kconfig/conf.c +2 -0
+	printf("  -o: oldconfig: ask only about new config symbols\n");
+	printf("  -s: silentoldconfig: don't ask about any symbol values\n");

It does ask about them, but suppresses a lot of prints.

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 512

Quoted 1 line
scripts/kconfig/conf.c +1 -0
+	printf("  -d: defconfig: use default symbol values\n");

To be precise it uses arch/$ARCH/defconfig as default values.

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 516

Quoted 3 lines
scripts/kconfig/conf.c +3 -0
+	printf("  -n: set unknown symbol values to 'n'\n");
+	printf("  -m: set unknown symbol values to 'm'\n");
+	printf("  -y: set unknown symbol values to 'y'\n");

It actually tries to set all values to n/m/y.

Quoted 10 lines

scripts/kconfig/conf.c int main(int ac, char **av) · line 568

Quoted 8 lines
scripts/kconfig/conf.c +2 -2
@@ -546,8 +564,8 @@ int main(int ac, char **av)
 			break;
 		case 'h':
 		case '?':
-			printf("%s [-o|-s] config\n", av[0]);
-			exit(0);
+			usage(av[0]);
+			break;

That's indeed a little obsolete. :-)

IMO the main points/questions are:

- where to document the command-line options and environment variables (including the recent KCONFIG_CONFIG): in a usage() function or in Documentation/kbuild/usage.txt file?

- if the answer above is in a usage() function, how does a user invoke that help request? Doing "make config -h" doesn't work: 'make' sees the -h and spits out its own help text. Would a special case of 'make config help' be acceptable or is this a good reason to use a usage.txt file instead?

- or have you already taken care of all of this? 8;)

Thanks.
---
~Randy

#6 lore raw
Quoted 5 lines

IMO the main points/questions are:

- where to document the command-line options and environment variables (including the recent KCONFIG_CONFIG): in a usage() function or in Documentation/kbuild/usage.txt file?

The latter...
make help was the other alternative and it is too big already.

For kbuild I also need to add some stuff.

Sam

#7 lore raw

PATCH 1/1 config: update usage/help info

Quoted 10 lines · On Wed, 12 Apr 2006 18:59:29 +0200 Sam Ravnborg wrote:
Quoted 5 lines

IMO the main points/questions are:

- where to document the command-line options and environment variables (including the recent KCONFIG_CONFIG): in a usage() function or in Documentation/kbuild/usage.txt file?

The latter...
make help was the other alternative and it is too big already.

For kbuild I also need to add some stuff.

Here's a shot at it, although it seemed that top-level README was sufficient for the make *config additions. We can move whatever you think should be moved to a new file.
(This is missing a recent KCONFIG_OVERWRITECONFIG environment variable that I think Roman just added.)
---

From: Randy Dunlap <[email protected]>

Replace outdated help message with a reference to README. Update README for make *config variants and environment variable info.

---
 README                 |   23 ++++++++++++++++++++++-
 scripts/kconfig/conf.c |    3 ++-
 2 files changed, 24 insertions(+), 2 deletions(-)
scripts/kconfig/conf.c +2 -1
@@ -5,6 +5,7 @@
 
 #include <ctype.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
@@ -546,7 +547,7 @@ int main(int ac, char **av)
 			break;
 		case 'h':
 		case '?':
-			printf("%s [-o|-s] config\n", av[0]);
+			fprintf(stderr, "See README for usage info\n");
 			exit(0);
 		}
 	}
README +22 -1
@@ -165,10 +165,31 @@ CONFIGURING the kernel:
 	"make xconfig"     X windows (Qt) based configuration tool.
 	"make gconfig"     X windows (Gtk) based configuration tool.
 	"make oldconfig"   Default all questions based on the contents of
-			   your existing ./.config file.
+			   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 allyesconfig"
+			   Create a ./.config file by setting symbol
+			   values to 'y' as much as possible.
+	"make allmodconfig"
+			   Create a ./.config file by setting symbol
+			   values to 'm' as much as possible.
+	"make allnoconfig" Create a ./.config file by setting symbol
+			   values to 'n' as much as possible.
+	"make randconfig"  Create a ./.config file by setting symbol
+			   values to random values.
+
+   The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
+   also use the environment variable KCONFIG_ALLCONFIG to specify a
+   filename that contains config options that the user requires to be
+   set to a specific value.  If KCONFIG_ALLCONFIG=filename is not used,
+   "make *config" checks for a file named "all{yes/mod/no/random}.config"
+   for symbol values that are to be forced.  If this file is not found,
+   it checks for a file named "all.config" to contain forced values.
    
 	NOTES on "make config":
 	- having unnecessary drivers will make the kernel bigger, and can
Acked-by on v1 1/1
#8 lore raw

Re: [PATCH] config: update usage/help info

Quoted 2 lines · Randy.Dunlap

Here's a shot at it, although it seemed that top-level README was sufficient for the make *config additions.

README is covering too much today. So adding the below text is fine with the content of README today.

So:

Quoted 1 line

Sam

#9 lore raw
In reply to Randy.Dunlap
Quoted 4 lines · Randy.Dunlap

In doing lots of kernel build testing, I often want to enable all options in a sub-menu and their sub-sub-menus. Sound is one of the worst^W longest of these, so I chose a shorter (easier) one to practice on: parport.

If there is a general need for this we shal enhance kconfig with this. We shall not clutter the Kconfig files with this.

On the other hand the perl solutions posted seems also to do the trick so lets see if that does the trick for now.

Sam

#10 lore raw

Hi,

Quoted 5 lines · Sam Ravnborg
Quoted 3 lines

In doing lots of kernel build testing, I often want to enable all options in a sub-menu and their sub-sub-menus. Sound is one of the worst^W longest of these, so I chose a shorter (easier) one to practice on: parport.

If there is a general need for this we shal enhance kconfig with this. We shall not clutter the Kconfig files with this.

I agree.

Quoted 1 line

From a general perspective I still like to add some basic command line

tool, which can be used for queries or simple manipulations. Here it also would be less a problem to add experimental or distribution specific functionality instead of overloading conf.c.
At some point I even had script bindings (via swig), so one could do even weirder stuff.

bye, Roman

#11 lore raw
Quoted 10 lines · On Fri, 7 Apr 2006 23:24:44 +0200 (CEST) Roman Zippel wrote:

Hi,

Quoted 5 lines · Sam Ravnborg
Quoted 3 lines

In doing lots of kernel build testing, I often want to enable all options in a sub-menu and their sub-sub-menus. Sound is one of the worst^W longest of these, so I chose a shorter (easier) one to practice on: parport.

If there is a general need for this we shal enhance kconfig with this. We shall not clutter the Kconfig files with this.

Quoted 7 lines

I agree.

Quoted 1 line

From a general perspective I still like to add some basic command line

tool, which can be used for queries or simple manipulations. Here it also would be less a problem to add experimental or distribution specific functionality instead of overloading conf.c.
At some point I even had script bindings (via swig), so one could do even weirder stuff.

Yep, no problem with Sam's or your reply. Thanks for looking.

---
~Randy

#12 lore raw
In reply to Randy.Dunlap
Quoted 9 lines

In doing lots of kernel build testing, I often want to enable all options in a sub-menu and their sub-sub-menus. Sound is one of the worst^W longest of these, so I chose a shorter (easier) one to practice on: parport. [..]
I can already see that I find this useful, but is there a good (better) way to implement this in kconfig?
[..]
Comments?

I would like this one, for menuconfig (ncurses):

'y', 'm' and 'n' have their usual behavior
'Y', 'M' and 'N' affect the current item plus any subparts (if any)

That is, press *Shift*-Y/M/N for the "deep change".

Jan Engelhardt