public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* pending kbuild updates
@ 2008-12-29 13:44 Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 01/13] m68k: fix recursive dependency in Kconfig Sam Ravnborg
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:44 UTC (permalink / raw)
  To: linux-kbuild, LKML

Following is the next batch queued up for merging.
Highlights:

o improved userspace header checks (spawns a lot of warnings now!)
o some kconfig improvements for check of recursive dependencies
o drop retrun of void warning from sparse

	Sam

Hannes Eder (1):
      kbuild: disable sparse warning "returning void-valued expression"

Mike Frysinger (2):
      headers_check.pl: disallow extern's
      kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__

Randy Dunlap (1):
      kbuild: make *config usage docs

Sam Ravnborg (9):
      m68k: fix recursive dependency in Kconfig
      kconfig: explain symbol value defaults
      kconfig: add comments to symbol flags
      kconfig: struct property commented
      kconfig: improve readout when we hit recursive dependencies
      kconfig: print all locations when we see a recursive dependency
      kconfig: improve error messages for bad source statements
      kbuild: check for leaked CONFIG_ symbols to userspace
      kbuild: document environment variables

 Documentation/kbuild/00-INDEX       |    6 +-
 Documentation/kbuild/kbuild.txt     |  126 +++++++++++++++++++++++
 Documentation/kbuild/kconfig.txt    |  188 +++++++++++++++++++++++++++++++++++
 Makefile                            |    3 +-
 README                              |   32 ++++---
 arch/m68k/Kconfig                   |    1 -
 scripts/headers_check.pl            |   21 ++++-
 scripts/headers_install.pl          |    3 +
 scripts/kconfig/expr.h              |   83 ++++++++++-----
 scripts/kconfig/lex.zconf.c_shipped |    7 +-
 scripts/kconfig/menu.c              |    2 +
 scripts/kconfig/symbol.c            |   27 ++++-
 scripts/kconfig/zconf.l             |    7 +-
 13 files changed, 453 insertions(+), 53 deletions(-)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/13] m68k: fix recursive dependency in Kconfig
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 02/13] kconfig: explain symbol value defaults Sam Ravnborg
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg, Roman Zippel

We had a recursive dependency between MMU_MOTOROLA and MMU_SUN3
Fix it by dropping the unused dependencies on MMU_MOTOROLA.

MMU_MOTOROLA is set to y only using select so any dependencies
are anyway ignored.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 arch/m68k/Kconfig |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 836fb66..c825bde 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -280,7 +280,6 @@ config M68060
 
 config MMU_MOTOROLA
 	bool
-	depends on MMU && !MMU_SUN3
 
 config MMU_SUN3
 	bool
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/13] kconfig: explain symbol value defaults
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 01/13] m68k: fix recursive dependency in Kconfig Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 03/13] kconfig: add comments to symbol flags Sam Ravnborg
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg

Added a few comments - no functional change.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/expr.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 9d4cba1..455f2c8 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -65,9 +65,13 @@ enum symbol_type {
 	S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
 };
 
+/* enum values are used as index to symbol.def[] */
 enum {
 	S_DEF_USER,		/* main user value */
-	S_DEF_AUTO,
+	S_DEF_AUTO,		/* values read from auto.conf */
+	S_DEF_DEF3,		/* Reserved for UI usage */
+	S_DEF_DEF4,		/* Reserved for UI usage */
+	S_DEF_COUNT
 };
 
 struct symbol {
@@ -75,7 +79,7 @@ struct symbol {
 	char *name;
 	enum symbol_type type;
 	struct symbol_value curr;
-	struct symbol_value def[4];
+	struct symbol_value def[S_DEF_COUNT];
 	tristate visible;
 	int flags;
 	struct property *prop;
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/13] kconfig: add comments to symbol flags
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 01/13] m68k: fix recursive dependency in Kconfig Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 02/13] kconfig: explain symbol value defaults Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 04/13] kconfig: struct property commented Sam Ravnborg
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg

No functional changes - only comments.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/expr.h |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 455f2c8..0bdb58e 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -88,22 +88,24 @@ struct symbol {
 
 #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
 
-#define SYMBOL_CONST		0x0001
-#define SYMBOL_CHECK		0x0008
-#define SYMBOL_CHOICE		0x0010
-#define SYMBOL_CHOICEVAL	0x0020
-#define SYMBOL_VALID		0x0080
-#define SYMBOL_OPTIONAL		0x0100
-#define SYMBOL_WRITE		0x0200
-#define SYMBOL_CHANGED		0x0400
-#define SYMBOL_AUTO		0x1000
-#define SYMBOL_CHECKED		0x2000
-#define SYMBOL_WARNED		0x8000
-#define SYMBOL_DEF		0x10000
-#define SYMBOL_DEF_USER		0x10000
-#define SYMBOL_DEF_AUTO		0x20000
-#define SYMBOL_DEF3		0x40000
-#define SYMBOL_DEF4		0x80000
+#define SYMBOL_CONST      0x0001  /* symbol is const */
+#define SYMBOL_CHECK      0x0008  /* used during dependency checking */
+#define SYMBOL_CHOICE     0x0010  /* start of a choice block (null name) */
+#define SYMBOL_CHOICEVAL  0x0020  /* used as a value in a choice block */
+#define SYMBOL_VALID      0x0080  /* set when symbol.curr is calculated */
+#define SYMBOL_OPTIONAL   0x0100  /* choice is optional - values can be 'n' */
+#define SYMBOL_WRITE      0x0200  /* ? */
+#define SYMBOL_CHANGED    0x0400  /* ? */
+#define SYMBOL_AUTO       0x1000  /* value from environment variable */
+#define SYMBOL_CHECKED    0x2000  /* used during dependency checking */
+#define SYMBOL_WARNED     0x8000  /* warning has been issued */
+
+/* Set when symbol.def[] is used */
+#define SYMBOL_DEF        0x10000  /* First bit of SYMBOL_DEF */
+#define SYMBOL_DEF_USER   0x10000  /* symbol.def[S_DEF_USER] is valid */
+#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_MAXLENGTH	256
 #define SYMBOL_HASHSIZE		257
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/13] kconfig: struct property commented
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (2 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 03/13] kconfig: add comments to symbol flags Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 05/13] kconfig: improve readout when we hit recursive dependencies Sam Ravnborg
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg

No functional changes

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/expr.h |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 0bdb58e..6408fef 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -111,21 +111,41 @@ struct symbol {
 #define SYMBOL_HASHSIZE		257
 #define SYMBOL_HASHMASK		0xff
 
+/* A property represent the config options that can be associated
+ * with a config "symbol".
+ * Sample:
+ * config FOO
+ *         default y
+ *         prompt "foo prompt"
+ *         select BAR
+ * config BAZ
+ *         int "BAZ Value"
+ *         range 1..255
+ */
 enum prop_type {
-	P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE,
-	P_SELECT, P_RANGE, P_ENV
+	P_UNKNOWN,
+	P_PROMPT,   /* prompt "foo prompt" or "BAZ Value" */
+	P_COMMENT,  /* text associated with a comment */
+	P_MENU,     /* prompt associated with a menuconfig option */
+	P_DEFAULT,  /* default y */
+	P_CHOICE,   /* choice value */
+	P_SELECT,   /* select BAR */
+	P_RANGE,    /* range 7..100 (for a symbol) */
+	P_ENV,      /* value from environment variable */
 };
 
 struct property {
-	struct property *next;
-	struct symbol *sym;
-	enum prop_type type;
-	const char *text;
+	struct property *next;     /* next property - null if last */
+	struct symbol *sym;        /* the symbol for which the property is associated */
+	enum prop_type type;       /* type of property */
+	const char *text;          /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
 	struct expr_value visible;
-	struct expr *expr;
-	struct menu *menu;
-	struct file *file;
-	int lineno;
+	struct expr *expr;         /* the optional conditional part of the property */
+	struct menu *menu;         /* the menu the property are associated with
+	                            * valid for: P_SELECT, P_RANGE, P_CHOICE,
+	                            * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */
+	struct file *file;         /* what file was this property defined */
+	int lineno;                /* what lineno was this property defined */
 };
 
 #define for_all_properties(sym, st, tok) \
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/13] kconfig: improve readout when we hit recursive dependencies
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (3 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 04/13] kconfig: struct property commented Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 06/13] kconfig: print all locations when we see a recursive dependency Sam Ravnborg
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg

Following sample:
    config TEST1
            bool
            depends on TEST2 && PCI
            select TEST2

    config TEST2
            bool

Will result in the following output:

    Kconfig:1:error: found recursive dependency:
                TEST1
             -> TEST2 (arch/x86/Kconfig:6)
             -> TEST1 (arch/x86/Kconfig:1)

The sample above gave a segmentation fault
which is also fixed by this patch.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/expr.h   |    1 +
 scripts/kconfig/menu.c   |    2 ++
 scripts/kconfig/symbol.c |   11 ++++++++---
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 6408fef..d587895 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -132,6 +132,7 @@ enum prop_type {
 	P_SELECT,   /* select BAR */
 	P_RANGE,    /* range 7..100 (for a symbol) */
 	P_ENV,      /* value from environment variable */
+	P_SYMBOL,   /* where a symbol is defined */
 };
 
 struct property {
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 07ff8d1..aa0e2f2 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -55,6 +55,8 @@ void menu_add_entry(struct symbol *sym)
 	*last_entry_ptr = menu;
 	last_entry_ptr = &menu->next;
 	current_entry = menu;
+	if (sym)
+		 menu_add_prop(P_SYMBOL, NULL, NULL, NULL);
 }
 
 void menu_end_entry(void)
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 18f3e5c..474dae2 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -856,8 +856,9 @@ struct symbol *sym_check_deps(struct symbol *sym)
 	struct property *prop;
 
 	if (sym->flags & SYMBOL_CHECK) {
-		fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
-		        sym->prop->file->name, sym->prop->lineno,
+		fprintf(stderr, "%s:%d:error: found recursive dependency:\n",
+		        sym->prop->file->name, sym->prop->lineno);
+		fprintf(stderr, "\t    %s\n",
 			sym->name ? sym->name : "<choice>");
 		return sym;
 	}
@@ -877,7 +878,9 @@ struct symbol *sym_check_deps(struct symbol *sym)
 	}
 
 	if (sym2) {
-		fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>");
+		fprintf(stderr, "\t -> %s (%s:%d)\n",
+		        sym->name ? sym->name : "<choice>",
+			sym->prop->file->name, sym->prop->lineno);
 		if (sym2 == sym) {
 			fprintf(stderr, "\n");
 			zconfnerrs++;
@@ -937,6 +940,8 @@ const char *prop_get_type_name(enum prop_type type)
 		return "select";
 	case P_RANGE:
 		return "range";
+	case P_SYMBOL:
+		return "symbol";
 	case P_UNKNOWN:
 		break;
 	}
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (4 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 05/13] kconfig: improve readout when we hit recursive dependencies Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-31  2:55   ` Roman Zippel
  2008-12-29 13:53 ` [PATCH 07/13] kconfig: improve error messages for bad source statements Sam Ravnborg
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg, Roman Zippel

It is nessesary to know all locations when trying to track
a recursive dependency. So print out all locations for each symbol.

Sample output:
Kconfig:1: found recursive dependency:
            TEST1
         -> TEST2 (Kconfig:4),(Kconfig:12)
         -> TEST1 (Kconfig:1),(Kconfig:7)

In a more complex example the symbols can be defined in different
files thus making it harder to track.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 scripts/kconfig/symbol.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 474dae2..fc62f34 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -790,6 +790,21 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
 	return NULL;
 }
 
+static void print_symbol_location(struct symbol *sym)
+{
+	struct property *prop;
+	int comma = 0;
+
+	fprintf(stderr, "\t -> %s ", sym->name ? sym->name : "<choice>");
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->type == P_SYMBOL) {
+			fprintf(stderr, "%s(%s:%d)",
+			comma ? "," : "", prop->file->name, prop->lineno);
+			comma = 1;
+		}
+	}
+	fprintf(stderr, "\n");
+}
 /* return NULL when dependencies are OK */
 static struct symbol *sym_check_sym_deps(struct symbol *sym)
 {
@@ -835,7 +850,7 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice)
 	expr_list_for_each_sym(prop->expr, e, sym) {
 		sym2 = sym_check_sym_deps(sym);
 		if (sym2) {
-			fprintf(stderr, " -> %s", sym->name);
+			print_symbol_location(sym);
 			break;
 		}
 	}
@@ -856,7 +871,7 @@ struct symbol *sym_check_deps(struct symbol *sym)
 	struct property *prop;
 
 	if (sym->flags & SYMBOL_CHECK) {
-		fprintf(stderr, "%s:%d:error: found recursive dependency:\n",
+		fprintf(stderr, "%s:%d: found recursive dependency:\n",
 		        sym->prop->file->name, sym->prop->lineno);
 		fprintf(stderr, "\t    %s\n",
 			sym->name ? sym->name : "<choice>");
@@ -878,11 +893,8 @@ struct symbol *sym_check_deps(struct symbol *sym)
 	}
 
 	if (sym2) {
-		fprintf(stderr, "\t -> %s (%s:%d)\n",
-		        sym->name ? sym->name : "<choice>",
-			sym->prop->file->name, sym->prop->lineno);
+		print_symbol_location(sym);
 		if (sym2 == sym) {
-			fprintf(stderr, "\n");
 			zconfnerrs++;
 			sym2 = NULL;
 		}
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/13] kconfig: improve error messages for bad source statements
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (5 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 06/13] kconfig: print all locations when we see a recursive dependency Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 08/13] headers_check.pl: disallow extern's Sam Ravnborg
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg, Roman Zippel

We now say where we detect the second source of a file,
and where we detect a recursively source of the same file.
This makes it easier to fix such errors.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 scripts/kconfig/lex.zconf.c_shipped |    7 +++++--
 scripts/kconfig/zconf.l             |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index 7342ce0..dc3e818 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -2370,11 +2370,14 @@ void zconf_nextfile(const char *name)
 	current_buf = buf;
 
 	if (file->flags & FILE_BUSY) {
-		printf("recursive scan (%s)?\n", name);
+		printf("%s:%d: do not source '%s' from itself\n",
+		       zconf_curname(), zconf_lineno(), name);
 		exit(1);
 	}
 	if (file->flags & FILE_SCANNED) {
-		printf("file %s already scanned?\n", name);
+		printf("%s:%d: file '%s' is already sourced from '%s'\n",
+		       zconf_curname(), zconf_lineno(), name,
+		       file->parent->name);
 		exit(1);
 	}
 	file->flags |= FILE_BUSY;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 5164ef7..21ff69c 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -314,11 +314,14 @@ void zconf_nextfile(const char *name)
 	current_buf = buf;
 
 	if (file->flags & FILE_BUSY) {
-		printf("recursive scan (%s)?\n", name);
+		printf("%s:%d: do not source '%s' from itself\n",
+		       zconf_curname(), zconf_lineno(), name);
 		exit(1);
 	}
 	if (file->flags & FILE_SCANNED) {
-		printf("file %s already scanned?\n", name);
+		printf("%s:%d: file '%s' is already sourced from '%s'\n",
+		       zconf_curname(), zconf_lineno(), name,
+		       file->parent->name);
 		exit(1);
 	}
 	file->flags |= FILE_BUSY;
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/13] headers_check.pl: disallow extern's
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (6 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 07/13] kconfig: improve error messages for bad source statements Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 09/13] kbuild: check for leaked CONFIG_ symbols to userspace Sam Ravnborg
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Mike Frysinger, Sam Ravnborg

From: Mike Frysinger <vapier@gentoo.org>

Since prototypes with "extern" refer to kernel functions, they make no
sense in userspace, so reject them automatically.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
[sam: made it into a warning]
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/headers_check.pl |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 488a3b1..5bdd975 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -14,7 +14,9 @@
 #    Only include files located in asm* and linux* are checked.
 #    The rest are assumed to be system include files.
 #
-# 2) TODO: check for leaked CONFIG_ symbols
+# 2) It is checked that prototypes does not use "extern"
+#
+# 3) TODO: check for leaked CONFIG_ symbols
 
 use strict;
 
@@ -33,6 +35,7 @@ foreach my $file (@files) {
 	while ($line = <FH>) {
 		$lineno++;
 		check_include();
+		check_prototypes();
 	}
 	close FH;
 }
@@ -54,3 +57,10 @@ sub check_include
 		}
 	}
 }
+
+sub check_prototypes
+{
+	if ($line =~ m/^\s*extern\b/) {
+		printf STDERR "$filename:$lineno: extern's make no sense in userspace\n";
+	}
+}
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/13] kbuild: check for leaked CONFIG_ symbols to userspace
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (7 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 08/13] headers_check.pl: disallow extern's Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 10/13] kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__ Sam Ravnborg
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/headers_check.pl |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 5bdd975..72924a7 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -16,7 +16,7 @@
 #
 # 2) It is checked that prototypes does not use "extern"
 #
-# 3) TODO: check for leaked CONFIG_ symbols
+# 3) Check for leaked CONFIG_ symbols
 
 use strict;
 
@@ -36,6 +36,7 @@ foreach my $file (@files) {
 		$lineno++;
 		check_include();
 		check_prototypes();
+		check_config();
 	}
 	close FH;
 }
@@ -64,3 +65,11 @@ sub check_prototypes
 		printf STDERR "$filename:$lineno: extern's make no sense in userspace\n";
 	}
 }
+
+sub check_config
+{
+	if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) {
+		printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n";
+	}
+}
+
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/13] kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (8 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 09/13] kbuild: check for leaked CONFIG_ symbols to userspace Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 11/13] kbuild: disable sparse warning "returning void-valued expression" Sam Ravnborg
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Mike Frysinger, Sam Ravnborg

From: Mike Frysinger <vapier@gentoo.org>

Headers in userspace should be using the __xxx__ form of the asm, inline,
and volatile keywords.  Since people like to revert these things without
realizing what's going on, have the headers install step autoconvert these
keywords.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/headers_install.pl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 7d2b414..c6ae405 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -36,6 +36,9 @@ foreach my $file (@files) {
 		$line =~ s/\s__attribute_const__\s/ /g;
 		$line =~ s/\s__attribute_const__$//g;
 		$line =~ s/^#include <linux\/compiler.h>//;
+		$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
+		$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
+		$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
 		printf OUTFILE "%s", $line;
 	}
 	close OUTFILE;
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/13] kbuild: disable sparse warning "returning void-valued expression"
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (9 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 10/13] kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__ Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 12/13] kbuild: make *config usage docs Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 13/13] kbuild: document environment variables Sam Ravnborg
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Hannes Eder, Sam Ravnborg

From: Hannes Eder <hannes@hanneseder.net>

The sparse warning -Wreturn-void ("returning void-valued expression")
is off by default, but it is enabled with -Wall, so add
-Wno-return-void to CHECKFLAGS to disable it.

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 09ff7d8..f40e07a 100644
--- a/Makefile
+++ b/Makefile
@@ -320,7 +320,8 @@ KALLSYMS	= scripts/kallsyms
 PERL		= perl
 CHECK		= sparse
 
-CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
+CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
+		  -Wbitwise -Wno-return-void $(CF)
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/13] kbuild: make *config usage docs
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (10 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 11/13] kbuild: disable sparse warning "returning void-valued expression" Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  2008-12-29 13:53 ` [PATCH 13/13] kbuild: document environment variables Sam Ravnborg
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Randy Dunlap, Sam Ravnborg

From: Randy Dunlap <randy.dunlap@oracle.com>

Create a kconfig user assistance guide, with a few tips and hints
about using menuconfig, xconfig, and gconfig.

Mostly contains user interface, environment variables, and search topics,
along with mini.config/custom.config usage.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Documentation/kbuild/00-INDEX    |    2 +
 Documentation/kbuild/kconfig.txt |  188 ++++++++++++++++++++++++++++++++++++++
 README                           |   32 ++++---
 3 files changed, 210 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/kbuild/kconfig.txt

diff --git a/Documentation/kbuild/00-INDEX b/Documentation/kbuild/00-INDEX
index 1146442..54a118a 100644
--- a/Documentation/kbuild/00-INDEX
+++ b/Documentation/kbuild/00-INDEX
@@ -4,5 +4,7 @@ kconfig-language.txt
 	- specification of Config Language, the language in Kconfig files
 makefiles.txt
 	- developer information for linux kernel makefiles
+kconfig.txt
+	- usage help for make *config
 modules.txt
 	- how to build modules and to install them
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt
new file mode 100644
index 0000000..26a7c0a
--- /dev/null
+++ b/Documentation/kbuild/kconfig.txt
@@ -0,0 +1,188 @@
+This file contains some assistance for using "make *config".
+
+Use "make help" to list all of the possible configuration targets.
+
+The xconfig ('qconf') and menuconfig ('mconf') programs also
+have embedded help text.  Be sure to check it for navigation,
+search, and other general help text.
+
+======================================================================
+General
+--------------------------------------------------
+
+New kernel releases often introduce new config symbols.  Often more
+important, new kernel releases may rename config symbols.  When
+this happens, using a previously working .config file and running
+"make oldconfig" won't necessarily produce a working new kernel
+for you, so you may find that you need to see what NEW kernel
+symbols have been introduced.
+
+To see a list of new config symbols when using "make oldconfig", use
+
+	cp user/some/old.config .config
+	yes "" | make oldconfig >conf.new
+
+and the config program will list as (NEW) any new symbols that have
+unknown values.  Of course, the .config file is also updated with
+new (default) values, so you can use:
+
+	grep "(NEW)" conf.new
+
+to see the new config symbols or you can 'diff' the previous and
+new .config files to see the differences:
+
+	diff .config.old .config | less
+
+(Yes, we need something better here.)
+
+
+======================================================================
+menuconfig
+--------------------------------------------------
+
+SEARCHING for CONFIG symbols
+
+Searching in menuconfig:
+
+	The Search function searches for kernel configuration symbol
+	names, so you have to know something close to what you are
+	looking for.
+
+	Example:
+		/hotplug
+		This lists all config symbols that contain "hotplug",
+		e.g., HOTPLUG, HOTPLUG_CPU, MEMORY_HOTPLUG.
+
+	For search help, enter / followed TAB-TAB-TAB (to highlight
+	<Help>) and Enter.  This will tell you that you can also use
+	regular expressions (regexes) in the search string, so if you
+	are not interested in MEMORY_HOTPLUG, you could try
+
+		/^hotplug
+
+
+______________________________________________________________________
+Color Themes for 'menuconfig'
+
+It is possible to select different color themes using the variable
+MENUCONFIG_COLOR.  To select a theme use:
+
+	make MENUCONFIG_COLOR=<theme> menuconfig
+
+Available themes are:
+  mono       => selects colors suitable for monochrome displays
+  blackbg    => selects a color scheme with black background
+  classic    => theme with blue background. The classic look
+  bluetitle  => a LCD friendly version of classic. (default)
+
+______________________________________________________________________
+Environment variables in 'menuconfig'
+
+KCONFIG_ALLCONFIG
+--------------------------------------------------
+(partially based on lkml email from/by Rob Landley, re: miniconfig)
+--------------------------------------------------
+The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
+also use the environment variable KCONFIG_ALLCONFIG as a flag or a
+filename that contains config symbols that the user requires to be
+set to a specific value.  If KCONFIG_ALLCONFIG is used without a
+filename, "make *config" checks for a file named
+"all{yes/mod/no/random}.config" (corresponding to the *config command
+that was used) 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.
+
+This enables you to create "miniature" config (miniconfig) or custom
+config files containing just the config symbols that you are interested
+in.  Then the kernel config system generates the full .config file,
+including dependencies of your miniconfig file, based on the miniconfig
+file.
+
+This 'KCONFIG_ALLCONFIG' file is a config file which contains
+(usually a subset of all) preset config symbols.  These variable
+settings are still subject to normal dependency checks.
+
+Examples:
+	KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
+or
+	KCONFIG_ALLCONFIG=mini.config make allnoconfig
+or
+	make KCONFIG_ALLCONFIG=mini.config allnoconfig
+
+These examples will disable most options (allnoconfig) but enable or
+disable the options that are explicitly listed in the specified
+mini-config files.
+
+KCONFIG_NOSILENTUPDATE
+--------------------------------------------------
+If this variable has a non-blank value, it prevents silent kernel
+config udpates (requires explicit updates).
+
+KCONFIG_CONFIG
+--------------------------------------------------
+This environment variable can be used to specify a default kernel config
+file name to override the default name of ".config".
+
+KCONFIG_OVERWRITECONFIG
+--------------------------------------------------
+If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
+break symlinks when .config is a symlink to somewhere else.
+
+KCONFIG_NOTIMESTAMP
+--------------------------------------------------
+If this environment variable exists and is non-null, the timestamp line
+in generated .config files is omitted.
+
+KCONFIG_AUTOCONFIG
+--------------------------------------------------
+This environment variable can be set to specify the path & name of the
+"auto.conf" file.  Its default value is "include/config/auto.conf".
+
+KCONFIG_AUTOHEADER
+--------------------------------------------------
+This environment variable can be set to specify the path & name of the
+"autoconf.h" (header) file.  Its default value is "include/linux/autoconf.h".
+
+______________________________________________________________________
+menuconfig User Interface Options
+----------------------------------------------------------------------
+MENUCONFIG_MODE
+--------------------------------------------------
+This mode shows all sub-menus in one large tree.
+
+Example:
+	MENUCONFIG_MODE=single_menu make menuconfig
+
+======================================================================
+xconfig
+--------------------------------------------------
+
+Searching in xconfig:
+
+	The Search function searches for kernel configuration symbol
+	names, so you have to know something close to what you are
+	looking for.
+
+	Example:
+		Ctrl-F hotplug
+	or
+		Menu: File, Search, hotplug
+
+	lists all config symbol entries that contain "hotplug" in
+	the symbol name.  In this Search dialog, you may change the
+	config setting for any of the entries that are not grayed out.
+	You can also enter a different search string without having
+	to return to the main menu.
+
+
+======================================================================
+gconfig
+--------------------------------------------------
+
+Searching in gconfig:
+
+	None (gconfig isn't maintained as well as xconfig or menuconfig);
+	however, gconfig does have a few more viewing choices than
+	xconfig does.
+
+###
diff --git a/README b/README
index 159912c..90a0765 100644
--- a/README
+++ b/README
@@ -52,11 +52,11 @@ DOCUMENTATION:
 
  - The Documentation/DocBook/ subdirectory contains several guides for
    kernel developers and users.  These guides can be rendered in a
-   number of formats:  PostScript (.ps), PDF, and HTML, among others.
-   After installation, "make psdocs", "make pdfdocs", or "make htmldocs"
-   will render the documentation in the requested format.
+   number of formats:  PostScript (.ps), PDF, HTML, & man-pages, among others.
+   After installation, "make psdocs", "make pdfdocs", "make htmldocs",
+   or "make mandocs" will render the documentation in the requested format.
 
-INSTALLING the kernel:
+INSTALLING the kernel source:
 
  - If you install the full sources, put the kernel tarball in a
    directory where you have permissions (eg. your home directory) and
@@ -187,14 +187,9 @@ CONFIGURING the kernel:
 	"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.
-   
+   You can find more information on using the Linux kernel config tools
+   in Documentation/kbuild/make-configs.txt.
+
 	NOTES on "make config":
 	- having unnecessary drivers will make the kernel bigger, and can
 	  under some circumstances lead to problems: probing for a
@@ -231,6 +226,19 @@ COMPILING the kernel:
  - If you configured any of the parts of the kernel as `modules', you
    will also have to do "make modules_install".
 
+ - Verbose kernel compile/build output:
+
+   Normally the kernel build system runs in a fairly quiet mode (but not
+   totally silent).  However, sometimes you or other kernel developers need
+   to see compile, link, or other commands exactly as they are executed.
+   For this, use "verbose" build mode.  This is done by inserting
+   "V=1" in the "make" command.  E.g.:
+
+	make V=1 all
+
+   To have the build system also tell the reason for the rebuild of each
+   target, use "V=2".  The default is "V=0".
+
  - Keep a backup kernel handy in case something goes wrong.  This is 
    especially true for the development releases, since each new release
    contains new code which has not been debugged.  Make sure you keep a
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 13/13] kbuild: document environment variables
  2008-12-29 13:44 pending kbuild updates Sam Ravnborg
                   ` (11 preceding siblings ...)
  2008-12-29 13:53 ` [PATCH 12/13] kbuild: make *config usage docs Sam Ravnborg
@ 2008-12-29 13:53 ` Sam Ravnborg
  12 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-29 13:53 UTC (permalink / raw)
  To: linux-kbuild, LKML; +Cc: Sam Ravnborg

Add kbuild.txt to Documentation/kbuild
More stuff can be added later - at least we have
som of the varous environment variables documented now.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Documentation/kbuild/00-INDEX   |    8 ++-
 Documentation/kbuild/kbuild.txt |  126 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 131 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/kbuild/kbuild.txt

diff --git a/Documentation/kbuild/00-INDEX b/Documentation/kbuild/00-INDEX
index 54a118a..e8d2b6d 100644
--- a/Documentation/kbuild/00-INDEX
+++ b/Documentation/kbuild/00-INDEX
@@ -1,10 +1,12 @@
 00-INDEX
-    	- this file: info on the kernel build process
+	- this file: info on the kernel build process
+kbuild.txt
+	- developer information on kbuild
+kconfig.txt
+	- usage help for make *config
 kconfig-language.txt
 	- specification of Config Language, the language in Kconfig files
 makefiles.txt
 	- developer information for linux kernel makefiles
-kconfig.txt
-	- usage help for make *config
 modules.txt
 	- how to build modules and to install them
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
new file mode 100644
index 0000000..5177184
--- /dev/null
+++ b/Documentation/kbuild/kbuild.txt
@@ -0,0 +1,126 @@
+Environment variables
+
+KCPPFLAGS
+--------------------------------------------------
+Additional options to pass when preprocessing. The preprocessing options
+will be used in all cases where kbuild do preprocessing including
+building C files and assembler files.
+
+KAFLAGS
+--------------------------------------------------
+Additional options to the assembler.
+
+KCFLAGS
+--------------------------------------------------
+Additional options to the C compiler.
+
+KBUILD_VERBOSE
+--------------------------------------------------
+Set the kbuild verbosity. Can be assinged same values as "V=...".
+See make help for the full list.
+Setting "V=..." takes precedence over KBUILD_VERBOSE.
+
+KBUILD_EXTMOD
+--------------------------------------------------
+Set the directory to look for the kernel source when building external
+modules.
+The directory can be specified in several ways:
+1) Use "M=..." on the command line
+2) Environmnet variable KBUILD_EXTMOD
+3) Environmnet variable SUBDIRS
+The possibilities are listed in the order they take precedence.
+Using "M=..." will always override the others.
+
+KBUILD_OUTPUT
+--------------------------------------------------
+Specify the output directory when building the kernel.
+The output directory can also be specificed using "O=...".
+Setting "O=..." takes precedence over KBUILD_OUTPUT
+
+ARCH
+--------------------------------------------------
+Set ARCH to the architecture to be built.
+In most cases the name of the architecture is the same as the
+directory name found in the arch/ directory.
+But some architectures suach as x86 and sparc has aliases.
+x86: i386 for 32 bit, x86_64 for 64 bit
+sparc: sparc for 32 bit, sparc64 for 64 bit
+
+CROSS_COMPILE
+--------------------------------------------------
+Specify an optional fixed part of the binutils filename.
+CROSS_COMPILE can be a part of the filename or the full path.
+
+CROSS_COMPILE is also used for ccache is some setups.
+
+CF
+--------------------------------------------------
+Additional options for sparse.
+CF is often used on the command-line like this:
+
+    make CF=-Wbitwise C=2
+
+INSTALL_PATH
+--------------------------------------------------
+INSTALL_PATH specifies where to place the updated kernel and system map
+images. Default is /boot, but you can set it to other values
+
+
+MODLIB
+--------------------------------------------------
+Specify where to install modules.
+The default value is:
+
+     $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
+
+The value can be overridden in which case the default value is ignored.
+
+INSTALL_MOD_PATH
+--------------------------------------------------
+INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
+relocations required by build roots.  This is not defined in the
+makefile but the argument can be passed to make if needed.
+
+INSTALL_MOD_STRIP
+--------------------------------------------------
+INSTALL_MOD_STRIP, if defined, will cause modules to be
+stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
+the default option --strip-debug will be used.  Otherwise,
+INSTALL_MOD_STRIP will used as the options to the strip command.
+
+INSTALL_FW_PATH
+--------------------------------------------------
+INSTALL_FW_PATH specify where to install the firmware blobs.
+The default value is:
+
+    $(INSTALL_MOD_PATH)/lib/firmware
+
+The value can be overridden in which case the default value is ignored.
+
+INSTALL_HDR_PATH
+--------------------------------------------------
+INSTALL_HDR_PATH specify where to install user space headers when
+executing "make headers_*".
+The default value is:
+
+    $(objtree)/usr
+
+$(objtree) is the directory where output files are saved.
+The output directory is often set using "O=..." on the commandline.
+
+The value can be overridden in which case the default value is ignored.
+
+KBUILD_MODPOST_WARN
+--------------------------------------------------
+KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined
+symbols in the final module linking stage.
+
+KBUILD_MODPOST_FINAL
+--------------------------------------------------
+KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
+This is solely usefull to speed up test compiles.
+
+KBUILD_EXTRA_SYMBOLS
+--------------------------------------------------
+For modules use symbols from another modules.
+See more details in modules.txt.
-- 
1.6.0.2.GIT


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
  2008-12-29 13:53 ` [PATCH 06/13] kconfig: print all locations when we see a recursive dependency Sam Ravnborg
@ 2008-12-31  2:55   ` Roman Zippel
  2008-12-31  9:05     ` Sam Ravnborg
  2009-01-18 20:54     ` Sam Ravnborg
  0 siblings, 2 replies; 17+ messages in thread
From: Roman Zippel @ 2008-12-31  2:55 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kbuild, LKML

Hi,

On Mon, 29 Dec 2008, Sam Ravnborg wrote:

> It is nessesary to know all locations when trying to track
> a recursive dependency. So print out all locations for each symbol.

The problem is that this is little more than a better grep, although 
kconfig knows exactly what went wrong, but this info is scattered all over 
the stack.
We could either return more info to print more than just the symbol or 
maintain more info while traversing the tree. The patch below does the 
latter. The patch could use some small cleanups, so it's not final yet.

bye, Roman

---
 scripts/kconfig/symbol.c |  139 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 124 insertions(+), 15 deletions(-)

Index: linux-2.6-git/scripts/kconfig/symbol.c
===================================================================
--- linux-2.6-git.orig/scripts/kconfig/symbol.c	2008-12-31 03:42:05.000000000 +0100
+++ linux-2.6-git/scripts/kconfig/symbol.c	2008-12-31 03:43:34.000000000 +0100
@@ -760,6 +760,107 @@ struct symbol **sym_re_search(const char
 }
 
 
+static struct dep_stack {
+	struct dep_stack *prev, *next;
+	struct symbol *sym;
+	struct property *prop;
+	struct expr *expr;
+} *check_top;
+
+static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
+{
+	memset(stack, 0, sizeof(*stack));
+	if (check_top)
+		check_top->next = stack;
+	stack->prev = check_top;
+	stack->sym = sym;
+	check_top = stack;
+}
+
+static void dep_stack_remove(void)
+{
+	check_top = check_top->prev;
+	if (check_top)
+		check_top->next = NULL;
+}
+
+static void sym_check_print_recursive(struct symbol *last_sym)
+{
+	struct dep_stack *stack;
+	struct symbol *sym, *next_sym;
+	struct menu *menu = NULL;
+	struct property *prop;
+	struct dep_stack cv_stack;
+
+	zconfnerrs++;
+	if (sym_is_choice_value(last_sym)) {
+		dep_stack_insert(&cv_stack, last_sym);
+		last_sym = prop_get_symbol(sym_get_choice_prop(last_sym));
+	}
+
+	for (stack = check_top; stack; stack = stack->prev)
+		if (stack->sym == last_sym)
+			break;
+	if (!stack) {
+		fprintf(stderr, "unexpected recursive dependency error\n");
+		return;
+	}
+
+	for (; stack; stack = stack->next) {
+		sym = stack->sym;
+		next_sym = stack->next ? stack->next->sym : last_sym;
+		prop = stack->prop;
+		if (sym_is_choice(sym) || sym_is_choice_value(sym)) {
+			for (prop = sym->prop; prop; prop = prop->next) {
+				menu = prop->menu;
+				if (prop->menu)
+					break;
+			}
+		} else if (!prop) {
+			for (prop = next_sym->prop; prop; prop = prop->next) {
+				if (prop->type != P_SELECT)
+					continue;
+				if (prop->expr->left.sym == sym)
+					break;
+			}
+		}
+		if (stack->sym == last_sym)
+			fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
+				prop->file->name, prop->lineno);
+		if (stack->expr) {
+			fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
+				prop->file->name, prop->lineno,
+				sym->name ? sym->name : "<choice>",
+				prop_get_type_name(prop->type),
+				next_sym->name ? next_sym->name : "<choice>");
+		} else if (stack->prop) {
+			fprintf(stderr, "%s:%d:\tsymbol %s %s depends on %s\n",
+				prop->file->name, prop->lineno,
+				sym->name ? sym->name : "<choice>",
+				prop_get_type_name(prop->type),
+				next_sym->name ? next_sym->name : "<choice>");
+		} else if (sym_is_choice(sym)) {
+			fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
+				menu->file->name, menu->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		} else if (sym_is_choice_value(sym)) {
+			fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
+				menu->file->name, menu->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		} else {
+			fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
+				prop->file->name, prop->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		}
+	}
+
+	if (check_top == &cv_stack)
+		dep_stack_remove();
+}
+
 static struct symbol *sym_check_expr_deps(struct expr *e)
 {
 	struct symbol *sym;
@@ -795,24 +896,33 @@ static struct symbol *sym_check_sym_deps
 {
 	struct symbol *sym2;
 	struct property *prop;
+	struct dep_stack stack;
+
+	dep_stack_insert(&stack, sym);
 
 	sym2 = sym_check_expr_deps(sym->rev_dep.expr);
 	if (sym2)
-		return sym2;
+		goto out;
 
 	for (prop = sym->prop; prop; prop = prop->next) {
 		if (prop->type == P_CHOICE || prop->type == P_SELECT)
 			continue;
+		stack.prop = prop;
 		sym2 = sym_check_expr_deps(prop->visible.expr);
 		if (sym2)
 			break;
 		if (prop->type != P_DEFAULT || sym_is_choice(sym))
 			continue;
+		stack.expr = prop->expr;
 		sym2 = sym_check_expr_deps(prop->expr);
 		if (sym2)
 			break;
+		stack.expr = NULL;
 	}
 
+out:
+	dep_stack_remove();
+
 	return sym2;
 }
 
@@ -821,6 +931,9 @@ static struct symbol *sym_check_choice_d
 	struct symbol *sym, *sym2;
 	struct property *prop;
 	struct expr *e;
+	struct dep_stack stack;
+
+	dep_stack_insert(&stack, choice);
 
 	prop = sym_get_choice_prop(choice);
 	expr_list_for_each_sym(prop->expr, e, sym)
@@ -834,10 +947,8 @@ static struct symbol *sym_check_choice_d
 
 	expr_list_for_each_sym(prop->expr, e, sym) {
 		sym2 = sym_check_sym_deps(sym);
-		if (sym2) {
-			fprintf(stderr, " -> %s", sym->name);
+		if (sym2)
 			break;
-		}
 	}
 out:
 	expr_list_for_each_sym(prop->expr, e, sym)
@@ -847,6 +958,8 @@ out:
 	    prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
 		sym2 = choice;
 
+	dep_stack_remove();
+
 	return sym2;
 }
 
@@ -856,18 +969,20 @@ struct symbol *sym_check_deps(struct sym
 	struct property *prop;
 
 	if (sym->flags & SYMBOL_CHECK) {
-		fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
-		        sym->prop->file->name, sym->prop->lineno,
-			sym->name ? sym->name : "<choice>");
+		sym_check_print_recursive(sym);
 		return sym;
 	}
 	if (sym->flags & SYMBOL_CHECKED)
 		return NULL;
 
 	if (sym_is_choice_value(sym)) {
+		struct dep_stack stack;
+
 		/* for choice groups start the check with main choice symbol */
+		dep_stack_insert(&stack, sym);
 		prop = sym_get_choice_prop(sym);
 		sym2 = sym_check_deps(prop_get_symbol(prop));
+		dep_stack_remove();
 	} else if (sym_is_choice(sym)) {
 		sym2 = sym_check_choice_deps(sym);
 	} else {
@@ -876,14 +991,8 @@ struct symbol *sym_check_deps(struct sym
 		sym->flags &= ~SYMBOL_CHECK;
 	}
 
-	if (sym2) {
-		fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>");
-		if (sym2 == sym) {
-			fprintf(stderr, "\n");
-			zconfnerrs++;
-			sym2 = NULL;
-		}
-	}
+	if (sym2 && sym2 == sym)
+		sym2 = NULL;
 
 	return sym2;
 }

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
  2008-12-31  2:55   ` Roman Zippel
@ 2008-12-31  9:05     ` Sam Ravnborg
  2009-01-18 20:54     ` Sam Ravnborg
  1 sibling, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2008-12-31  9:05 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kbuild, LKML

On Wed, Dec 31, 2008 at 03:55:00AM +0100, Roman Zippel wrote:
> Hi,
> 
> On Mon, 29 Dec 2008, Sam Ravnborg wrote:
> 
> > It is nessesary to know all locations when trying to track
> > a recursive dependency. So print out all locations for each symbol.
> 
> The problem is that this is little more than a better grep, although 
> kconfig knows exactly what went wrong, but this info is scattered all over 
> the stack.
> We could either return more info to print more than just the symbol or 
> maintain more info while traversing the tree. The patch below does the 
> latter. The patch could use some small cleanups, so it's not final yet.

Hi Roman.

I will drop 
"[PATCH 05/13] kconfig: improve readout when we hit recursive dependencies"
"[PATCH 06/13] kconfig: print all locations when we see a recursive dependency"

and will await an updated version of the patch below.

Notice that with your patch below we still hit the segmentation fault
with the small test sample included in the description of 05/13:

    config TEST1
            bool
            depends on TEST2 && PCI
            select TEST2

    config TEST2
            bool

I guess this was one of the cleanups you had in mind.
I added a promt and then I got the following error message:

Kconfig:2:error: recursive dependency detected!
Kconfig:2:      symbol TEST1 prompt depends on TEST2
Kconfig:4:      symbol TEST2 is selected by TEST1

This is indeed better than before.

    Kconfig:2:      symbol TEST1 prompt depends on TEST2

should read:

    Kconfig:2:      symbol TEST1 depends on TEST2

As it just confuses with the "prompt" in the text.

It would be good to have the final patch ready soon so we can include
it in 2.6.29.

Thanks,
	Sam


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
  2008-12-31  2:55   ` Roman Zippel
  2008-12-31  9:05     ` Sam Ravnborg
@ 2009-01-18 20:54     ` Sam Ravnborg
  1 sibling, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2009-01-18 20:54 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kbuild, LKML

On Wed, Dec 31, 2008 at 03:55:00AM +0100, Roman Zippel wrote:
> Hi,
> 
> On Mon, 29 Dec 2008, Sam Ravnborg wrote:
> 
> > It is nessesary to know all locations when trying to track
> > a recursive dependency. So print out all locations for each symbol.
> 
> The problem is that this is little more than a better grep, although 
> kconfig knows exactly what went wrong, but this info is scattered all over 
> the stack.
> We could either return more info to print more than just the symbol or 
> maintain more info while traversing the tree. The patch below does the 
> latter. The patch could use some small cleanups, so it's not final yet.

Hi Roman.

Have you had time to look more into this?

	Sam

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-01-18 20:52 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-29 13:44 pending kbuild updates Sam Ravnborg
2008-12-29 13:53 ` [PATCH 01/13] m68k: fix recursive dependency in Kconfig Sam Ravnborg
2008-12-29 13:53 ` [PATCH 02/13] kconfig: explain symbol value defaults Sam Ravnborg
2008-12-29 13:53 ` [PATCH 03/13] kconfig: add comments to symbol flags Sam Ravnborg
2008-12-29 13:53 ` [PATCH 04/13] kconfig: struct property commented Sam Ravnborg
2008-12-29 13:53 ` [PATCH 05/13] kconfig: improve readout when we hit recursive dependencies Sam Ravnborg
2008-12-29 13:53 ` [PATCH 06/13] kconfig: print all locations when we see a recursive dependency Sam Ravnborg
2008-12-31  2:55   ` Roman Zippel
2008-12-31  9:05     ` Sam Ravnborg
2009-01-18 20:54     ` Sam Ravnborg
2008-12-29 13:53 ` [PATCH 07/13] kconfig: improve error messages for bad source statements Sam Ravnborg
2008-12-29 13:53 ` [PATCH 08/13] headers_check.pl: disallow extern's Sam Ravnborg
2008-12-29 13:53 ` [PATCH 09/13] kbuild: check for leaked CONFIG_ symbols to userspace Sam Ravnborg
2008-12-29 13:53 ` [PATCH 10/13] kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__ Sam Ravnborg
2008-12-29 13:53 ` [PATCH 11/13] kbuild: disable sparse warning "returning void-valued expression" Sam Ravnborg
2008-12-29 13:53 ` [PATCH 12/13] kbuild: make *config usage docs Sam Ravnborg
2008-12-29 13:53 ` [PATCH 13/13] kbuild: document environment variables Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox