* kconfig frontend updates
@ 2008-05-02 20:47 Sam Ravnborg
2008-05-02 20:49 ` [PATCH] kconfig: add support for K=file sam
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Sam Ravnborg @ 2008-05-02 20:47 UTC (permalink / raw)
To: linux-kbuild, LKML, Roman Zippel
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
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH] kconfig: add support for K=file 2008-05-02 20:47 kconfig frontend updates Sam Ravnborg @ 2008-05-02 20:49 ` sam 2008-05-02 20:49 ` [PATCH] kconfig: drop all*config support in conf.c sam 2008-05-10 21:25 ` [PATCH] kconfig: add support for K=file Oleg Verych 2008-05-02 21:01 ` kconfig frontend updates Sam Ravnborg 2008-05-04 18:57 ` Sam Ravnborg 2 siblings, 2 replies; 18+ messages in thread From: sam @ 2008-05-02 20:49 UTC (permalink / raw) To: linux-kernel, linux-kbuild; +Cc: Sam Ravnborg, Sam Ravnborg 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 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 diff --git a/scripts/kconfig/aconf.c b/scripts/kconfig/aconf.c new file mode 100644 index 0000000..db3df0f --- /dev/null +++ b/scripts/kconfig/aconf.c @@ -0,0 +1,316 @@ +/* + * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> + * Copyright (C) 2008 Sam Ravnborg <sam@ravnborg.org> + * 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_unknown, + set_default, + set_yes, + set_mod, + set_no, + set_random +} default_value = set_unknown; + + +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) && (default_value != 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) && (default_value != set_default)) + return; + + type = sym_get_type(sym); + switch (default_value) { + 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; + case set_default: + sym_set_tristate_value(sym, sym_get_tristate_value(sym)); + break; + /* silence gcc warning */ + case set_unknown: + 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 (default_value) { + 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; + /* silence gcc warning */ + case set_unknown: + 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; + 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; + char *config_file = NULL; + struct stat tmpstat; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + while ((opt = getopt(ac, av, "dnmyrhi:")) != -1) { + switch (opt) { + case 'd': + default_value = set_default; + break; + case 'n': + default_value = set_no; + break; + case 'm': + default_value = set_mod; + break; + case 'y': + default_value = set_yes; + break; + case 'r': + default_value = set_random; + srand(time(NULL)); + break; + case 'i': + config_file = optarg; + 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) { + fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]); + exit(1); + } + if (default_value == set_unknown) { + fprintf(stderr, + _("%s: default value missing. " + "You must use one of: -{d,n,m,y,r}\n"), av[0]); + exit(1); + } + conf_parse(av[optind]); + /* debug: zconfdump(stdout); */ + if (config_file && stat(config_file, &tmpstat)) { + fprintf(stderr, _("%s: failed to open %s\n"), + av[0], config_file); + exit(1); + } + if (config_file && conf_read_simple(config_file, S_DEF_USER)) { + fprintf(stderr, _("%s: failed to read %s\n"), + av[0], config_file); + exit(1); + } + if (config_file) { + printf(_("# configuration is based on '%s'\n"), config_file); + } + /* generate the config */ + do { + conf_cnt = 0; + check_conf(&rootmenu); + } while (conf_cnt); + /* write out the config */ + if (conf_write(NULL) || conf_write_autoconf()) { + fprintf(stderr, + _("%s: error during write of the configuration.\n"), + av[0]); + exit(1); + } + return 0; +} diff --git a/scripts/kconfig/aconf.sh b/scripts/kconfig/aconf.sh new file mode 100755 index 0000000..c46a868 --- /dev/null +++ b/scripts/kconfig/aconf.sh @@ -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 + -- 1.5.4.1.143.ge7e51 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] kconfig: drop all*config support in conf.c 2008-05-02 20:49 ` [PATCH] kconfig: add support for K=file sam @ 2008-05-02 20:49 ` sam 2008-05-02 20:49 ` [PATCH] kconfig: conf is less chatty sam 2008-05-10 21:25 ` [PATCH] kconfig: add support for K=file Oleg Verych 1 sibling, 1 reply; 18+ messages in thread From: sam @ 2008-05-02 20:49 UTC (permalink / raw) To: linux-kernel, linux-kbuild; +Cc: Sam Ravnborg, Sam Ravnborg 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; if (!sym_has_value(sym)) printf(_("(NEW) ")); @@ -92,15 +85,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) } switch (input_mode) { - case set_no: - case set_mod: - case set_yes: - case set_random: - if (sym_has_value(sym)) { - printf("%s\n", def); - return 0; - } - break; case ask_new: case ask_silent: if (sym_has_value(sym)) { @@ -112,9 +96,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) fflush(stdout); fgets(line, 128, stdin); return 1; - case set_default: - printf("%s\n", def); - return 1; default: break; } @@ -128,52 +109,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) default: ; } - switch (input_mode) { - case set_yes: - if (sym_tristate_within_range(sym, yes)) { - line[0] = 'y'; - line[1] = '\n'; - line[2] = 0; - break; - } - case set_mod: - if (type == S_TRISTATE) { - if (sym_tristate_within_range(sym, mod)) { - line[0] = 'm'; - line[1] = '\n'; - line[2] = 0; - break; - } - } else { - if (sym_tristate_within_range(sym, yes)) { - line[0] = 'y'; - line[1] = '\n'; - line[2] = 0; - break; - } - } - case set_no: - if (sym_tristate_within_range(sym, no)) { - line[0] = 'n'; - line[1] = '\n'; - line[2] = 0; - break; - } - case set_random: - do { - val = (tristate)(rand() % 3); - } while (!sym_tristate_within_range(sym, val)); - switch (val) { - case no: line[0] = 'n'; break; - case mod: line[0] = 'm'; break; - case yes: line[0] = 'y'; break; - } - line[1] = '\n'; - line[2] = 0; - break; - default: - break; - } printf("%s", line); return 1; } @@ -374,16 +309,6 @@ static int conf_choice(struct menu *menu) else continue; break; - case set_random: - if (is_new) - def = (rand() % cnt) + 1; - case set_default: - case set_yes: - case set_mod: - case set_no: - cnt = def; - printf("%d\n", cnt); - break; } conf_childs: @@ -504,7 +429,7 @@ int main(int ac, char **av) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { + while ((opt = getopt(ac, av, "osh")) != -1) { switch (opt) { case 'o': input_mode = ask_new; @@ -513,26 +438,6 @@ int main(int ac, char **av) input_mode = ask_silent; valid_stdin = isatty(0) && isatty(1) && isatty(2); break; - 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); @@ -550,16 +455,6 @@ int main(int ac, char **av) 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 ask_silent: if (stat(".config", &tmpstat)) { printf(_("***\n" @@ -575,27 +470,6 @@ int main(int ac, char **av) case ask_new: conf_read(NULL); 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; } -- 1.5.4.1.143.ge7e51 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] kconfig: conf is less chatty 2008-05-02 20:49 ` [PATCH] kconfig: drop all*config support in conf.c sam @ 2008-05-02 20:49 ` sam 2008-05-02 20:49 ` [PATCH] kconfig: .gitignore aconf sam 0 siblings, 1 reply; 18+ messages in thread From: sam @ 2008-05-02 20:49 UTC (permalink / raw) To: linux-kernel, linux-kbuild; +Cc: Sam Ravnborg, Sam Ravnborg 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 check_stdin(void) { - if (!valid_stdin && input_mode == ask_silent) { - printf(_("aborted!\n\n")); - printf(_("Console input/output is redirected. ")); - printf(_("Run 'make oldconfig' to update configuration.\n\n")); - exit(1); - } + if (valid_stdin) + return; + fprintf(stderr, _("aborted!\n\n")); + fprintf(stderr, _("Console input/output is redirected. ")); + fprintf(stderr, _("Run 'make oldconfig' to update configuration.\n\n")); + exit(1); } static int conf_askvalue(struct symbol *sym, const char *def) @@ -84,20 +83,17 @@ static int conf_askvalue(struct symbol *sym, const char *def) return 0; } + check_stdin(); switch (input_mode) { case ask_new: - case ask_silent: if (sym_has_value(sym)) { printf("%s\n", def); return 0; } - check_stdin(); case ask_all: fflush(stdout); fgets(line, 128, stdin); return 1; - default: - break; } switch (type) { @@ -287,7 +283,6 @@ static int conf_choice(struct menu *menu) printf("]: "); switch (input_mode) { case ask_new: - case ask_silent: if (!is_new) { cnt = def; printf("%d\n", cnt); @@ -350,7 +345,7 @@ static void conf(struct menu *menu) switch (prop->type) { case P_MENU: - if (input_mode == ask_silent && rootEntry != menu) { + if (input_mode != ask_all && rootEntry != menu) { check_conf(menu); return; } @@ -429,15 +424,13 @@ int main(int ac, char **av) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((opt = getopt(ac, av, "osh")) != -1) { + valid_stdin = isatty(0) && isatty(1) && isatty(2); + + while ((opt = getopt(ac, av, "oh")) != -1) { switch (opt) { case 'o': input_mode = ask_new; break; - case 's': - input_mode = ask_silent; - valid_stdin = isatty(0) && isatty(1) && isatty(2); - break; case 'h': printf(_("See README for usage info\n")); exit(0); @@ -455,7 +448,7 @@ int main(int ac, char **av) conf_parse(name); //zconfdump(stdout); switch (input_mode) { - case ask_silent: + case ask_new: if (stat(".config", &tmpstat)) { printf(_("***\n" "*** You have not yet configured your kernel!\n" @@ -467,20 +460,13 @@ int main(int ac, char **av) exit(1); } case ask_all: - case ask_new: conf_read(NULL); break; - default: - break; } - if (input_mode != ask_silent) { + if (input_mode == ask_all) { rootEntry = &rootmenu; conf(&rootmenu); - if (input_mode == ask_all) { - input_mode = ask_silent; - valid_stdin = 1; - } } else if (conf_get_changed()) { name = getenv("KCONFIG_NOSILENTUPDATE"); if (name && *name) { @@ -499,7 +485,7 @@ int main(int ac, char **av) return 1; } skip_check: - if (input_mode == ask_silent && conf_write_autoconf()) { + if (conf_write_autoconf()) { fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); return 1; } -- 1.5.4.1.143.ge7e51 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] kconfig: .gitignore aconf 2008-05-02 20:49 ` [PATCH] kconfig: conf is less chatty sam @ 2008-05-02 20:49 ` sam 2008-05-02 20:49 ` [PATCH] kconfig: kill the warning "trying to assign nonexistent symbol" sam 0 siblings, 1 reply; 18+ messages in thread From: sam @ 2008-05-02 20:49 UTC (permalink / raw) To: linux-kernel, linux-kbuild; +Cc: Sam Ravnborg 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 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] kconfig: kill the warning "trying to assign nonexistent symbol" 2008-05-02 20:49 ` [PATCH] kconfig: .gitignore aconf sam @ 2008-05-02 20:49 ` sam 0 siblings, 0 replies; 18+ messages in thread From: sam @ 2008-05-02 20:49 UTC (permalink / raw) To: linux-kernel, linux-kbuild; +Cc: Sam Ravnborg, Sam Ravnborg 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 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH] kconfig: add support for K=file 2008-05-02 20:49 ` [PATCH] kconfig: add support for K=file sam 2008-05-02 20:49 ` [PATCH] kconfig: drop all*config support in conf.c sam @ 2008-05-10 21:25 ` Oleg Verych 2008-05-10 21:10 ` Sam Ravnborg 1 sibling, 1 reply; 18+ messages in thread From: Oleg Verych @ 2008-05-10 21:25 UTC (permalink / raw) To: Sam Ravnborg; +Cc: kbuild list Sam Ravnborg @ Fri, 2 May 2008 22:49:14 +0200: > From: Sam Ravnborg <sam@uranus.ravnborg.org> > +defconfig: $(src)/aconf.sh $(obj)/aconf > + $(Q)K=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) \ > + $(CONFIG_SHELL) $< alldefconfig $(Kconfig) > +# aconf: Generate simple configurations (all*config, etc) > +++ b/scripts/kconfig/aconf.sh > +#!/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 > + #!/bin/sh set -e aconf="$src_tree/scripts/kconfig/aconf -" case $1 in # and typing of "allbalblabla" is a bit easier: "allb" all[mynd]*) # add command char using multicores :), yes string # processing in shell kind of sucks aconf="${aconf}`echo $1 | sed 's ^all\(.\).* \1 '`" ;; rand*) aconf="${aconf}r" ;; *) # fix typo and redirect to stderr echo "$0: unknown command \`$1'" >&2 exit 1 ;; esac # Find input file [ "$K" ] && aconf="$aconf -i $K" # remove command from parameters shift 1 # execute with all other parameters $aconf "$@" # end What about something like that (not tested)? There are some fixes and i'm not sure about if "$K" is empty what to do with "$config_file". -- sed 'sed && sh + olecom = love' << '' -o--=O`C #oo'L O <___=E M ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] kconfig: add support for K=file 2008-05-10 21:25 ` [PATCH] kconfig: add support for K=file Oleg Verych @ 2008-05-10 21:10 ` Sam Ravnborg 2008-05-10 21:50 ` Oleg Verych 0 siblings, 1 reply; 18+ messages in thread From: Sam Ravnborg @ 2008-05-10 21:10 UTC (permalink / raw) To: Oleg Verych; +Cc: kbuild list On Sat, May 10, 2008 at 11:25:49PM +0200, Oleg Verych wrote: > Sam Ravnborg @ Fri, 2 May 2008 22:49:14 +0200: > > > From: Sam Ravnborg <sam@uranus.ravnborg.org> > > > +defconfig: $(src)/aconf.sh $(obj)/aconf > > + $(Q)K=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) \ > > + $(CONFIG_SHELL) $< alldefconfig $(Kconfig) > > > +# aconf: Generate simple configurations (all*config, etc) > > > +++ b/scripts/kconfig/aconf.sh > > > +#!/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 > > + > > > #!/bin/sh > set -e > > aconf="$src_tree/scripts/kconfig/aconf -" > case $1 in > # and typing of "allbalblabla" is a bit easier: "allb" > all[mynd]*) > # add command char using multicores :), yes string > # processing in shell kind of sucks > aconf="${aconf}`echo $1 | sed 's ^all\(.\).* \1 '`" > ;; > rand*) > aconf="${aconf}r" > ;; > *) # fix typo and redirect to stderr > echo "$0: unknown command \`$1'" >&2 > exit 1 > ;; > esac > > # Find input file > [ "$K" ] && aconf="$aconf -i $K" > > # remove command from parameters > shift 1 > > # execute with all other parameters > $aconf "$@" > # end > > What about something like that (not tested)? There are some fixes and i'm > not sure about if "$K" is empty what to do with "$config_file". I killed that shell script in a later patch and now aconf recognize the named option. But the serie needs to be redone anyway - so lets see what I come up with. Sam ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] kconfig: add support for K=file 2008-05-10 21:10 ` Sam Ravnborg @ 2008-05-10 21:50 ` Oleg Verych 0 siblings, 0 replies; 18+ messages in thread From: Oleg Verych @ 2008-05-10 21:50 UTC (permalink / raw) To: kbuild list Sam Ravnborg @ Sat, 10 May 2008 23:10:07 +0200 > I killed that shell script in a later patch and now > aconf recognize the named option. Well, good example of wasting time without any kind of patch-tracking system. At least git-mail-notification in the thread about reverts of whole patches and drops of particular files/changes (per patch basis)... Or maybe just to start using `git` (with all that traffic fun)? ____ ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: kconfig frontend updates 2008-05-02 20:47 kconfig frontend updates Sam Ravnborg 2008-05-02 20:49 ` [PATCH] kconfig: add support for K=file sam @ 2008-05-02 21:01 ` Sam Ravnborg 2008-05-04 18:57 ` Sam Ravnborg 2 siblings, 0 replies; 18+ messages in thread From: Sam Ravnborg @ 2008-05-02 21:01 UTC (permalink / raw) To: linux-kbuild, LKML, Roman Zippel On Fri, May 02, 2008 at 10:47:29PM +0200, Sam Ravnborg wrote: > 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 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: kconfig frontend updates 2008-05-02 20:47 kconfig frontend updates Sam Ravnborg 2008-05-02 20:49 ` [PATCH] kconfig: add support for K=file sam 2008-05-02 21:01 ` kconfig frontend updates Sam Ravnborg @ 2008-05-04 18:57 ` Sam Ravnborg 2008-05-04 18:59 ` [PATCH 1/2] kconfig: introduce K= support Sam Ravnborg 2008-05-04 18:59 ` [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c Sam Ravnborg 2 siblings, 2 replies; 18+ messages in thread From: Sam Ravnborg @ 2008-05-04 18:57 UTC (permalink / raw) To: linux-kbuild, LKML, Roman Zippel On Fri, May 02, 2008 at 10:47:29PM +0200, Sam Ravnborg wrote: > 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. 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/2] kconfig: introduce K= support 2008-05-04 18:57 ` Sam Ravnborg @ 2008-05-04 18:59 ` Sam Ravnborg 2008-05-06 2:55 ` Roman Zippel 2008-05-04 18:59 ` [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c Sam Ravnborg 1 sibling, 1 reply; 18+ messages in thread From: Sam Ravnborg @ 2008-05-04 18:59 UTC (permalink / raw) To: linux-kbuild, LKML, Roman Zippel 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 possible. "make allnoconfig" Create a ./.config file by setting symbol values to 'n' as much as possible. + "make alldefconfig" + Create a configuration with default values. "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. - + The allyesconfig/allmodconfig/allnoconfig/alldefconfig/randconfig + variants can be tweaked using a base confguration that can be + set either using the syntax: + + make K=base-config allnoconfig + + Or using the environment variable KCONFIG_ALLCONFIG. + K= in the example is also used as an environment variable and an + assignment to K takes precendence over a KCONFIG_ALLCONFIG assignment. + NOTES on "make config": - having unnecessary drivers will make the kernel bigger, and can under some circumstances lead to problems: probing for a 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 diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index fa1a7d5..70b329d 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -47,30 +47,37 @@ 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 support +# +aconf-targets := allnoconfig allyesconfig allmodconfig alldefconfig randconfig +PHONY += $(aconf-targets) defconfig + +# Optional base file for aconf +# K= have precedence over KCONFIG_ALLCONFIG +aconf-file := $(if $(KCONFIG_ALLCONFIG),-b $(KCONFIG_ALLCONFIG)) +aconf-file := $(if $(K),-b $(K), $(aconf-file)) +$(aconf-targets): $(obj)/aconf + $< $@ $(aconf-file) $(Kconfig) + +# Targets named *_defconfig may be located in arch/.../configs/ +# but try current dir first and always fallback to current dir +archdef = arch/$(SRCARCH)/configs/$@ +aconf-archdef = $(if $(wildcard $(archdef)),$(if $(wildcard $@),$@,$(archdef)),$@) +%_defconfig: $(obj)/aconf + $< alldefconfig -b $(aconf-archdef) $(Kconfig) + +# An arch may use KBUILD_DEFCONFIG to specify defconfig file +# fallback to arch/$ARCH/defconfig +defconfig-file := $(if $(KBUILD_DEFCONFIG), \ + arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG), \ + arch/$(SRCARCH)/defconfig) +defconfig-file := $(strip $(defconfig-file)) + +defconfig: $(obj)/aconf + $< alldefconfig -b $(defconfig-file) $(Kconfig) -randconfig: $(obj)/conf - $< -r $(Kconfig) - -allyesconfig: $(obj)/conf - $< -y $(Kconfig) - -allnoconfig: $(obj)/conf - $< -n $(Kconfig) - -allmodconfig: $(obj)/conf - $< -m $(Kconfig) - -defconfig: $(obj)/conf -ifeq ($(KBUILD_DEFCONFIG),) - $< -d $(Kconfig) -else - @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" - $(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) -endif - -%_defconfig: $(obj)/conf - $(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig) # Help text used by make help help: @@ -78,13 +85,14 @@ help: @echo ' menuconfig - Update current config utilising a menu based program' @echo ' xconfig - Update current config utilising a QT based front-end' @echo ' gconfig - Update current config utilising a GTK based front-end' - @echo ' oldconfig - Update current config utilising a provided .config as base' - @echo ' silentoldconfig - Same as oldconfig, but quietly' - @echo ' randconfig - New config with random answer to all options' - @echo ' defconfig - New config with default answer to all options' - @echo ' allmodconfig - New config selecting modules when possible' - @echo ' allyesconfig - New config where all options are accepted with yes' - @echo ' allnoconfig - New config where all options are answered with no' + @echo ' oldconfig - Update current config utilising .config as base' + @echo ' defconfig - New config based on arch specific base configuration' + @echo ' randconfig - New config with random values for all symbols' + @echo ' allnoconfig - New config where all values are set to no' + @echo ' allyesconfig - New config where all values are set to yes' + @echo ' allmodconfig - New config where all values are set to module' + @echo ' alldefconfig - New config where all values has their default value' + @echo ' For randconfig and all*config targets use K=file to specify a base configuration' # lxdialog stuff check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh @@ -100,6 +108,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 +121,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 diff --git a/scripts/kconfig/aconf.c b/scripts/kconfig/aconf.c new file mode 100644 index 0000000..cf05861 --- /dev/null +++ b/scripts/kconfig/aconf.c @@ -0,0 +1,317 @@ +/* + * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> + * Copyright (C) 2008 Sam Ravnborg <sam@ravnborg.org> + * 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 +} default_value; + + +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) && (default_value != 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) && (default_value != set_default)) + return; + + type = sym_get_type(sym); + switch (default_value) { + 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; + 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 (default_value) { + 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; + 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); +} + +static void usage(void) +{ + printf(_("usage: aconf COMMAND [-b config_file] Kconfig\n")); + printf("\n"); + printf(_("The supported commands are:\n")); + printf(_(" allnoconfig set as many values as possible to 'n'\n")); + printf(_(" allyesconfig set as many values as possible to 'y'\n")); + printf(_(" allmodconfig set as many values as possible to 'm'\n")); + printf(_(" alldefconfig set all vaues to their default value\n")); + printf(_(" randconfig select a random value for all value\n")); + printf("\n"); + printf(_(" -b file optional base configuration\n")); + printf(_(" Kconfig the kconfig configuration\n")); + printf("\n"); + printf(_(" Output is stored in .config (if not overridden by KCONFIG_CONFIG)\n")); + printf("\n"); +} + +int main(int ac, char **av) +{ + char *config_file = NULL; + char *kconfig_file = NULL; + struct stat tmpstat; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + if (ac < 2) { + usage(); + exit(1); + } + if (strcmp(av[1], "allnoconfig") == 0) + default_value = set_no; + else if (strcmp(av[1], "allyesconfig") == 0) + default_value = set_yes; + else if (strcmp(av[1], "allmodconfig") == 0) + default_value = set_mod; + else if (strcmp(av[1], "alldefconfig") == 0) + default_value = set_default; + else if (strcmp(av[1], "randconfig") == 0) { + default_value = set_random; + srand(time(NULL)); + } else { + usage(); + exit(1); + } + if (strcmp(av[2], "-b") == 0) { + config_file = av[3]; + kconfig_file = av[4]; + } else { + kconfig_file = av[2]; + } + if (!kconfig_file) { + fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]); + exit(1); + } + conf_parse(kconfig_file); + /* debug: zconfdump(stdout); */ + if (config_file && stat(config_file, &tmpstat)) { + fprintf(stderr, _("%s: failed to open %s\n"), + av[0], config_file); + exit(1); + } + if (config_file && conf_read_simple(config_file, S_DEF_USER)) { + fprintf(stderr, _("%s: failed to read %s\n"), + av[0], config_file); + exit(1); + } + if (config_file) { + printf("#\n"); + printf(_("# configuration is based on '%s'\n"), config_file); + } + /* generate the config */ + do { + conf_cnt = 0; + check_conf(&rootmenu); + } while (conf_cnt); + /* write out the config */ + if (conf_write(NULL) || conf_write_autoconf()) { + fprintf(stderr, + _("%s: error during write of the configuration.\n"), + av[0]); + exit(1); + } + return 0; +} -- 1.5.4.1.143.ge7e51 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/2] kconfig: introduce K= support 2008-05-04 18:59 ` [PATCH 1/2] kconfig: introduce K= support Sam Ravnborg @ 2008-05-06 2:55 ` Roman Zippel 2008-05-06 4:34 ` Sam Ravnborg 0 siblings, 1 reply; 18+ messages in thread From: Roman Zippel @ 2008-05-06 2:55 UTC (permalink / raw) To: Sam Ravnborg; +Cc: linux-kbuild, LKML 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 symbols to 'm'. > +# An arch may use KBUILD_DEFCONFIG to specify defconfig file > +# fallback to arch/$ARCH/defconfig > +defconfig-file := $(if $(KBUILD_DEFCONFIG), \ > + arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG), \ > + arch/$(SRCARCH)/defconfig) > +defconfig-file := $(strip $(defconfig-file)) init/Kconfig has a DEFCONFIG_LIST which is intended to be used for this. > + if (ac < 2) { > + usage(); > + exit(1); > + } > + if (strcmp(av[1], "allnoconfig") == 0) > + default_value = set_no; > + else if (strcmp(av[1], "allyesconfig") == 0) > + default_value = set_yes; > + else if (strcmp(av[1], "allmodconfig") == 0) > + default_value = set_mod; > + else if (strcmp(av[1], "alldefconfig") == 0) > + default_value = set_default; > + else if (strcmp(av[1], "randconfig") == 0) { > + default_value = set_random; > + srand(time(NULL)); > + } else { > + usage(); > + exit(1); > + } > + if (strcmp(av[2], "-b") == 0) { > + config_file = av[3]; > + kconfig_file = av[4]; > + } else { > + kconfig_file = av[2]; > + } 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 def_no: + sym->def[S_DEF_USER].tri = no; + break; + case def_random: + sym->def[S_DEF_USER].tri = (tristate)(rand() % 3); + break; + default: + continue; + } + if (!sym_is_choice(sym) || mode != def_random) + sym->flags |= SYMBOL_DEF_USER; + break; + default: + break; + } + + } + + if (modules_sym) + sym_calc_value(modules_sym); + + if (mode != def_random) + return; + + for_all_symbols(i, csym) { + if (sym_has_value(csym) || !sym_is_choice(csym)) + continue; + + sym_calc_value(csym); + prop = sym_get_choice_prop(csym); + def = -1; + while (1) { + cnt = 0; + expr_list_for_each_sym(prop->expr, e, sym) { + if (sym->visible == no) + continue; + if (def == cnt++) { + csym->def[S_DEF_USER].val = sym; + break; + } + } + if (def >= 0 || cnt < 2) + break; + def = (rand() % cnt) + 1; + } + csym->flags |= SYMBOL_DEF_USER; + } +} Index: linux-2.6/scripts/kconfig/lkc.h =================================================================== --- linux-2.6.orig/scripts/kconfig/lkc.h +++ linux-2.6/scripts/kconfig/lkc.h @@ -42,6 +42,14 @@ extern "C" { #define TF_PARAM 0x0002 #define TF_OPTION 0x0004 +enum conf_def_mode { + def_default, + def_yes, + def_mod, + def_no, + def_random +}; + #define T_OPT_MODULES 1 #define T_OPT_DEFCONFIG_LIST 2 #define T_OPT_ENV 3 @@ -69,6 +77,7 @@ const char *conf_get_configname(void); 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); /* kconfig_load.c */ void kconfig_load(void); ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/2] kconfig: introduce K= support 2008-05-06 2:55 ` Roman Zippel @ 2008-05-06 4:34 ` Sam Ravnborg 0 siblings, 0 replies; 18+ messages in thread From: Sam Ravnborg @ 2008-05-06 4:34 UTC (permalink / raw) To: Roman Zippel; +Cc: linux-kbuild, LKML On Tue, May 06, 2008 at 04:55:55AM +0200, Roman Zippel wrote: > 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 > symbols to 'm'. Thanks. I will rework the patch to use this function. > > > +# An arch may use KBUILD_DEFCONFIG to specify defconfig file > > +# fallback to arch/$ARCH/defconfig > > +defconfig-file := $(if $(KBUILD_DEFCONFIG), \ > > + arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG), \ > > + arch/$(SRCARCH)/defconfig) > > +defconfig-file := $(strip $(defconfig-file)) > > init/Kconfig has a DEFCONFIG_LIST which is intended to be used for this. 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. I will try it out. > > > + if (ac < 2) { > > + usage(); > > + exit(1); > > + } > > + if (strcmp(av[1], "allnoconfig") == 0) > > + default_value = set_no; > > + else if (strcmp(av[1], "allyesconfig") == 0) > > + default_value = set_yes; > > + else if (strcmp(av[1], "allmodconfig") == 0) > > + default_value = set_mod; > > + else if (strcmp(av[1], "alldefconfig") == 0) > > + default_value = set_default; > > + else if (strcmp(av[1], "randconfig") == 0) { > > + default_value = set_random; > > + srand(time(NULL)); > > + } else { > > + usage(); > > + exit(1); > > + } > > + if (strcmp(av[2], "-b") == 0) { > > + config_file = av[3]; > > + kconfig_file = av[4]; > > + } else { > > + kconfig_file = av[2]; > > + } > > Even if it has only a single option, please keep using getopt(). 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c 2008-05-04 18:57 ` Sam Ravnborg 2008-05-04 18:59 ` [PATCH 1/2] kconfig: introduce K= support Sam Ravnborg @ 2008-05-04 18:59 ` Sam Ravnborg 2008-05-06 3:08 ` Roman Zippel 1 sibling, 1 reply; 18+ messages in thread From: Sam Ravnborg @ 2008-05-04 18:59 UTC (permalink / raw) To: linux-kbuild, LKML, Roman Zippel 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 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 fda6313..263165d 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -21,14 +21,7 @@ static void check_conf(struct menu *menu); 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; @@ -65,18 +58,17 @@ static void strip(char *str) static void check_stdin(void) { - if (!valid_stdin && input_mode == ask_silent) { - printf(_("aborted!\n\n")); - printf(_("Console input/output is redirected. ")); - printf(_("Run 'make oldconfig' to update configuration.\n\n")); - exit(1); - } + if (valid_stdin) + return; + fprintf(stderr, _("aborted!\n\n")); + fprintf(stderr, _("Console input/output is redirected. ")); + fprintf(stderr, _("Run 'make oldconfig' to update configuration.\n\n")); + exit(1); } static int conf_askvalue(struct symbol *sym, const char *def) { enum symbol_type type = sym_get_type(sym); - tristate val; if (!sym_has_value(sym)) printf(_("(NEW) ")); @@ -91,32 +83,17 @@ static int conf_askvalue(struct symbol *sym, const char *def) return 0; } + check_stdin(); switch (input_mode) { - case set_no: - case set_mod: - case set_yes: - case set_random: - if (sym_has_value(sym)) { - printf("%s\n", def); - return 0; - } - break; case ask_new: - case ask_silent: if (sym_has_value(sym)) { printf("%s\n", def); return 0; } - check_stdin(); case ask_all: fflush(stdout); fgets(line, 128, stdin); return 1; - case set_default: - printf("%s\n", def); - return 1; - default: - break; } switch (type) { @@ -128,52 +105,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) default: ; } - switch (input_mode) { - case set_yes: - if (sym_tristate_within_range(sym, yes)) { - line[0] = 'y'; - line[1] = '\n'; - line[2] = 0; - break; - } - case set_mod: - if (type == S_TRISTATE) { - if (sym_tristate_within_range(sym, mod)) { - line[0] = 'm'; - line[1] = '\n'; - line[2] = 0; - break; - } - } else { - if (sym_tristate_within_range(sym, yes)) { - line[0] = 'y'; - line[1] = '\n'; - line[2] = 0; - break; - } - } - case set_no: - if (sym_tristate_within_range(sym, no)) { - line[0] = 'n'; - line[1] = '\n'; - line[2] = 0; - break; - } - case set_random: - do { - val = (tristate)(rand() % 3); - } while (!sym_tristate_within_range(sym, val)); - switch (val) { - case no: line[0] = 'n'; break; - case mod: line[0] = 'm'; break; - case yes: line[0] = 'y'; break; - } - line[1] = '\n'; - line[2] = 0; - break; - default: - break; - } printf("%s", line); return 1; } @@ -352,7 +283,6 @@ static int conf_choice(struct menu *menu) printf("]: "); switch (input_mode) { case ask_new: - case ask_silent: if (!is_new) { cnt = def; printf("%d\n", cnt); @@ -374,16 +304,6 @@ static int conf_choice(struct menu *menu) else continue; break; - case set_random: - if (is_new) - def = (rand() % cnt) + 1; - case set_default: - case set_yes: - case set_mod: - case set_no: - cnt = def; - printf("%d\n", cnt); - break; } conf_childs: @@ -425,7 +345,7 @@ static void conf(struct menu *menu) switch (prop->type) { case P_MENU: - if (input_mode == ask_silent && rootEntry != menu) { + if (input_mode != ask_all && rootEntry != menu) { check_conf(menu); return; } @@ -504,35 +424,13 @@ int main(int ac, char **av) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { + valid_stdin = isatty(0) && isatty(1) && isatty(2); + + while ((opt = getopt(ac, av, "oh")) != -1) { switch (opt) { case 'o': input_mode = ask_new; break; - case 's': - input_mode = ask_silent; - valid_stdin = isatty(0) && isatty(1) && isatty(2); - break; - 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); @@ -550,17 +448,7 @@ int main(int ac, char **av) 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 ask_silent: + case ask_new: if (stat(".config", &tmpstat)) { printf(_("***\n" "*** You have not yet configured your kernel!\n" @@ -572,41 +460,13 @@ int main(int ac, char **av) exit(1); } case ask_all: - case ask_new: conf_read(NULL); 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; } - if (input_mode != ask_silent) { + if (input_mode == ask_all) { rootEntry = &rootmenu; conf(&rootmenu); - if (input_mode == ask_all) { - input_mode = ask_silent; - valid_stdin = 1; - } } else if (conf_get_changed()) { name = getenv("KCONFIG_NOSILENTUPDATE"); if (name && *name) { @@ -625,7 +485,7 @@ int main(int ac, char **av) return 1; } skip_check: - if (input_mode == ask_silent && conf_write_autoconf()) { + if (conf_write_autoconf()) { fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); return 1; } -- 1.5.4.1.143.ge7e51 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c 2008-05-04 18:59 ` [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c Sam Ravnborg @ 2008-05-06 3:08 ` Roman Zippel 2008-05-06 4:37 ` Sam Ravnborg 2008-05-06 9:03 ` Jan Engelhardt 0 siblings, 2 replies; 18+ messages in thread From: Roman Zippel @ 2008-05-06 3:08 UTC (permalink / raw) To: Sam Ravnborg; +Cc: linux-kbuild, LKML Hi, On Sun, 4 May 2008, Sam Ravnborg wrote: > We now check for valid stadin in both cases and this > may break a script here and there. 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 oldconfig". > - 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; > } This isn't yet in aconf.c. bye, Roman ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c 2008-05-06 3:08 ` Roman Zippel @ 2008-05-06 4:37 ` Sam Ravnborg 2008-05-06 9:03 ` Jan Engelhardt 1 sibling, 0 replies; 18+ messages in thread From: Sam Ravnborg @ 2008-05-06 4:37 UTC (permalink / raw) To: Roman Zippel; +Cc: linux-kbuild, LKML On Tue, May 06, 2008 at 05:08:40AM +0200, Roman Zippel wrote: > Hi, > > On Sun, 4 May 2008, Sam Ravnborg wrote: > > > We now check for valid stadin in both cases and this > > may break a script here and there. > > 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 > oldconfig". 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 it so. > > > - 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; > > } > > This isn't yet in aconf.c. 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c 2008-05-06 3:08 ` Roman Zippel 2008-05-06 4:37 ` Sam Ravnborg @ 2008-05-06 9:03 ` Jan Engelhardt 1 sibling, 0 replies; 18+ messages in thread From: Jan Engelhardt @ 2008-05-06 9:03 UTC (permalink / raw) To: Roman Zippel; +Cc: Sam Ravnborg, linux-kbuild, LKML On Tuesday 2008-05-06 05:08, Roman Zippel wrote: > >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 >oldconfig". 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). ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2008-05-10 21:29 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-02 20:47 kconfig frontend updates Sam Ravnborg 2008-05-02 20:49 ` [PATCH] kconfig: add support for K=file sam 2008-05-02 20:49 ` [PATCH] kconfig: drop all*config support in conf.c sam 2008-05-02 20:49 ` [PATCH] kconfig: conf is less chatty sam 2008-05-02 20:49 ` [PATCH] kconfig: .gitignore aconf sam 2008-05-02 20:49 ` [PATCH] kconfig: kill the warning "trying to assign nonexistent symbol" sam 2008-05-10 21:25 ` [PATCH] kconfig: add support for K=file Oleg Verych 2008-05-10 21:10 ` Sam Ravnborg 2008-05-10 21:50 ` Oleg Verych 2008-05-02 21:01 ` kconfig frontend updates Sam Ravnborg 2008-05-04 18:57 ` Sam Ravnborg 2008-05-04 18:59 ` [PATCH 1/2] kconfig: introduce K= support Sam Ravnborg 2008-05-06 2:55 ` Roman Zippel 2008-05-06 4:34 ` Sam Ravnborg 2008-05-04 18:59 ` [PATCH 2/2] kconfig: make oldconfig less chatty and clean up conf.c Sam Ravnborg 2008-05-06 3:08 ` Roman Zippel 2008-05-06 4:37 ` Sam Ravnborg 2008-05-06 9:03 ` Jan Engelhardt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox