modify the kconfig system for openwrt

SVN-Revision: 3683
master
Felix Fietkau 19 years ago
parent 43ebd5a027
commit 6890e33a69
  1. 8
      openwrt/scripts/config/Makefile
  2. 2
      openwrt/scripts/config/README
  3. 4
      openwrt/scripts/config/conf.c
  4. 14
      openwrt/scripts/config/confdata.c
  5. 38
      openwrt/scripts/config/mconf.c
  6. 3
      openwrt/scripts/config/menu.c
  7. 13
      openwrt/scripts/config/symbol.c
  8. 2
      openwrt/scripts/config/zconf.tab.c_shipped
  9. 2
      openwrt/scripts/config/zconf.y

@ -1,5 +1,5 @@
# =========================================================================== # ===========================================================================
# Kernel configuration targets # OpenWrt configuration targets
# These targets are used from top-level makefile # These targets are used from top-level makefile
# =========================================================================== # ===========================================================================
@ -40,10 +40,10 @@ lex.zconf.c: zconf.l
zconf.hash.c: zconf.gperf zconf.hash.c: zconf.gperf
%.tab.c: %.y %.tab.c: %.y
bison -l -b $* -p $(notdir $*) $< && cp $@ $@_shipped || cp $@_shipped $@ cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
lex.%.c: %.l lex.%.c: %.l
flex -L -P$(notdir $*) -o$@ $< && cp $@ $@_shipped || cp $@_shipped $@ cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
%.hash.c: %.gperf %.hash.c: %.gperf
gperf < $< > $@ && cp $@ $@_shipped || cp $@_shipped $@ cp $@_shipped $@ || gperf < $< > $@

@ -0,0 +1,2 @@
These files were taken from the Linux 2.6.16.7 Kernel
Configuration System and modified for the OpenWrt Buildroot.

@ -570,7 +570,7 @@ int main(int ac, char **av)
case ask_silent: case ask_silent:
if (stat(".config", &tmpstat)) { if (stat(".config", &tmpstat)) {
printf(_("***\n" printf(_("***\n"
"*** You have not yet configured your kernel!\n" "*** You have not yet configured your build!\n"
"***\n" "***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n" "*** \"make menuconfig\" or \"make xconfig\").\n"
@ -619,7 +619,7 @@ int main(int ac, char **av)
check_conf(&rootmenu); check_conf(&rootmenu);
} while (conf_cnt); } while (conf_cnt);
if (conf_write(NULL)) { if (conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); fprintf(stderr, _("\n*** Error during writing of the build configuration.\n\n"));
return 1; return 1;
} }
return 0; return 0;

@ -22,13 +22,10 @@ static int conf_lineno, conf_warnings, conf_unsaved;
const char conf_def_filename[] = ".config"; const char conf_def_filename[] = ".config";
const char conf_defname[] = "arch/$ARCH/defconfig"; const char conf_defname[] = "scripts/config/defconfig";
const char *conf_confnames[] = { const char *conf_confnames[] = {
".config", ".config",
"/lib/modules/$UNAME_RELEASE/.config",
"/etc/kernel-config",
"/boot/config-$UNAME_RELEASE",
conf_defname, conf_defname,
NULL, NULL,
}; };
@ -375,7 +372,7 @@ int conf_write(const char *name)
if (!out_h) if (!out_h)
return 1; return 1;
} }
sym = sym_lookup("KERNELVERSION", 0); sym = sym_lookup("OPENWRTVERSION", 0);
sym_calc_value(sym); sym_calc_value(sym);
time(&now); time(&now);
env = getenv("KCONFIG_NOTIMESTAMP"); env = getenv("KCONFIG_NOTIMESTAMP");
@ -384,7 +381,7 @@ int conf_write(const char *name)
fprintf(out, _("#\n" fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n" "# Automatically generated make config: don't edit\n"
"# Linux kernel version: %s\n" "# OpenWrt version: %s\n"
"%s%s" "%s%s"
"#\n"), "#\n"),
sym_get_string_value(sym), sym_get_string_value(sym),
@ -393,7 +390,7 @@ int conf_write(const char *name)
if (out_h) if (out_h)
fprintf(out_h, "/*\n" fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n" " * Automatically generated C config: don't edit\n"
" * Linux kernel version: %s\n" " * OpenWrt version: %s\n"
"%s%s" "%s%s"
" */\n" " */\n"
"#define AUTOCONF_INCLUDED\n", "#define AUTOCONF_INCLUDED\n",
@ -428,8 +425,11 @@ int conf_write(const char *name)
type = sym->type; type = sym->type;
if (type == S_TRISTATE) { if (type == S_TRISTATE) {
sym_calc_value(modules_sym); sym_calc_value(modules_sym);
/* tristate always enabled */
#if 0
if (modules_sym->curr.tri == no) if (modules_sym->curr.tri == no)
type = S_BOOLEAN; type = S_BOOLEAN;
#endif
} }
switch (type) { switch (type) {
case S_BOOLEAN: case S_BOOLEAN:

@ -29,11 +29,9 @@ static char menu_backtitle[128];
static const char mconf_readme[] = N_( static const char mconf_readme[] = N_(
"Overview\n" "Overview\n"
"--------\n" "--------\n"
"Some kernel features may be built directly into the kernel.\n" "Some OpenWrt features may be built directly into the image.\n"
"Some may be made into loadable runtime modules. Some features\n" "Some may be made into installable ipkg packages. Some features\n"
"may be completely removed altogether. There are also certain\n" "may be completely removed altogether.\n"
"kernel parameters which are not really features, but must be\n"
"entered in as decimal or hexadecimal numbers or possibly text.\n"
"\n" "\n"
"Menu items beginning with [*], <M> or [ ] represent features\n" "Menu items beginning with [*], <M> or [ ] represent features\n"
"configured to be built in, modularized or removed respectively.\n" "configured to be built in, modularized or removed respectively.\n"
@ -115,7 +113,7 @@ static const char mconf_readme[] = N_(
"-----------------------------\n" "-----------------------------\n"
"Menuconfig supports the use of alternate configuration files for\n" "Menuconfig supports the use of alternate configuration files for\n"
"those who, for various reasons, find it necessary to switch\n" "those who, for various reasons, find it necessary to switch\n"
"between different kernel configurations.\n" "between different OpenWrt configurations.\n"
"\n" "\n"
"At the end of the main menu you will find two options. One is\n" "At the end of the main menu you will find two options. One is\n"
"for saving the current configuration to a file of your choosing.\n" "for saving the current configuration to a file of your choosing.\n"
@ -148,7 +146,7 @@ static const char mconf_readme[] = N_(
"\n" "\n"
"Optional personality available\n" "Optional personality available\n"
"------------------------------\n" "------------------------------\n"
"If you prefer to have all of the kernel options listed in a single\n" "If you prefer to have all of the build options listed in a single\n"
"menu, rather than the default multimenu hierarchy, run the menuconfig\n" "menu, rather than the default multimenu hierarchy, run the menuconfig\n"
"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n" "with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n" "\n"
@ -186,18 +184,18 @@ setmod_text[] = N_(
"This feature depends on another which has been configured as a module.\n" "This feature depends on another which has been configured as a module.\n"
"As a result, this feature will be built as a module."), "As a result, this feature will be built as a module."),
nohelp_text[] = N_( nohelp_text[] = N_(
"There is no help available for this kernel option.\n"), "There is no help available for this config option.\n"),
load_config_text[] = N_( load_config_text[] = N_(
"Enter the name of the configuration file you wish to load. " "Enter the name of the configuration file you wish to load. "
"Accept the name shown to restore the configuration you " "Accept the name shown to restore the configuration you "
"last retrieved. Leave blank to abort."), "last retrieved. Leave blank to abort."),
load_config_help[] = N_( load_config_help[] = N_(
"\n" "\n"
"For various reasons, one may wish to keep several different kernel\n" "For various reasons, one may wish to keep several different OpenWrt\n"
"configurations available on a single machine.\n" "configurations available on a single machine.\n"
"\n" "\n"
"If you have saved a previous configuration in a file other than the\n" "If you have saved a previous configuration in a file other than\n"
"kernel's default, entering the name of the file here will allow you\n" "OpenWrt's default, entering the name of the file here will allow you\n"
"to modify that configuration.\n" "to modify that configuration.\n"
"\n" "\n"
"If you are uncertain, then you have probably never used alternate\n" "If you are uncertain, then you have probably never used alternate\n"
@ -207,7 +205,7 @@ save_config_text[] = N_(
"as an alternate. Leave blank to abort."), "as an alternate. Leave blank to abort."),
save_config_help[] = N_( save_config_help[] = N_(
"\n" "\n"
"For various reasons, one may wish to keep different kernel\n" "For various reasons, one may wish to keep different OpenWrt\n"
"configurations available on a single machine.\n" "configurations available on a single machine.\n"
"\n" "\n"
"Entering a file name here will allow you to later retrieve, modify\n" "Entering a file name here will allow you to later retrieve, modify\n"
@ -1051,9 +1049,9 @@ int main(int ac, char **av)
conf_parse(av[1]); conf_parse(av[1]);
conf_read(NULL); conf_read(NULL);
sym = sym_lookup("KERNELVERSION", 0); sym = sym_lookup("OPENWRTVERSION", 0);
sym_calc_value(sym); sym_calc_value(sym);
sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"), sprintf(menu_backtitle, _("OpenWrt %s Configuration"),
sym_get_string_value(sym)); sym_get_string_value(sym));
mode = getenv("MENUCONFIG_MODE"); mode = getenv("MENUCONFIG_MODE");
@ -1070,7 +1068,7 @@ int main(int ac, char **av)
do { do {
cprint_init(); cprint_init();
cprint("--yesno"); cprint("--yesno");
cprint(_("Do you wish to save your new kernel configuration?")); cprint(_("Do you wish to save your new OpenWrt configuration?"));
cprint("5"); cprint("5");
cprint("60"); cprint("60");
stat = exec_conf(); stat = exec_conf();
@ -1079,18 +1077,18 @@ int main(int ac, char **av)
if (stat == 0) { if (stat == 0) {
if (conf_write(NULL)) { if (conf_write(NULL)) {
fprintf(stderr, _("\n\n" fprintf(stderr, _("\n\n"
"Error during writing of the kernel configuration.\n" "Error during writing of the OpenWrt configuration.\n"
"Your kernel configuration changes were NOT saved." "Your configuration changes were NOT saved."
"\n\n")); "\n\n"));
return 1; return 1;
} }
printf(_("\n\n" printf(_("\n\n"
"*** End of Linux kernel configuration.\n" "*** End of OpenWrt configuration.\n"
"*** Execute 'make' to build the kernel or try 'make help'." "*** Execute 'make' to build the OpenWrt or try 'make help'."
"\n\n")); "\n\n"));
} else { } else {
fprintf(stderr, _("\n\n" fprintf(stderr, _("\n\n"
"Your kernel configuration changes were NOT saved." "Your configuration changes were NOT saved."
"\n\n")); "\n\n"));
} }

@ -88,11 +88,14 @@ struct expr *menu_check_dep(struct expr *e)
e->left.expr = menu_check_dep(e->left.expr); e->left.expr = menu_check_dep(e->left.expr);
e->right.expr = menu_check_dep(e->right.expr); e->right.expr = menu_check_dep(e->right.expr);
break; break;
/* tristate always enabled */
#if 0
case E_SYMBOL: case E_SYMBOL:
/* change 'm' into 'm' && MODULES */ /* change 'm' into 'm' && MODULES */
if (e->left.sym == &symbol_mod) if (e->left.sym == &symbol_mod)
return expr_alloc_and(e, expr_alloc_symbol(modules_sym)); return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
break; break;
#endif
default: default:
break; break;
} }

@ -61,10 +61,10 @@ void sym_init(void)
if (p) if (p)
sym_add_default(sym, p); sym_add_default(sym, p);
sym = sym_lookup("KERNELVERSION", 0); sym = sym_lookup("OPENWRTVERSION", 0);
sym->type = S_STRING; sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO; sym->flags |= SYMBOL_AUTO;
p = getenv("KERNELVERSION"); p = getenv("OPENWRTVERSION");
if (p) if (p)
sym_add_default(sym, p); sym_add_default(sym, p);
@ -81,8 +81,11 @@ enum symbol_type sym_get_type(struct symbol *sym)
if (type == S_TRISTATE) { if (type == S_TRISTATE) {
if (sym_is_choice_value(sym) && sym->visible == yes) if (sym_is_choice_value(sym) && sym->visible == yes)
type = S_BOOLEAN; type = S_BOOLEAN;
/* tristate always enabled */
#if 0
else if (modules_val == no) else if (modules_val == no)
type = S_BOOLEAN; type = S_BOOLEAN;
#endif
} }
return type; return type;
} }
@ -201,7 +204,12 @@ static void sym_calc_visibility(struct symbol *sym)
prop->visible.tri = expr_calc_value(prop->visible.expr); prop->visible.tri = expr_calc_value(prop->visible.expr);
tri = E_OR(tri, prop->visible.tri); tri = E_OR(tri, prop->visible.tri);
} }
/* tristate always enabled */
#if 0
if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
#else
if (tri == mod && (sym->type != S_TRISTATE))
#endif
tri = yes; tri = yes;
if (sym->visible != tri) { if (sym->visible != tri) {
sym->visible = tri; sym->visible = tri;
@ -354,6 +362,7 @@ void sym_calc_value(struct symbol *sym)
if (memcmp(&oldval, &sym->curr, sizeof(oldval))) if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
sym_set_changed(sym); sym_set_changed(sym);
if (modules_sym == sym) if (modules_sym == sym)
modules_val = modules_sym->curr.tri; modules_val = modules_sym->curr.tri;

@ -1922,7 +1922,7 @@ void conf_parse(const char *name)
sym_init(); sym_init();
menu_init(); menu_init();
modules_sym = sym_lookup("MODULES", 0); modules_sym = sym_lookup("MODULES", 0);
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); rootmenu.prompt = menu_add_prompt(P_MENU, "OpenWrt Configuration", NULL);
#if YYDEBUG #if YYDEBUG
if (getenv("ZCONF_DEBUG")) if (getenv("ZCONF_DEBUG"))

@ -459,7 +459,7 @@ void conf_parse(const char *name)
sym_init(); sym_init();
menu_init(); menu_init();
modules_sym = sym_lookup("MODULES", 0); modules_sym = sym_lookup("MODULES", 0);
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); rootmenu.prompt = menu_add_prompt(P_MENU, "OpenWrt Configuration", NULL);
#if YYDEBUG #if YYDEBUG
if (getenv("ZCONF_DEBUG")) if (getenv("ZCONF_DEBUG"))

Loading…
Cancel
Save