Skip to contentSkip to conversation

Additional kconfig targets (cloneconfig, nonint_oldconfig etc)

DISCUSSION Sam Ravnborg 9 participants 22 messages Apr 29, 2008 – Jun 13, 2008

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

Recently there has been request for a number of new kconfig related targets.

In general it boils down to the following:

We need to be flexible in what configuration we start out from and how we apply it.

We need to be able to apply it in following ways:
1) automated - select defaults for all new symbols => It is used for "make defconfig, make *_defconfig" today

2) interactive - asking user for all new symbols and error out if stdin is redirected

3) list unknown - list all new symbols and do not create a new config

With oldconfig today we have two modes:
-> One mode where we are very chatty and show
all output.
-> And the 'silent' mode where we only start being
chatty when we see a new symbol.

I plan to drop the 'very chatty' mode as I
do not see it usefull.
So in essense 'make oldconfig' and 'make silentoldconfig' become equal.

The commands we have today for kconfig is:

# Command line variants
make oldconfig
make silentoldconfig
make defconfig
make XXX_defconfig

(The other frontends are left out on purpose). The challenge here is to come up with a syntax that allows us to select between the three behaviours, while keeping backward compatibility.

The best suggestion I have so far is to say that:
a) if defconfig is specified then we use method 1)
b) if oldconfig is specified then we use method 2)
c) if newconfig is specified then we use method 3)

And we add support for a new 'commandline' parameter 'K' so I can say:

make K=/proc/config.gz defconfig
make K=i386_defconfig defconfig
make K=i386_defconfig oldconfig
make K=/proc/config.gz newconfig

So K is used to specify what config file we use to start out from.

Care should be taken to keep the known good targets working as before.

Andres Salomon already did some preparational work for this but I need to find a good way to handle the K= parameter.
Dave J also posted patches that is useful for 'newconfig'.

But I wanted to ask for opinions before diving into implmenting this.

Sam

[Random notes..]

# Enviroment variables affecting kconfig KCONFIG_ALLCONFIG
KCONFIG_NOSILENTUPDATE
KCONFIG_CONFIG
KCONFIG_OVERWRITECONFIG KCONFIG_NOTIMESTAMP
KCONFIG_AUTOCONFIG
KCONFIG_AUTOHEADER

#input files (aparts from the mandatory ones) all.config
allno.config
allmod.config
allyes.config
allrandom.config

#1 lore raw
Quoted 18 lines · On Tue, 29 Apr 2008 20:35:31 +0200 Sam Ravnborg <[email protected]> wrote:

Recently there has been request for a number of new kconfig related targets.

In general it boils down to the following:

We need to be flexible in what configuration we start out from and how we apply it.

We need to be able to apply it in following ways:
1) automated - select defaults for all new symbols => It is used for "make defconfig, make *_defconfig" today

2) interactive - asking user for all new symbols and error out if stdin is redirected

3) list unknown - list all new symbols and do not create a new config

Quoted 8 lines

With oldconfig today we have two modes:
-> One mode where we are very chatty and show
all output.
-> And the 'silent' mode where we only start being
chatty when we see a new symbol.

I plan to drop the 'very chatty' mode as I do not see it usefull.

I'd certainly agree with that.

Quoted 16 lines

So in essense 'make oldconfig' and 'make silentoldconfig' become equal.

The commands we have today for kconfig is:

# Command line variants
make oldconfig
make silentoldconfig
make defconfig
make XXX_defconfig

(The other frontends are left out on purpose). The challenge here is to come up with a syntax that allows us to select between the three behaviours, while keeping backward compatibility.

Quoted 5 lines

The best suggestion I have so far is to say that:
a) if defconfig is specified then we use method 1)
b) if oldconfig is specified then we use method 2)
c) if newconfig is specified then we use method 3)

'newconfig' sounds to me like you're creating a new config; the exact opposite of what it does. I'd suggest 'listnewconfig' or some such thing. Then again, 'defconfig' and 'oldconfig' are primarily what I care about, as I haven't been in a situation where I would have found method 3) to be useful.

Quoted 10 lines

And we add support for a new 'commandline' parameter 'K' so I can say:

make K=/proc/config.gz defconfig
make K=i386_defconfig defconfig
make K=i386_defconfig oldconfig
make K=/proc/config.gz newconfig

So K is used to specify what config file we use to start out from.

Sounds good, I highly prefer specifying the config via env variable rather than embedded in the target (ie, 'make olpc_defconfig').

Quoted 32 lines

Care should be taken to keep the known good targets working as before.

Andres Salomon already did some preparational work for this but I need to find a good way to handle the K= parameter.
Dave J also posted patches that is useful for 'newconfig'.

But I wanted to ask for opinions before diving into implmenting this.

Sam

[Random notes..]

# Enviroment variables affecting kconfig KCONFIG_ALLCONFIG
KCONFIG_NOSILENTUPDATE
KCONFIG_CONFIG
KCONFIG_OVERWRITECONFIG KCONFIG_NOTIMESTAMP
KCONFIG_AUTOCONFIG
KCONFIG_AUTOHEADER

#input files (aparts from the mandatory ones) all.config
allno.config
allmod.config
allyes.config
allrandom.config

#2 lore raw
Quoted 13 lines
Quoted 13 lines

The commands we have today for kconfig is:

# Command line variants
make oldconfig
make silentoldconfig
make defconfig
make XXX_defconfig

(The other frontends are left out on purpose). The challenge here is to come up with a syntax that allows us to select between the three behaviours, while keeping backward compatibility.

Quoted 8 lines
Quoted 5 lines

The best suggestion I have so far is to say that:
a) if defconfig is specified then we use method 1)
b) if oldconfig is specified then we use method 2)
c) if newconfig is specified then we use method 3)

'newconfig' sounds to me like you're creating a new config; the exact opposite of what it does. I'd suggest 'listnewconfig' or some such thing.

listnewconfig is better - will use that.

Quoted 12 lines

Then again, 'defconfig' and 'oldconfig' are primarily what I care about, as I haven't been in a situation where I would have found method 3) to be useful.

Quoted 8 lines

And we add support for a new 'commandline' parameter 'K' so I can say:

make K=/proc/config.gz defconfig
make K=i386_defconfig defconfig
make K=i386_defconfig oldconfig
make K=/proc/config.gz newconfig

Quoted 5 lines
Quoted 2 lines

So K is used to specify what config file we use to start out from.

Sounds good, I highly prefer specifying the config via env variable rather than embedded in the target (ie, 'make olpc_defconfig').

I will try to come up with some simple algorithm to locate the file. I guess something like:

a) Try in local dir with name supplied
b) If filname does not start with '/' try in arch/$ARCH/configs/*
c) If filname does not start with '/' try in arch/$ARCH/configs/*_defconfig

If filename is prefixed .gz unpack it

Sam

#3 lore raw
Quoted 5 lines · Sam Ravnborg
Quoted 3 lines

'newconfig' sounds to me like you're creating a new config; the exact opposite of what it does. I'd suggest 'listnewconfig' or some such thing.

listnewconfig is better - will use that.

Mh, newconfig sounds like make K=/dev/null oldconfig/defconfig

Quoted 8 lines
Quoted 2 lines

Sounds good, I highly prefer specifying the config via env variable rather than embedded in the target (ie, 'make olpc_defconfig').

I will try to come up with some simple algorithm to locate the file. I guess something like:

a) Try in local dir with name supplied
b) If filname does not start with '/' try in arch/$ARCH/configs/*
c) If filname does not start with '/' try in arch/$ARCH/configs/*_defconfig

Scan ./ before arch/$ARCH/configs/

Quoted 1 line

If filename is prefixed .gz unpack it

/proc/.gzconfig? :-D (scnr)

#4 lore raw
In reply to Andres Salomon
Quoted 6 lines · Andres Salomon
Quoted 3 lines · On Tue, 29 Apr 2008 20:35:31 +0200 Sam Ravnborg <[email protected]> wrote:

And we add support for a new 'commandline' parameter 'K' so I can say:

Quoted 7 lines
Quoted 7 lines

make K=/proc/config.gz defconfig
make K=i386_defconfig defconfig
make K=i386_defconfig oldconfig
make K=/proc/config.gz newconfig

So K is used to specify what config file we use
to start out from.

I like this idea a lot. I didn't like the hardcoded `.config' 13 years ago and I still
don't like it now.

Quoted 2 lines

Sounds good, I highly prefer specifying the config via env variable rather than embedded in the target (ie, 'make olpc_defconfig').

Is there any reasonable way to embed the configuration file name in the kernel image like BSD does it? /proc/config.gz is a good way to retrieve way to retrieve configuration information on a running system, not so good for pushing kernels out to a network and keeping track of the config files on the build machine.

I don't have any way of checking this now, but can /proc files like /proc/config.gz
be exported via NFS or the equivalent?

-sb

#5 lore raw
Quoted 19 lines · On Wed, 30 Apr 2008 03:45:57 -0700 SL Baur wrote:
Quoted 6 lines · Andres Salomon
Quoted 3 lines · On Tue, 29 Apr 2008 20:35:31 +0200 Sam Ravnborg <[email protected]> wrote:

And we add support for a new 'commandline' parameter 'K' so I can say:

Quoted 7 lines
Quoted 7 lines

make K=/proc/config.gz defconfig
make K=i386_defconfig defconfig
make K=i386_defconfig oldconfig
make K=/proc/config.gz newconfig

So K is used to specify what config file we use
to start out from.

I like this idea a lot. I didn't like the hardcoded `.config' 13 years ago and I still
don't like it now.

Quoted 8 lines
Quoted 2 lines

Sounds good, I highly prefer specifying the config via env variable rather than embedded in the target (ie, 'make olpc_defconfig').

Is there any reasonable way to embed the configuration file name in the kernel image like BSD does it? /proc/config.gz is a good way to retrieve way to retrieve configuration information on a running system, not so good for pushing kernels out to a network and keeping track of the config files on the build machine.

I don't know how BSD does it, but CONFIG_IKCONFIG does embed the config image in the kernel. It can be extracted with scripts/extract-ikconfig.

Quoted 3 lines

I don't have any way of checking this now, but can /proc files like /proc/config.gz
be exported via NFS or the equivalent?

---
~Randy

#6 lore raw
Quoted 9 lines · Randy Dunlap
Quoted 5 lines · On Wed, 30 Apr 2008 03:45:57 -0700 SL Baur wrote:

Is there any reasonable way to embed the configuration file name in the kernel image like BSD does it? /proc/config.gz is a good way to retrieve way to retrieve configuration information on a running system, not so good for pushing kernels out to a network and keeping track of the config files on the build machine.

Quoted 3 lines

I don't know how BSD does it, but CONFIG_IKCONFIG does embed the
config image in the kernel. It can be extracted with scripts/extract-ikconfig.

No, that's not what I meant. Now that we have a means of specifying a configuration file by name, it would be nice if the file name could, for example, be appended to EXTRAVERSION. That's all it would take to duplicate the behavior I misdescribed.

Eg. `make K=HPxw4300.config ...' would have "-HPxw4300" appended to EXTRAVERSION. Maybe this doesn't make sense any more, but it was once something I wanted very much.

-sb

#7 lore raw
Quoted 3 lines

Eg. `make K=HPxw4300.config ...' would have "-HPxw4300" appended to EXTRAVERSION. Maybe this doesn't make sense any more, but it was once something I wanted very much.

We have "echo .foo > localversion" or CONFIG_LOCALVERSION=.foo for that. Maybe what you would like is a variable on that make command line to magically set CONFIG_LOCALVERSION with less typing.

Thanks,
Roland

#8 lore raw
In reply to SL Baur
Quoted 20 lines · SL Baur
Quoted 9 lines · Randy Dunlap
Quoted 5 lines · On Wed, 30 Apr 2008 03:45:57 -0700 SL Baur wrote:

Is there any reasonable way to embed the configuration file name in the kernel image like BSD does it? /proc/config.gz is a good way to retrieve way to retrieve configuration information on a running system, not so good for pushing kernels out to a network and keeping track of the config files on the build machine.

Quoted 3 lines

I don't know how BSD does it, but CONFIG_IKCONFIG does embed the
config image in the kernel. It can be extracted with scripts/extract-ikconfig.

No, that's not what I meant. Now that we have a means of specifying a configuration file by name, it would be nice if the file name could, for example, be appended to EXTRAVERSION. That's all it would take to duplicate the behavior I misdescribed.

Quoted 3 lines

Eg. `make K=HPxw4300.config ...' would have "-HPxw4300" appended to EXTRAVERSION. Maybe this doesn't make sense any more, but it was once something I wanted very much.

You can just do:
echo "-HPxw4300" > localversion

Then it gets appended to the kernel version. While not automatic is solves your need.

Sam

#9 lore raw
In reply to Sam Ravnborg
Quoted 5 lines · Sam Ravnborg

I plan to drop the 'very chatty' mode as I
do not see it usefull.
So in essense 'make oldconfig' and 'make silentoldconfig' become equal.

Sounds good.

Quoted 13 lines

The commands we have today for kconfig is:

# Command line variants
make oldconfig
make silentoldconfig
make defconfig
make XXX_defconfig

(The other frontends are left out on purpose). The challenge here is to come up with a syntax that allows us to select between the three behaviours, while keeping backward compatibility.

Quoted 4 lines

The best suggestion I have so far is to say that:
a) if defconfig is specified then we use method 1)
b) if oldconfig is specified then we use method 2)
c) if newconfig is specified then we use method 3)

[Where is 1) defined?]

Quoted 10 lines

And we add support for a new 'commandline' parameter 'K' so I can say:

make K=/proc/config.gz defconfig
make K=i386_defconfig defconfig
make K=i386_defconfig oldconfig
make K=/proc/config.gz newconfig

So K is used to specify what config file we use to start out from.

Oh that's real good, even better than cloneconfig.

Quoted 8 lines

# Enviroment variables affecting kconfig KCONFIG_ALLCONFIG
KCONFIG_NOSILENTUPDATE
KCONFIG_CONFIG
KCONFIG_OVERWRITECONFIG
KCONFIG_NOTIMESTAMP
KCONFIG_AUTOCONFIG
KCONFIG_AUTOHEADER

Ok and these are doing .. what?

Quoted 6 lines

#input files (aparts from the mandatory ones) all.config
allno.config
allmod.config
allyes.config
allrandom.config

Used for..?

#10 lore raw
Quoted 11 lines
Quoted 9 lines

(The other frontends are left out on purpose). The challenge here is to come up with a syntax that allows us to select between the three behaviours, while keeping backward compatibility.

The best suggestion I have so far is to say that:
a) if defconfig is specified then we use method 1)
b) if oldconfig is specified then we use method 2)
c) if newconfig is specified then we use method 3)

[Where is 1) defined?]

1) automated - select defaults for all new symbols => It is used for "make defconfig, make *_defconfig" today

Quoted 4 lines

Ok and these are doing .. what?

Quoted 2 lines

# Enviroment variables affecting kconfig KCONFIG_ALLCONFIG

Specify input file in .config format to adjust a all*config run

Quoted 1 line
Quoted 1 line

KCONFIG_NOSILENTUPDATE

If set then error out if .config is modified

Quoted 1 line
Quoted 1 line

KCONFIG_CONFIG

Provide alternative name for .config

Quoted 1 line
Quoted 1 line

KCONFIG_OVERWRITECONFIG

If you set KCONFIG_OVERWRITECONFIG in environment, Kconfig will not break
symlinks when .config is a symlink to somewhere else

Quoted 1 line
Quoted 1 line

KCONFIG_NOTIMESTAMP

Do not put timestamp in .config

Quoted 1 line
Quoted 1 line

KCONFIG_AUTOCONFIG

Provide alternative name for: include/config/auto.conf

Quoted 1 line
Quoted 1 line

KCONFIG_AUTOHEADER

Provide alternative name for include/linux/autoconf.h

Quoted 1 line

Used for..?

All used to hardcode specific values in all*config builds.

Quoted 6 lines
Quoted 6 lines

#input files (aparts from the mandatory ones) all.config
allno.config
allmod.config
allyes.config
allrandom.config

Sam

#11 lore raw
In reply to Sam Ravnborg

Hi,

Quoted 12 lines · Sam Ravnborg

Recently there has been request for a number of new kconfig related targets.

In general it boils down to the following:

We need to be flexible in what configuration
we start out from and how we apply it.

We need to be able to apply it in following ways:
1) automated - select defaults for all new symbols => It is used for "make defconfig, make *_defconfig" today

Quoted 5 lines

2) interactive - asking user for all new symbols
and error out if stdin is redirected

3) list unknown - list all new symbols and do not
create a new config

A general comment about the intendend design:
conf.c is primarily meant as interactive tool. defconfig isn't exactly interactive, but is included for historical reasons as it produces the same output.
The patch I've seen for the last point put it into conf.c, which is the wrong place for it. For this sort of thing we should create a small query tool, which then can export all sorts of information.

If we silence the defconfig output (which IMO is a good thing, as I don't think anyone looked at the output seriously for a long time and the current behaviour has purely historical reasons), it would also open up the possibility to separate it from conf.c.
This also fits into an idea I'm playing with to extend the .config format like this:

%defaultmode: mod
CONFIG_FOO=n

Basically this could replace "make allmodconfig KCONFIG_ALLCONFIG=..." and the current way to produce an allmodconfig would be replaced by a dedicated function.

bye, Roman

#12 lore raw
Quoted 22 lines · Roman Zippel

Hi,

Quoted 12 lines · Sam Ravnborg

Recently there has been request for a number of new kconfig related targets.

In general it boils down to the following:

We need to be flexible in what configuration
we start out from and how we apply it.

We need to be able to apply it in following ways:
1) automated - select defaults for all new symbols => It is used for "make defconfig, make *_defconfig" today

Quoted 5 lines

2) interactive - asking user for all new symbols
and error out if stdin is redirected

3) list unknown - list all new symbols and do not
create a new config

Quoted 7 lines

A general comment about the intendend design:
conf.c is primarily meant as interactive tool. defconfig isn't exactly interactive, but is included for historical reasons as it produces the same output.
The patch I've seen for the last point put it into conf.c, which is the wrong place for it. For this sort of thing we should create a small query tool, which then can export all sorts of information.

Hi Roman.
This is work in progress...
I have created a new frontend: aconf.c that is a trimmed down version of conf.c. aconf.c are intended to take care of all the automated configurations such as: all*config, randconfig and the automated defconfig

In this way we have conf.c for all the interactive targets and aconf for all the automated targets.

This is not exactly what you suggest but I thik a step in the right direction.

Comments?

Sam

/*
* Copyright (C) 2002 Roman Zippel <[email protected]>
* Copyright (C) 2008 Sam Ravnborg <[email protected]>
* Released under the terms of the GNU GPL v2.0. */

/*
* Generate the automated configs
*/

#include <locale.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>

#define LKC_DIRECT_LINK
#include "lkc.h"

static void check_conf(struct menu *menu);
static void conf(struct menu *menu);

enum {
	set_default,
	set_yes,
	set_mod,
	set_no,
	set_random
} input_mode;

static char *defconfig_file;

static int conf_cnt;
static struct menu *rootEntry;

/* Set strig value - it this a nop as it looks like? */ static void conf_string(struct menu *menu)

{
	struct symbol *sym = menu->sym;
	const char *def;


	if (!sym_is_changable(sym))
		return;

	if (sym_has_value(sym) && (input_mode != set_default))
		return;

	def = sym_get_string_value(sym);
	if (def)
		sym_set_string_value(sym, def);
}

static void conf_sym(struct menu *menu)

{
	struct symbol *sym = menu->sym;
	int type;
	tristate val;

	if (!sym_is_changable(sym))
		return;

	if (sym_has_value(sym) && (input_mode != set_default))
		return;

	type = sym_get_type(sym);
	switch (input_mode) {
	case set_yes:
		if (sym_tristate_within_range(sym, yes)) {
			sym_set_tristate_value(sym, yes);
			break;
		}
	/* fallthrough */
	case set_mod:
		if (type == S_TRISTATE) {
			if (sym_tristate_within_range(sym, mod)) {
				sym_set_tristate_value(sym, mod);
				break;
			}
		} else if (sym_tristate_within_range(sym, yes)) {
			sym_set_tristate_value(sym, yes);
			break;
		}
	/* fallthrough */
	case set_no:
		if (sym_tristate_within_range(sym, no)) {
			sym_set_tristate_value(sym, no);
			break;
		}
	/* fallthrough */
	case set_random:
		 do {
			val = (tristate)(rand() % 3);
		} while (!sym_tristate_within_range(sym, val));
		switch (val) {
		case no:  sym_set_tristate_value(sym, no); break;
		case mod: sym_set_tristate_value(sym, mod); break;
		case yes: sym_set_tristate_value(sym, yes); break;
		}
		break;
	/* silence gcc warning */
	case set_default:
		sym_set_tristate_value(sym, sym_get_tristate_value(sym));
		break;
	}
}

static void conf_choice(struct menu *menu)

{
	struct symbol *sym, *def_sym;
	struct menu *child;
	int type;
	bool is_new;
	int cnt, def;

	sym = menu->sym;
	type = sym_get_type(sym);
	is_new = !sym_has_value(sym);
	if (sym_is_changable(sym)) {
		conf_sym(menu);
		sym_calc_value(sym);
	}
	if (sym_get_tristate_value(sym) != yes)
		return;
	def_sym = sym_get_choice_value(sym);
	cnt = def = 0;
	for (child = menu->list; child; child = child->next) {
		if (!child->sym || !menu_is_visible(child))
			continue;
		cnt++;
		if (child->sym == def_sym)
			def = cnt;
	}
	if (cnt == 1)
		goto conf_childs;

	switch (input_mode) {
	case set_random:
		if (is_new)
			def = (rand() % cnt) + 1;
	/* fallthrough */
	case set_default:
	case set_yes:
	case set_mod:
	case set_no:
		cnt = def;
		break;
	}

conf_childs:

	for (child = menu->list; child; child = child->next) {
		if (!child->sym || !menu_is_visible(child))
			continue;
		if (!--cnt)
			break;
	}
	sym_set_choice_value(sym, child->sym);
	for (child = child->list; child; child = child->next)
		conf(child);
}

static void conf(struct menu *menu)

{
	struct symbol *sym;
	struct property *prop;
	struct menu *child;

	if (!menu_is_visible(menu))
		return;

	sym = menu->sym;
	//if (sym)
	//	printf("sym:%s\n", sym->name);
	prop = menu->prompt;
	if (prop && prop->type == P_MENU) {
		if (menu != rootEntry) {
			check_conf(menu);
			return;
		}
	}

	if (!sym)
		goto conf_childs;

	if (sym_is_choice(sym)) {
		conf_choice(menu);
		if (sym->curr.tri != mod)
			return;
		goto conf_childs;
	}

	switch (sym->type) {
	case S_INT:
	case S_HEX:
	case S_STRING:
		conf_string(menu);
		break;
	default:
		conf_sym(menu);
		break;
	}

conf_childs:

	for (child = menu->list; child; child = child->next)
		conf(child);
}

static void check_conf(struct menu *menu)

{
	struct symbol *sym;
	struct menu *child;

	if (!menu_is_visible(menu))
		return;

	sym = menu->sym;
	if (sym && !sym_has_value(sym)) {
		if (sym_is_changable(sym) ||
		    (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
			conf_cnt++;
			rootEntry = menu_get_parent_menu(menu);
			conf(rootEntry);
		}
	}

	for (child = menu->list; child; child = child->next)
		check_conf(child);
}

int main(int ac, char **av)

{
	int opt;
	const char *name;
	struct stat tmpstat;

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	while ((opt = getopt(ac, av, "dD:nmyrh")) != -1) {
		switch (opt) {
		case 'd':
			input_mode = set_default;
			break;
		case 'D':
			input_mode = set_default;
			defconfig_file = optarg;
			break;
		case 'n':
			input_mode = set_no;
			break;
		case 'm':
			input_mode = set_mod;
			break;
		case 'y':
			input_mode = set_yes;
			break;
		case 'r':
			input_mode = set_random;
			srand(time(NULL));
			break;
		case 'h':
			printf(_("See README for usage info\n"));
			exit(0);
			break;
		default:
			fprintf(stderr, _("See README for usage info\n"));
			exit(1);
		}
	}
	if (ac == optind) {
		printf(_("%s: Kconfig file missing\n"), av[0]);
		exit(1);
	}
	name = av[optind];
	conf_parse(name);
	//zconfdump(stdout);
	switch (input_mode) {
	case set_default:
		if (!defconfig_file)
			defconfig_file = conf_get_default_confname();
		if (conf_read(defconfig_file)) {
			printf(_("***\n"
				"*** Can't find default configuration \"%s\"!\n"
				"***\n"), defconfig_file);
			exit(1);
		}
		break;
	case set_no:
	case set_mod:
	case set_yes:
	case set_random:
		name = getenv("KCONFIG_ALLCONFIG");
		if (name && !stat(name, &tmpstat)) {
			conf_read_simple(name, S_DEF_USER);
			break;
		}
		switch (input_mode) {
		case set_no:	 name = "allno.config"; break;
		case set_mod:	 name = "allmod.config"; break;
		case set_yes:	 name = "allyes.config"; break;
		case set_random: name = "allrandom.config"; break;
		default: break;
		}
		if (!stat(name, &tmpstat))
			conf_read_simple(name, S_DEF_USER);
		else if (!stat("all.config", &tmpstat))
			conf_read_simple("all.config", S_DEF_USER);
		break;
	default:
		break;
	}

	do {
		conf_cnt = 0;
		check_conf(&rootmenu);
	} while (conf_cnt);
	if (conf_write(NULL)) {
		fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
		return 1;
	}

	if (conf_write_autoconf()) {
		fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
		return 1;
	}

	return 0;
}
#13 lore raw
In reply to Roman Zippel

Hi Roman.

Quoted 7 lines

The patch I've seen for the last point put it into conf.c, which is the wrong place for it. For this sort of thing we should create a small query tool, which then can export all sorts of information.
If we silence the defconfig output (which IMO is a good thing, as I don't think anyone looked at the output seriously for a long time and the current behaviour has purely historical reasons), it would also open up the possibility to separate it from conf.c.

aconf is now ready to take care of defconfig, randconfig and all*config. That leaves us with two simple tasks for conf.c:
config and oldconfig

[silentoldconfig is gone as oldconfig is 'silent' now].

aconf can take a base config for all the targets and avoids being clever where to locate it. (Read: does not use DEFCONFIG_LIST).

I dunno if this is what you had in mind but I certainly like the result. A cleaned up set of patches will soon hit the kbuild list.

Quoted 6 lines

This also fits into an idea I'm playing with to extend the .config format like this:

%defaultmode: mod
CONFIG_FOO=n

I understand the solution that you describe but I fail to see the usefulness of it.
Can I request you to elaborate a bit more how you see it used. I can give it a shot if I see it solving a real issue.

Quoted 3 lines

Basically this could replace "make allmodconfig KCONFIG_ALLCONFIG=..." and the current way to produce an allmodconfig would be replaced by a dedicated function.

This part I did not understand either. I am aware of the current behaviour but do not get the "dedicated function" thing.

Thanks in advance,

Sam

#14 lore raw
In reply to Sam Ravnborg

With the attached patch you can do:

make K=my_favourite_config defconfig

kconfig will read all config values form 'my_favourite_config' and set all other symbols to their default value. The output is now dense like this:

# configuration is based on 'my_favourite_config'
#
# configuration written to .config
#

The K= notations works for the usual suspects:
allnoconfig, allyesconfig, allmodconfig, randconfig and defconfig

alldefconfig with no parameters create a kernel konfiguration with all parameters set to default.

The difference between alldefconfig and defconfig is that if no K= parameter is specified the defconfig will try to load one of the files specified in the defconfig list from init/Kconfig (see DEFCONFIG_LIST)

I decided to create a new .c file to support this. It was not strictly necessary but this allows us to simplify conf.c a lot. I did not do so yet.

What is missing:
1) No support for .gz input file
But aconf.sh should be easy to adjust to this

2) We hardcode that files name *_defconfig are found in arch/$ARCH/configs/*

3) Implement newsymbolsconfig (any better name?)
Shall list all new symbols and shall not write
any config

Sam

scripts/kconfig/Makefile +14 -17
index fa1a7d5..3e560a4 100644
@@ -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 arch/$(SRCARCH)/configs/$@ $(Kconfig)
 
 # Help text used by make help
 help:
@@ -100,6 +95,7 @@ HOST_EXTRACFLAGS += -DLOCALE
 # ===========================================================================
 # Shared Makefile for the various kconfig executables:
 # conf:	  Used for defconfig, oldconfig and related targets
+# aconf:  Generate simple configurations (all*config, etc)
 # mconf:  Used for the mconfig target.
 #         Utilizes the lxdialog package
 # qconf:  Used for the xconfig target
@@ -112,10 +108,11 @@ lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
 lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
 
 conf-objs	:= conf.o  zconf.tab.o
+aconf-objs	:= aconf.o zconf.tab.o
 mconf-objs	:= mconf.o zconf.tab.o $(lxdialog)
 kxgettext-objs	:= kxgettext.o zconf.tab.o
 
-hostprogs-y := conf qconf gconf kxgettext
+hostprogs-y := conf aconf qconf gconf kxgettext
 
 ifeq ($(MAKECMDGOALS),menuconfig)
 	hostprogs-y += mconf
scripts/kconfig/aconf.c new file +316 -0

316 lines not on this page · raw message

scripts/kconfig/aconf.sh new file +30 -0
new file mode 100755
index 0000000..c46a868
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+aconf=scripts/kconfig/aconf
+# Find input file
+if [ ! -z $K ]; then
+	config_file="-i $K";
+fi
+
+case "$1" in
+	"allnoconfig")
+		$aconf -n $config_file $2
+		;;
+	"allyesconfig")
+		$aconf -y $config_file $2
+		;;
+	"allmodconfig")
+		$aconf -m $config_file $2
+		;;
+	"alldefconfig")
+		$aconf -d $config_file $2
+		;;
+	"randconfig")
+		$aconf -r $config_file $2
+		;;
+	*)
+		echo "$0: unknow command $1"
+		exit 1
+	;;
+esac
+
#15 lore raw
Quoted 4 lines · On Fri, 2 May 2008 21:09:49 +0200 Sam Ravnborg <[email protected]> wrote:

With the attached patch you can do:

make K=my_favourite_config defconfig

Quoted 8 lines

kconfig will read all config values form 'my_favourite_config' and set all other symbols to their default value. The output is now dense like this:

# configuration is based on 'my_favourite_config'
#
# configuration written to .config
#

Is this slated for 2.6.27?

Quoted 3 lines

The K= notations works for the usual suspects:
allnoconfig, allyesconfig, allmodconfig, randconfig and defconfig

Since this is aconf (automated), if we run 'make K=foo defconfig' and 'foo' doesn't contain one of the necessary values.. the build will fail, right?

[...]

Quoted 5 lines

What is missing:
1) No support for .gz input file
But aconf.sh should be easy to adjust to this

Quoted 7 lines

2) We hardcode that files name *_defconfig are found in arch/$ARCH/configs/*

3) Implement newsymbolsconfig (any better name?)
Shall list all new symbols and shall not write
any config

I'm not sure I see the point of #3.

#16 lore raw
Quoted 5 lines · Andres Salomon
Quoted 3 lines

3) Implement newsymbolsconfig (any better name?)
Shall list all new symbols and shall not write
any config

I'm not sure I see the point of #3.

It's something we've had in Fedora kernels forever, because when rebasing to a new upstream version the process becomes

make newsymbolsconfig
take list of symbols, and make decisions on them
make oldconfig

without it, the process would be..

make oldconfig
note new symbol, make decision
make oldconfig
note a 2nd new symbol, make decision
make oldconfig
note a 3rd new symbol..
make oldconfig..
you get the idea.

The way we have it isn't perfect, (adding a new symbol may unhide another set of new symbols), but it reduces the number of iterations needed dramatically.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#17 lore raw
Quoted 6 lines · On Wed, 21 May 2008 17:11:39 -0400 Dave Jones <[email protected]> wrote:
Quoted 4 lines · Andres Salomon
Quoted 3 lines

3) Implement newsymbolsconfig (any better name?)
Shall list all new symbols and shall not write
any config

Quoted 10 lines
Quoted 1 line

I'm not sure I see the point of #3.

It's something we've had in Fedora kernels forever, because when rebasing to a new upstream version the process becomes

make newsymbolsconfig
take list of symbols, and make decisions on them
make oldconfig

Ah, I see. My process has always been:

cp arch/x86/configs/foo_defconfig .config
make oldconfig
make obvious decisions about new symbols, choose defaults if unknown diff -u arch/x86/configs/foo_defconfig .config
figure out if any decisions or defaults are incorrect, change accordingly make oldconfig (more decisions if there are new symbols exposed) cp .config arch/x86/configs/foo_defconfig && commit

Quoted 11 lines

without it, the process would be..

make oldconfig
note new symbol, make decision
make oldconfig
note a 2nd new symbol, make decision
make oldconfig
note a 3rd new symbol..
make oldconfig..
you get the idea.

Quoted 6 lines

The way we have it isn't perfect, (adding a new symbol may unhide another set of new symbols), but it reduces the number of iterations needed dramatically.

Dave

My build has broken again, which is why I'm inquiring about the status of this; I'm not going to bother fixing it if my patches are never going to end up upstream..

#18 lore raw
In reply to Dave Jones
Quoted 18 lines · Dave Jones
Quoted 5 lines · Andres Salomon
Quoted 3 lines

3) Implement newsymbolsconfig (any better name?)
Shall list all new symbols and shall not write
any config

I'm not sure I see the point of #3.

It's something we've had in Fedora kernels forever, because when rebasing to a new upstream version the process becomes

make newsymbolsconfig
take list of symbols, and make decisions on them
make oldconfig

without it, the process would be..

Quoted 8 lines

make oldconfig
note new symbol, make decision
make oldconfig
note a 2nd new symbol, make decision
make oldconfig
note a 3rd new symbol..
make oldconfig..
you get the idea.

It's actually

make oldconfig
[note new symbol, make decision]
[note new symbol, make decision]
[note new symbol, make decision]
make

so the number of decisions and invocations are the same.

Quoted 3 lines

The way we have it isn't perfect, (adding a new symbol may unhide another set of new symbols), but it reduces the number of iterations needed dramatically.

#19 lore raw
In reply to Andres Salomon
Quoted 17 lines · Andres Salomon
Quoted 4 lines · On Fri, 2 May 2008 21:09:49 +0200 Sam Ravnborg <[email protected]> wrote:

With the attached patch you can do:

make K=my_favourite_config defconfig

Quoted 8 lines

kconfig will read all config values form 'my_favourite_config' and set all other symbols to their default value. The output is now dense like this:

# configuration is based on 'my_favourite_config'
#
# configuration written to .config
#
Quoted 1 line

Is this slated for 2.6.27?

Been busy and got sidetracked after my first version proved broken. Will try to look at it in the weekend.

Sam

#20 lore raw
Quoted 18 lines · On Wed, 21 May 2008 23:47:23 +0200 Sam Ravnborg <[email protected]> wrote:
Quoted 17 lines · Andres Salomon
Quoted 12 lines · On Fri, 2 May 2008 21:09:49 +0200 Sam Ravnborg <[email protected]> wrote:

With the attached patch you can do:

make K=my_favourite_config defconfig

kconfig will read all config values form 'my_favourite_config' and set all other symbols to their default value. The output is now dense like this:

# configuration is based on 'my_favourite_config'
#
# configuration written to .config
#
Quoted 6 lines
Quoted 1 line

Is this slated for 2.6.27?

Been busy and got sidetracked after my first version proved broken. Will try to look at it in the weekend.

Sam

Any updates on this? I've been forced to use a workaround in the meantime..

#21 lore raw
Quoted 23 lines · Andres Salomon
Quoted 20 lines · On Wed, 21 May 2008 23:47:23 +0200 Sam Ravnborg <[email protected]> wrote:
Quoted 18 lines · Andres Salomon
Quoted 4 lines · On Fri, 2 May 2008 21:09:49 +0200 Sam Ravnborg <[email protected]> wrote:

With the attached patch you can do:

make K=my_favourite_config defconfig

Quoted 8 lines

kconfig will read all config values form 'my_favourite_config' and set all other symbols to their default value. The output is now dense like this:

# configuration is based on 'my_favourite_config'
#
# configuration written to .config
#

Is this slated for 2.6.27?

Quoted 8 lines
Quoted 4 lines

Been busy and got sidetracked after my first version proved broken. Will try to look at it in the weekend.

Sam

Any updates on this? I've been forced to use a workaround in the meantime..

Nope. I have been busy with other stuff and need to close this first. Pending stuff before this:

-> Simplify link of vmlinux (about to be dropped for now as I cannot solve um issue) -> Kill need for ALTARCH in sparc (almost finished)
-> Optimize make headers_* (almost finished)

And a few more things that I cannot remember atm

Sam