From cfb2a494bb7dca9cf8d1632fbed14b34db051980 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 22:41:18 +0100 Subject: m68k: fix recursive dependency in Kconfig 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 Acked-by: Geert Uytterhoeven Cc: Roman Zippel --- arch/m68k/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 836fb66f080..c825bde17cb 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 -- cgit v1.2.3 From eaa2a87460eca27ce725d63bbcf3b2da053828b7 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 21:07:57 +0100 Subject: kconfig: explain symbol value defaults Added a few comments - no functional change. Signed-off-by: Sam Ravnborg --- scripts/kconfig/expr.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 9d4cba1c001..455f2c87ebb 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; -- cgit v1.2.3 From 5b2cf365a8e9bbf781939e941ed548c9743fdeea Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 21:25:00 +0100 Subject: kconfig: add comments to symbol flags No functional changes - only comments. Signed-off-by: Sam Ravnborg --- scripts/kconfig/expr.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 455f2c87ebb..0bdb58eda0c 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 -- cgit v1.2.3 From cf82607a904d3b2ed3d66f8799f00d1099c1849c Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 21:32:31 +0100 Subject: kconfig: struct property commented No functional changes Signed-off-by: Sam Ravnborg --- scripts/kconfig/expr.h | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 0bdb58eda0c..6408fefae08 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) \ -- cgit v1.2.3 From 7826005e5a53645d7aab7c13eda76126eadebf0b Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 27 Dec 2008 21:51:59 +0100 Subject: kconfig: improve error messages for bad source statements 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 Cc: Roman Zippel --- 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 7342ce0a778..dc3e81807d1 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 5164ef7ce49..21ff69c9ad4 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; -- cgit v1.2.3 From 46b8af50ba5c072b74740c5fa8ba08e6eabb22f8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 27 Dec 2008 02:43:36 -0500 Subject: headers_check.pl: disallow extern's Since prototypes with "extern" refer to kernel functions, they make no sense in userspace, so reject them automatically. Signed-off-by: Mike Frysinger [sam: made it into a warning] Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 488a3b1f760..5bdd9753007 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 = ) { $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"; + } +} -- cgit v1.2.3 From 7e557a2509f9e1477c10295b74e29e4e93fa2392 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 27 Dec 2008 19:52:20 +0100 Subject: kbuild: check for leaked CONFIG_ symbols to userspace Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 5bdd9753007..72924a7fcf1 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"; + } +} + -- cgit v1.2.3 From 4307184f2b9240d0443bdf944c7b9eac044fe67b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 27 Dec 2008 03:23:15 -0500 Subject: kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__ 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 Signed-off-by: Sam Ravnborg --- scripts/headers_install.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index 7d2b4146e02..c6ae4052ab4 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 //; + $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; -- cgit v1.2.3 From 80a7d1d991e35b0370c0396f36f6a076869a6bac Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Sat, 27 Dec 2008 22:38:44 +0100 Subject: kbuild: disable sparse warning "returning void-valued expression" 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 Signed-off-by: Sam Ravnborg --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d13a9694e15..f9006663f01 100644 --- a/Makefile +++ b/Makefile @@ -321,7 +321,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) -- cgit v1.2.3 From 2af238e455ef5fd31c2f7a06c2db3f13d843b9bf Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 29 Feb 2008 14:21:53 -0800 Subject: kbuild: make *config usage docs 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 Signed-off-by: Sam Ravnborg --- 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 11464428545..54a118a20f2 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 00000000000..26a7c0a9319 --- /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 + ) 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= 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 159912cf515..90a07658ede 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 -- cgit v1.2.3 From acc08b516f25b79cfcff310e51d95048bfcf7b0d Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 29 Dec 2008 13:45:52 +0100 Subject: kbuild: document environment variables 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 --- 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 54a118a20f2..e8d2b6d83a3 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 00000000000..51771847e81 --- /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. -- cgit v1.2.3 From 521b0c774d1350aac18f5cd35831469a4e879d72 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 30 Dec 2008 10:20:08 +0100 Subject: kbuild: drop debugging leftover in tags.sh Noticed by Jike. Reported-by: "Jike Song" Signed-off-by: Sam Ravnborg --- scripts/tags.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index 4e754720985..9e3451d2c3a 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -84,7 +84,6 @@ docscope() exuberant() { - all_sources > all all_sources | xargs $1 -a \ -I __initdata,__exitdata,__acquires,__releases \ -I __read_mostly,____cacheline_aligned \ -- cgit v1.2.3 From 483b41218fa9d5172312a9e294aaf78e22b266e6 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 30 Dec 2008 11:34:58 +0100 Subject: kbuild: add checks for include of linux/types in userspace headers If we see __[us](8|16|32|64) then we must include If wee see include of then we recommend Original script from Mike but modified by me. Cc: Mike Frysinger Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 72924a7fcf1..b62c319611a 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -34,9 +34,11 @@ foreach my $file (@files) { $lineno = 0; while ($line = ) { $lineno++; - check_include(); - check_prototypes(); - check_config(); + &check_include(); + &check_asm_types(); + &check_sizetypes(); + &check_prototypes(); + &check_config(); } close FH; } @@ -73,3 +75,42 @@ sub check_config } } +my $linux_asm_types; +sub check_asm_types() +{ + if ($lineno == 1) { + $linux_asm_types = 0; + } elsif ($linux_asm_types >= 1) { + return; + } + if ($line =~ m/^\s*#\s*include\s+/) { + $linux_asm_types = 1; + printf STDERR "$filename:$lineno: " . + "include of is preferred over \n" + # Warn until headers are all fixed + #$ret = 1; + } +} + +my $linux_types; +sub check_sizetypes +{ + if ($lineno == 1) { + $linux_types = 0; + } elsif ($linux_types >= 1) { + return; + } + if ($line =~ m/^\s*#\s*include\s+/) { + $linux_types = 1; + return; + } + if ($line =~ m/__[us](8|16|32|64)\b/) { + printf STDERR "$filename:$lineno: " . + "found __[us]{8,16,32,64} type " . + "without #include \n"; + $linux_types = 2; + # Warn until headers are all fixed + #$ret = 1; + } +} + -- cgit v1.2.3 From b67ff8ce122f3353bd741db48ce1756c12fb5f2d Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 31 Dec 2008 09:32:30 +0100 Subject: kbuild: ignore a few files in headers_check The new check for asm/types.h and linux/types.h had a few false positives. o We cannot let linux/types.h include linux/types.h o The int-ll64.h and int-ll64.h define the types and are included by linux/types.h Handle this by hardcoding the filenames in the headers_check script. Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index b62c319611a..db30fac3083 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -78,6 +78,9 @@ sub check_config my $linux_asm_types; sub check_asm_types() { + if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { + return; + } if ($lineno == 1) { $linux_asm_types = 0; } elsif ($linux_asm_types >= 1) { @@ -95,6 +98,9 @@ sub check_asm_types() my $linux_types; sub check_sizetypes { + if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { + return; + } if ($lineno == 1) { $linux_types = 0; } elsif ($linux_types >= 1) { -- cgit v1.2.3