From: Felix Fietkau <nbd@openwrt.org>
Date: Thu, 20 Apr 2006 21:00:14 +0000 (+0000)
Subject: modify the kconfig system for openwrt
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=6890e33a69b848932fe979b24fe54d397981cd1e;p=openwrt%2Fstaging%2Fthess.git

modify the kconfig system for openwrt

SVN-Revision: 3683
---

diff --git a/openwrt/scripts/config/Makefile b/openwrt/scripts/config/Makefile
index 04e8330a01..a731a40e7c 100644
--- a/openwrt/scripts/config/Makefile
+++ b/openwrt/scripts/config/Makefile
@@ -1,5 +1,5 @@
 # ===========================================================================
-# Kernel configuration targets
+# OpenWrt configuration targets
 # These targets are used from top-level makefile
 
 # ===========================================================================
@@ -40,10 +40,10 @@ lex.zconf.c: zconf.l
 zconf.hash.c: zconf.gperf
 
 %.tab.c: %.y
-	bison -l -b $* -p $(notdir $*) $< && cp $@ $@_shipped || cp $@_shipped $@
+	cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
 
 lex.%.c: %.l
-	flex -L -P$(notdir $*) -o$@ $< && cp $@ $@_shipped || cp $@_shipped $@
+	cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
 
 %.hash.c: %.gperf
-	gperf < $< > $@ && cp $@ $@_shipped || cp $@_shipped $@
+	cp $@_shipped $@ || gperf < $< > $@
diff --git a/openwrt/scripts/config/README b/openwrt/scripts/config/README
new file mode 100644
index 0000000000..54aaefb598
--- /dev/null
+++ b/openwrt/scripts/config/README
@@ -0,0 +1,2 @@
+These files were taken from the Linux 2.6.16.7 Kernel
+Configuration System and modified for the OpenWrt Buildroot.
diff --git a/openwrt/scripts/config/conf.c b/openwrt/scripts/config/conf.c
index 10eeae53d8..cb2093691e 100644
--- a/openwrt/scripts/config/conf.c
+++ b/openwrt/scripts/config/conf.c
@@ -570,7 +570,7 @@ int main(int ac, char **av)
 	case ask_silent:
 		if (stat(".config", &tmpstat)) {
 			printf(_("***\n"
-				"*** You have not yet configured your kernel!\n"
+				"*** You have not yet configured your build!\n"
 				"***\n"
 				"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
 				"*** \"make menuconfig\" or \"make xconfig\").\n"
@@ -619,7 +619,7 @@ int main(int ac, char **av)
 		check_conf(&rootmenu);
 	} while (conf_cnt);
 	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 0;
diff --git a/openwrt/scripts/config/confdata.c b/openwrt/scripts/config/confdata.c
index b0cbbe2e41..a1abdeb087 100644
--- a/openwrt/scripts/config/confdata.c
+++ b/openwrt/scripts/config/confdata.c
@@ -22,13 +22,10 @@ static int conf_lineno, conf_warnings, conf_unsaved;
 
 const char conf_def_filename[] = ".config";
 
-const char conf_defname[] = "arch/$ARCH/defconfig";
+const char conf_defname[] = "scripts/config/defconfig";
 
 const char *conf_confnames[] = {
 	".config",
-	"/lib/modules/$UNAME_RELEASE/.config",
-	"/etc/kernel-config",
-	"/boot/config-$UNAME_RELEASE",
 	conf_defname,
 	NULL,
 };
@@ -375,7 +372,7 @@ int conf_write(const char *name)
 		if (!out_h)
 			return 1;
 	}
-	sym = sym_lookup("KERNELVERSION", 0);
+	sym = sym_lookup("OPENWRTVERSION", 0);
 	sym_calc_value(sym);
 	time(&now);
 	env = getenv("KCONFIG_NOTIMESTAMP");
@@ -384,7 +381,7 @@ int conf_write(const char *name)
 
 	fprintf(out, _("#\n"
 		       "# Automatically generated make config: don't edit\n"
-		       "# Linux kernel version: %s\n"
+		       "# OpenWrt version: %s\n"
 		       "%s%s"
 		       "#\n"),
 		     sym_get_string_value(sym),
@@ -393,7 +390,7 @@ int conf_write(const char *name)
 	if (out_h)
 		fprintf(out_h, "/*\n"
 			       " * Automatically generated C config: don't edit\n"
-			       " * Linux kernel version: %s\n"
+			       " * OpenWrt version: %s\n"
 			       "%s%s"
 			       " */\n"
 			       "#define AUTOCONF_INCLUDED\n",
@@ -428,8 +425,11 @@ int conf_write(const char *name)
 			type = sym->type;
 			if (type == S_TRISTATE) {
 				sym_calc_value(modules_sym);
+/* tristate always enabled */
+#if 0
 				if (modules_sym->curr.tri == no)
 					type = S_BOOLEAN;
+#endif
 			}
 			switch (type) {
 			case S_BOOLEAN:
diff --git a/openwrt/scripts/config/mconf.c b/openwrt/scripts/config/mconf.c
index bb82bbe49f..69cd56f138 100644
--- a/openwrt/scripts/config/mconf.c
+++ b/openwrt/scripts/config/mconf.c
@@ -29,11 +29,9 @@ static char menu_backtitle[128];
 static const char mconf_readme[] = N_(
 "Overview\n"
 "--------\n"
-"Some kernel features may be built directly into the kernel.\n"
-"Some may be made into loadable runtime modules.  Some features\n"
-"may be completely removed altogether.  There are also certain\n"
-"kernel parameters which are not really features, but must be\n"
-"entered in as decimal or hexadecimal numbers or possibly text.\n"
+"Some OpenWrt features may be built directly into the image.\n"
+"Some may be made into installable ipkg packages. Some features\n"
+"may be completely removed altogether.\n"
 "\n"
 "Menu items beginning with [*], <M> or [ ] represent features\n"
 "configured to be built in, modularized or removed respectively.\n"
@@ -115,7 +113,7 @@ static const char mconf_readme[] = N_(
 "-----------------------------\n"
 "Menuconfig supports the use of alternate configuration files for\n"
 "those who, for various reasons, find it necessary to switch\n"
-"between different kernel configurations.\n"
+"between different OpenWrt configurations.\n"
 "\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"
@@ -148,7 +146,7 @@ static const char mconf_readme[] = N_(
 "\n"
 "Optional personality available\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"
 "with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
 "\n"
@@ -186,18 +184,18 @@ setmod_text[] = 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."),
 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_(
 	"Enter the name of the configuration file you wish to load.  "
 	"Accept the name shown to restore the configuration you "
 	"last retrieved.  Leave blank to abort."),
 load_config_help[] = 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"
 	"\n"
-	"If you have saved a previous configuration in a file other than the\n"
-	"kernel's default, entering the name of the file here will allow you\n"
+	"If you have saved a previous configuration in a file other than\n"
+	"OpenWrt's default, entering the name of the file here will allow you\n"
 	"to modify that configuration.\n"
 	"\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."),
 save_config_help[] = 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"
 	"\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_read(NULL);
 
-	sym = sym_lookup("KERNELVERSION", 0);
+	sym = sym_lookup("OPENWRTVERSION", 0);
 	sym_calc_value(sym);
-	sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
+	sprintf(menu_backtitle, _("OpenWrt %s Configuration"),
 		sym_get_string_value(sym));
 
 	mode = getenv("MENUCONFIG_MODE");
@@ -1070,7 +1068,7 @@ int main(int ac, char **av)
 	do {
 		cprint_init();
 		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("60");
 		stat = exec_conf();
@@ -1079,18 +1077,18 @@ int main(int ac, char **av)
 	if (stat == 0) {
 		if (conf_write(NULL)) {
 			fprintf(stderr, _("\n\n"
-				"Error during writing of the kernel configuration.\n"
-				"Your kernel configuration changes were NOT saved."
+				"Error during writing of the OpenWrt configuration.\n"
+				"Your configuration changes were NOT saved."
 				"\n\n"));
 			return 1;
 		}
 		printf(_("\n\n"
-			"*** End of Linux kernel configuration.\n"
-			"*** Execute 'make' to build the kernel or try 'make help'."
+			"*** End of OpenWrt configuration.\n"
+			"*** Execute 'make' to build the OpenWrt or try 'make help'."
 			"\n\n"));
 	} else {
 		fprintf(stderr, _("\n\n"
-			"Your kernel configuration changes were NOT saved."
+			"Your configuration changes were NOT saved."
 			"\n\n"));
 	}
 
diff --git a/openwrt/scripts/config/menu.c b/openwrt/scripts/config/menu.c
index 0fce20cb7f..20fda9b2fc 100644
--- a/openwrt/scripts/config/menu.c
+++ b/openwrt/scripts/config/menu.c
@@ -88,11 +88,14 @@ struct expr *menu_check_dep(struct expr *e)
 		e->left.expr = menu_check_dep(e->left.expr);
 		e->right.expr = menu_check_dep(e->right.expr);
 		break;
+/* tristate always enabled */
+#if 0
 	case E_SYMBOL:
 		/* change 'm' into 'm' && MODULES */
 		if (e->left.sym == &symbol_mod)
 			return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
 		break;
+#endif
 	default:
 		break;
 	}
diff --git a/openwrt/scripts/config/symbol.c b/openwrt/scripts/config/symbol.c
index 3d7877afcc..b79d81ac13 100644
--- a/openwrt/scripts/config/symbol.c
+++ b/openwrt/scripts/config/symbol.c
@@ -61,10 +61,10 @@ void sym_init(void)
 	if (p)
 		sym_add_default(sym, p);
 
-	sym = sym_lookup("KERNELVERSION", 0);
+	sym = sym_lookup("OPENWRTVERSION", 0);
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
-	p = getenv("KERNELVERSION");
+	p = getenv("OPENWRTVERSION");
 	if (p)
 		sym_add_default(sym, p);
 
@@ -81,8 +81,11 @@ enum symbol_type sym_get_type(struct symbol *sym)
 	if (type == S_TRISTATE) {
 		if (sym_is_choice_value(sym) && sym->visible == yes)
 			type = S_BOOLEAN;
+/* tristate always enabled */
+#if 0
 		else if (modules_val == no)
 			type = S_BOOLEAN;
+#endif
 	}
 	return type;
 }
@@ -201,7 +204,12 @@ static void sym_calc_visibility(struct symbol *sym)
 		prop->visible.tri = expr_calc_value(prop->visible.expr);
 		tri = E_OR(tri, prop->visible.tri);
 	}
+/* tristate always enabled */
+#if 0
 	if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
+#else
+	if (tri == mod && (sym->type != S_TRISTATE))
+#endif
 		tri = yes;
 	if (sym->visible != tri) {
 		sym->visible = tri;
@@ -354,6 +362,7 @@ void sym_calc_value(struct symbol *sym)
 
 	if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
 		sym_set_changed(sym);
+
 	if (modules_sym == sym)
 		modules_val = modules_sym->curr.tri;
 
diff --git a/openwrt/scripts/config/zconf.tab.c_shipped b/openwrt/scripts/config/zconf.tab.c_shipped
index dbf1e039ed..8060dc6a06 100644
--- a/openwrt/scripts/config/zconf.tab.c_shipped
+++ b/openwrt/scripts/config/zconf.tab.c_shipped
@@ -1922,7 +1922,7 @@ void conf_parse(const char *name)
 	sym_init();
 	menu_init();
 	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 (getenv("ZCONF_DEBUG"))
diff --git a/openwrt/scripts/config/zconf.y b/openwrt/scripts/config/zconf.y
index 1f61fba6aa..83243f5efe 100644
--- a/openwrt/scripts/config/zconf.y
+++ b/openwrt/scripts/config/zconf.y
@@ -459,7 +459,7 @@ void conf_parse(const char *name)
 	sym_init();
 	menu_init();
 	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 (getenv("ZCONF_DEBUG"))