Replace Kconfig patch with version likely to be accepted upstream

Add verbose option (KBUILD_VERBOSE=1/V=1) to listnewconfig, rather than
adding yet more targets.  Change rules.real accordingly.

svn path=/dists/trunk/linux-2.6/; revision=16619
This commit is contained in:
Ben Hutchings 2010-12-04 17:17:51 +00:00
parent 96bbcdf811
commit 8e3b18cd0a
4 changed files with 164 additions and 204 deletions

View File

@ -1,202 +0,0 @@
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index de934de..57e96aa 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -3,7 +3,7 @@
# These targets are used from top-level makefile
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
- localmodconfig localyesconfig
+ localmodconfig localyesconfig reportoldconfig updateoldconfig
ifdef KBUILD_KCONFIG
Kconfig := $(KBUILD_KCONFIG)
@@ -29,10 +29,16 @@ nconfig: $(obj)/nconf
oldconfig: $(obj)/conf
$< --$@ $(Kconfig)
+reportoldconfig: $(obj)/conf
+ $< --$@ $(Kconfig)
+
silentoldconfig: $(obj)/conf
$(Q)mkdir -p include/generated
$< --$@ $(Kconfig)
+updateoldconfig: $(obj)/conf
+ $< --$@ $(Kconfig)
+
# if no path is given, then use src directory to find file
ifdef LSMOD
LSMOD_F := $(LSMOD)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 5b7c86e..9c2171c 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -33,6 +33,8 @@ enum input_mode {
savedefconfig,
listnewconfig,
oldnoconfig,
+ reportoldconfig,
+ updateoldconfig,
} input_mode = oldaskconfig;
char *defconfig_file;
@@ -453,6 +455,8 @@ static struct option long_opts[] = {
{"randconfig", no_argument, NULL, randconfig},
{"listnewconfig", no_argument, NULL, listnewconfig},
{"oldnoconfig", no_argument, NULL, oldnoconfig},
+ {"reportoldconfig", no_argument, NULL, reportoldconfig},
+ {"updateoldconfig", no_argument, NULL, updateoldconfig},
{NULL, 0, NULL, 0}
};
@@ -530,6 +534,8 @@ int main(int ac, char **av)
}
break;
case savedefconfig:
+ case reportoldconfig:
+ case updateoldconfig:
conf_read(NULL);
break;
case silentoldconfig:
@@ -595,6 +601,8 @@ int main(int ac, char **av)
conf_set_all_new_symbols(def_random);
break;
case defconfig:
+ case reportoldconfig:
+ case updateoldconfig:
conf_set_all_new_symbols(def_default);
break;
case savedefconfig:
@@ -618,6 +626,9 @@ int main(int ac, char **av)
break;
}
+ if (input_mode == reportoldconfig)
+ conf_write_changes();
+
if (sync_kconfig) {
/* silentoldconfig is used during the build so we shall update autoconf.
* All other commands are only used to generate a config.
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 515253f..ee81b42 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -893,6 +893,85 @@ int conf_write_autoconf(void)
return 0;
}
+void conf_write_changes(void)
+{
+ struct symbol *sym;
+ struct menu *menu;
+ int l;
+ const char *str;
+
+ fprintf(stdout, "\n#\n"
+ "# Changes:\n"
+ "#\n");
+ menu = rootmenu.list;
+ while (menu) {
+ sym = menu->sym;
+ if (sym &&
+ !(sym->flags & SYMBOL_CHOICE) &&
+ sym->flags & SYMBOL_WRITE &&
+ sym->flags & SYMBOL_NEW &&
+ sym->visible != no &&
+ sym_is_changable(sym)) {
+ switch (sym->type) {
+ case S_BOOLEAN:
+ case S_TRISTATE:
+ switch (sym_get_tristate_value(sym)) {
+ case no:
+ fprintf(stdout, "# CONFIG_%s is not set\n", sym->name);
+ break;
+ case mod:
+ fprintf(stdout, "CONFIG_%s=m\n", sym->name);
+ break;
+ case yes:
+ fprintf(stdout, "CONFIG_%s=y\n", sym->name);
+ break;
+ }
+ break;
+ case S_STRING:
+ str = sym_get_string_value(sym);
+ fprintf(stdout, "CONFIG_%s=\"", sym->name);
+ while (1) {
+ l = strcspn(str, "\"\\");
+ if (l) {
+ fwrite(str, l, 1, stdout);
+ str += l;
+ }
+ if (!*str)
+ break;
+ fprintf(stdout, "\\%c", *str++);
+ }
+ fputs("\"\n", stdout);
+ break;
+ case S_HEX:
+ str = sym_get_string_value(sym);
+ if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
+ fprintf(stdout, "CONFIG_%s=%s\n", sym->name, str);
+ break;
+ }
+ case S_INT:
+ str = sym_get_string_value(sym);
+ fprintf(stdout, "CONFIG_%s=%s\n", sym->name, str);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (menu->list) {
+ menu = menu->list;
+ continue;
+ }
+ if (menu->next)
+ menu = menu->next;
+ else while ((menu = menu->parent)) {
+ if (menu->next) {
+ menu = menu->next;
+ break;
+ }
+ }
+ }
+}
+
static int sym_change_count;
static void (*conf_changed_callback)(void);
@@ -991,6 +1070,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
for_all_symbols(i, sym) {
if (sym_has_value(sym))
continue;
+ sym->flags |= SYMBOL_NEW;
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 6ee2e4f..09a6a7c 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -107,6 +107,7 @@ struct symbol {
#define SYMBOL_DEF_AUTO 0x20000 /* symbol.def[S_DEF_AUTO] is valid */
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
+#define SYMBOL_NEW 0x100000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 9973
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 9a948c9..d5aeb72 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -6,6 +6,7 @@ P(conf_read_simple,int,(const char *name, int));
P(conf_write_defconfig,int,(const char *name));
P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
+P(conf_write_changes,void,(void));
P(conf_get_changed,bool,(void));
P(conf_set_changed_callback, void,(void (*fn)(void)));

View File

@ -0,0 +1,161 @@
From 05bf283675db983cab59159db8fb82b9a2858c7f Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 14 Sep 2010 04:33:34 +0100
Subject: [PATCH] Kbuild: kconfig: Verbose version of --listnewconfig
If the KBUILD_VERBOSE environment variable is set to non-zero, show
the default values of new symbols and not just their names.
Based on work by Bastian Blank <waldi@debian.org> and
maximilian attems <max@stro.at>. Simplified by Michal Marek
<mmarek@suse.cz>.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
scripts/kconfig/conf.c | 45 +++++++++++++++++++++++++++++++++---------
scripts/kconfig/confdata.c | 5 ++-
scripts/kconfig/expr.h | 2 +
scripts/kconfig/lkc_proto.h | 1 +
4 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 5459a38..f4752b4 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -363,7 +363,6 @@ static void conf(struct menu *menu)
switch (prop->type) {
case P_MENU:
if ((input_mode == silentoldconfig ||
- input_mode == listnewconfig ||
input_mode == oldnoconfig) &&
rootEntry != menu) {
check_conf(menu);
@@ -423,11 +422,7 @@ static void check_conf(struct menu *menu)
if (sym && !sym_has_value(sym)) {
if (sym_is_changable(sym) ||
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
- if (input_mode == listnewconfig) {
- if (sym->name && !sym_is_choice_value(sym)) {
- printf("%s%s\n", CONFIG_, sym->name);
- }
- } else if (input_mode != oldnoconfig) {
+ if (input_mode != oldnoconfig) {
if (!conf_cnt++)
printf(_("*\n* Restart config...\n*\n"));
rootEntry = menu_get_parent_menu(menu);
@@ -440,6 +435,33 @@ static void check_conf(struct menu *menu)
check_conf(child);
}
+static void report_conf(struct menu *menu, bool verbose)
+{
+ struct symbol *sym;
+ struct menu *child;
+
+ if (!menu_is_visible(menu))
+ return;
+
+ if (verbose && menu == &rootmenu) {
+ printf("\n#\n"
+ "# Changes:\n"
+ "#\n");
+ }
+
+ sym = menu->sym;
+ if (sym && (sym->flags & SYMBOL_NEW) &&
+ sym_is_changable(sym) && sym->name && !sym_is_choice_value(sym)) {
+ if (verbose)
+ conf_write_symbol(sym, sym->type, stdout, true);
+ else
+ printf("CONFIG_%s\n", sym->name);
+ }
+
+ for (child = menu->list; child; child = child->next)
+ report_conf(child, verbose);
+}
+
static struct option long_opts[] = {
{"oldaskconfig", no_argument, NULL, oldaskconfig},
{"oldconfig", no_argument, NULL, oldconfig},
@@ -460,6 +482,7 @@ int main(int ac, char **av)
{
int opt;
const char *name;
+ const char *value;
struct stat tmpstat;
setlocale(LC_ALL, "");
@@ -604,16 +627,18 @@ int main(int ac, char **av)
input_mode = silentoldconfig;
/* fall through */
case oldconfig:
- case listnewconfig:
case oldnoconfig:
case silentoldconfig:
/* Update until a loop caused no more changes */
do {
conf_cnt = 0;
check_conf(&rootmenu);
- } while (conf_cnt &&
- (input_mode != listnewconfig &&
- input_mode != oldnoconfig));
+ } while (conf_cnt && input_mode != oldnoconfig);
+ break;
+ case listnewconfig:
+ conf_set_all_new_symbols(def_default);
+ value = getenv("KBUILD_VERBOSE");
+ report_conf(&rootmenu, value && atoi(value));
break;
}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c06f150..fbbacac 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -440,8 +440,8 @@ static void conf_write_string(bool headerfile, const char *name,
fputs("\"\n", out);
}
-static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
- FILE *out, bool write_no)
+void conf_write_symbol(struct symbol *sym, enum symbol_type type,
+ FILE *out, bool write_no)
{
const char *str;
@@ -1009,6 +1009,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
for_all_symbols(i, sym) {
if (sym_has_value(sym))
continue;
+ sym->flags |= SYMBOL_NEW;
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 184eb6a..b267933 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -108,6 +108,8 @@ struct symbol {
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
+#define SYMBOL_NEW 0x100000 /* symbol is new (loaded config did not provide a value) */
+
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 9973
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 17342fe..6da571b 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -7,6 +7,7 @@ P(conf_read_simple,int,(const char *name, int));
P(conf_write_defconfig,int,(const char *name));
P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
+P(conf_write_symbol, void,(struct symbol*, enum symbol_type, FILE*, bool));
P(conf_get_changed,bool,(void));
P(conf_set_changed_callback, void,(void (*fn)(void)));
P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
--
1.7.2.3

View File

@ -1,7 +1,6 @@
+ debian/version.patch
+ debian/kernelvariables.patch
+ debian/doc-build-parallel.patch
+ debian/scripts-kconfig-reportoldconfig.patch
+ features/all/drivers-media-dvb-usb-af9005-request_firmware.patch
@ -40,3 +39,4 @@
+ bugfix/arm/ixp4xx-add-missing-export.patch
+ features/arm/asoc-openrd-ultimate.patch
+ bugfix/all/dm-Deal-with-merge_bvec_fn-in-component-devices-bett.patch
+ features/all/Kbuild-kconfig-Verbose-version-of-listnewconfig.patch

3
debian/rules.real vendored
View File

@ -123,7 +123,8 @@ endif
ifdef CFLAGS_KERNEL
echo 'CFLAGS += $(CFLAGS_KERNEL)' >> '$(DIR)/.kernelvariables'
endif
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' reportoldconfig
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' V=1 listnewconfig
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' oldconfig </dev/null >/dev/null
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' $(JOBS_ARG) prepare
@$(stamp)