From 79ff807cf23ffb527f3f35bdececf56cabcdee07 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Sun, 29 Mar 2009 15:01:47 +0200 Subject: kbuild: fix option processing for -I in headerdep -I takes an argument. Without this change only a 1 is added to @opt_include which is not helpful. Signed-off-by: Uwe Kleine-König Acked-by: Vegard Nossum Signed-off-by: Sam Ravnborg --- scripts/headerdep.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/headerdep.pl b/scripts/headerdep.pl index 97399da89ef2..b7f6c560e24d 100755 --- a/scripts/headerdep.pl +++ b/scripts/headerdep.pl @@ -19,7 +19,7 @@ my $opt_graph; version => \&version, all => \$opt_all, - I => \@opt_include, + "I=s" => \@opt_include, graph => \$opt_graph, ); -- cgit v1.2.3-55-g7522 From 612c280ef2400c70ea2fd8f2e17549c95002368c Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 8 Apr 2009 08:42:48 +0200 Subject: kconfig: fix update-po-config to accect backslash in input Massimo Maiurana reported (slightly edited): ===== In latest 2.6.29 "make update-po-config" fails at msguniq invocation with an "invalid control sequence" error. The offending string is the following, and it's located in drivers/staging/panel/Kconfig:72: "'\e[L' which are specific to the LCD, and a few ANSI codes. The" looks to me like gettext expects strings in printf format, so in this case it thinks "\e" is a control sequence but doesn't recognise it as a valid one. A valid solution would be to tell kxgettext to automatically escape this kind of strings in the */config.pot he produces, so that msguniq would not complain. ===== This patch implements the suggested escaping. Reported-by: Massimo Maiurana Tested-by: Massimo Maiurana Signed-off-by: Sam Ravnborg --- scripts/kconfig/kxgettext.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index 6eb72a7f2562..8d9ce22b0fc5 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c @@ -43,6 +43,10 @@ static char *escape(const char* text, char *bf, int len) ++text; goto next; } + else if (*text == '\\') { + *bfp++ = '\\'; + len--; + } *bfp++ = *text++; next: --len; -- cgit v1.2.3-55-g7522 From 4774bb1ced60a94d83b28e5a42d4cf01b83d9b60 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Thu, 26 Mar 2009 21:58:04 +0100 Subject: kbuild: use git svn instead of git-svn in setlocalversion Use the correct git syntax instead of the deprecated git-. Signed-off-by: Peter Korsgaard Signed-off-by: Sam Ravnborg --- scripts/setlocalversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index f1c4b35bc324..47e75b69a2e9 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -21,7 +21,7 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then # Is this git on svn? if git config --get svn-remote.svn.url >/dev/null; then - printf -- '-svn%s' "`git-svn find-rev $head`" + printf -- '-svn%s' "`git svn find-rev $head`" fi # Are there uncommitted changes? -- cgit v1.2.3-55-g7522 From c7bb349e7c25df1ae1bbb72675b9bb02e1d9c464 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 10 Apr 2009 08:52:43 +0200 Subject: kbuild: introduce destination-y for exported headers xtensa and arm have asked for a possibility to export headers and locate them in a specific directory when exported. Introduce destiantion-y to support this. This patch in additiona adds some limited documentation for the variables used for exported headers. Signed-off-by: Sam Ravnborg Cc: Oskar Schirmer Cc: Mikael Starvik --- Documentation/kbuild/makefiles.txt | 83 ++++++++++++++++++++++++++++++++++---- scripts/Makefile.headersinst | 2 + 2 files changed, 77 insertions(+), 8 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 51104f9194a5..d4b05672f9f7 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -40,10 +40,16 @@ This document describes the Linux kernel Makefiles. --- 6.7 Custom kbuild commands --- 6.8 Preprocessing linker scripts - === 7 Kbuild Variables - === 8 Makefile language - === 9 Credits - === 10 TODO + === 7 Kbuild syntax for exported headers + --- 7.1 header-y + --- 7.2 objhdr-y + --- 7.3 destination-y + --- 7.4 unifdef-y (deprecated) + + === 8 Kbuild Variables + === 9 Makefile language + === 10 Credits + === 11 TODO === 1 Overview @@ -1143,8 +1149,69 @@ When kbuild executes, the following steps are followed (roughly): The kbuild infrastructure for *lds file are used in several architecture-specific files. +=== 7 Kbuild syntax for exported headers + +The kernel include a set of headers that is exported to userspace. +Many headers can be exported as-is but other headers requires a +minimal pre-processing before they are ready for user-space. +The pre-processing does: +- drop kernel specific annotations +- drop include of compiler.h +- drop all sections that is kernel internat (guarded by ifdef __KERNEL__) + +Each relevant directory contain a file name "Kbuild" which specify the +headers to be exported. +See subsequent chapter for the syntax of the Kbuild file. + + --- 7.1 header-y + + header-y specify header files to be exported. + + Example: + #include/linux/Kbuild + header-y += usb/ + header-y += aio_abi.h + + The convention is to list one file per line and + preferably in alphabetic order. + + header-y also specify which subdirectories to visit. + A subdirectory is identified by a trailing '/' which + can be seen in the example above for the usb subdirectory. + + Subdirectories are visited before their parent directories. + + --- 7.2 objhdr-y + + objhdr-y specifies generated files to be exported. + Generated files are special as they need to be looked + up in another directory when doing 'make O=...' builds. + + Example: + #include/linux/Kbuild + objhdr-y += version.h + + --- 7.3 destination-y + + When an architecture have a set of exported headers that needs to be + exported to a different directory destination-y is used. + destination-y specify the destination directory for all exported + headers in the file where it is present. + + Example: + #arch/xtensa/platforms/s6105/include/platform/Kbuild + destination-y := include/linux + + In the example above all exported headers in the Kbuild file + will be located in the directory "include/linux" when exported. + + + --- 7.4 unifdef-y (deprecated) + + unifdef-y is deprecated. A direct replacement is header-y. + -=== 7 Kbuild Variables +=== 8 Kbuild Variables The top Makefile exports the following variables: @@ -1206,7 +1273,7 @@ The top Makefile exports the following variables: INSTALL_MOD_STRIP will used as the option(s) to the strip command. -=== 8 Makefile language +=== 9 Makefile language The kernel Makefiles are designed to be run with GNU Make. The Makefiles use only the documented features of GNU Make, but they do use many @@ -1225,14 +1292,14 @@ time the left-hand side is used. There are some cases where "=" is appropriate. Usually, though, ":=" is the right choice. -=== 9 Credits +=== 10 Credits Original version made by Michael Elizabeth Chastain, Updates by Kai Germaschewski Updates by Sam Ravnborg Language QA by Jan Engelhardt -=== 10 TODO +=== 11 TODO - Describe how kbuild supports shipped files with _shipped. - Generating offset header files. diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 612dc13ddd85..095cfc8b9dbf 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -14,6 +14,8 @@ _dst := $(if $(dst),$(dst),$(obj)) kbuild-file := $(srctree)/$(obj)/Kbuild include $(kbuild-file) +_dst := $(if $(destination-y),$(destination-y),$(_dst)) + include scripts/Kbuild.include install := $(INSTALL_HDR_PATH)/$(_dst) -- cgit v1.2.3-55-g7522 From fe8d0a41081d6d0912386f3672ccc0bf1d675630 Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Thu, 9 Apr 2009 15:34:34 +0400 Subject: kbuild: fix a few typos in top-level Makefile Signed-off-by: Kirill Smelkov Acked-by: Dmitry Gryazin Signed-off-by: Sam Ravnborg --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e5ad5fd96177..3e95d454285c 100644 --- a/Makefile +++ b/Makefile @@ -567,7 +567,7 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) # disable pointer signed / unsigned warnings in gcc 4.0 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) -# disable invalid "can't wrap" optimzations for signed / pointers +# disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fwrapv) # revert to pre-gcc-4.4 behaviour of .eh_frame @@ -1587,5 +1587,5 @@ PHONY += FORCE FORCE: # Declare the contents of the .PHONY variable as phony. We keep that -# information in a variable se we can use it in if_changed and friends. +# information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY) -- cgit v1.2.3-55-g7522 From 0fa3a88cfdfc910d7f335aef588edf9819c05d54 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 12 Mar 2009 12:28:30 +0000 Subject: kbuild: remove pointless strdup() on arguments passed to new_module() in modpost new_module() itself already calls strdup() on its modname parameter. Signed-off-by: Jan Beulich Signed-off-by: Sam Ravnborg --- scripts/mod/modpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 8cc70612984c..df6e6286a065 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1913,7 +1913,7 @@ static void read_dump(const char *fname, unsigned int kernel) if (!mod) { if (is_vmlinux(modname)) have_vmlinux = 1; - mod = new_module(NOFAIL(strdup(modname))); + mod = new_module(modname); mod->skip = 1; } s = sym_add_exported(symname, mod, export_no(export)); @@ -1997,7 +1997,7 @@ static void read_markers(const char *fname) mod = find_module(modname); if (!mod) { - mod = new_module(NOFAIL(strdup(modname))); + mod = new_module(modname); mod->skip = 1; } if (is_vmlinux(modname)) { -- cgit v1.2.3-55-g7522 From 5d7d18f5bc507b60d3d8967e2739d5e6ffdd630f Mon Sep 17 00:00:00 2001 From: David Howells Date: Wed, 4 Mar 2009 11:59:07 -0800 Subject: kbuild: make it possible for the linker to discard local symbols from vmlinux Make it possible for the linker to discard local symbols from vmlinux as they cause vmlinux to balloon when CONFIG_KALLSYMS=y and they cause dump_stack() and get_wchan() to produce useless information under some circumstances. With this we add a config option (CONFIG_STRIP_ASM_SYMS) that will cause the build to supply -X to the linker to tell it to strip temporary local symbols. This doesn't seem to cause gdb any problems. Signed-off-by: David Howells Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 4 ++++ init/Kconfig | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 3e95d454285c..ad830bd45a4b 100644 --- a/Makefile +++ b/Makefile @@ -597,6 +597,10 @@ LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) +ifeq ($(CONFIG_STRIP_ASM_SYMS),y) +LDFLAGS_vmlinux += -X +endif + # Default kernel image to build when no specific target is given. # KBUILD_IMAGE may be overruled on the command line or # set in the environment diff --git a/init/Kconfig b/init/Kconfig index f2f9b5362b48..7be4d3836745 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -808,6 +808,14 @@ config KALLSYMS_EXTRA_PASS you wait for kallsyms to be fixed. +config STRIP_ASM_SYMS + bool "Strip assembler-generated symbols during link" + default n + help + Strip internal assembler-generated symbols during a link (symbols + that look like '.Lxxx') so they don't pollute the output of + get_wchan() and suchlike. + config HOTPLUG bool "Support for hot-pluggable devices" if EMBEDDED default y -- cgit v1.2.3-55-g7522 From 20375bf82567b5fecd331048c6cc1fc292b67710 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 10 Apr 2009 13:18:08 +0200 Subject: Documentation: explain the difference between __bitwise and __bitwise__ Simply added explanation from Al Viro in the following mail: http://lkml.indiana.edu/hypermail/linux/kernel/0802.2/3164.html Cc: Al Viro Cc: Randy Dunlap Signed-off-by: Sam Ravnborg --- Documentation/sparse.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt index 42f43fa59f24..34c76a55bc04 100644 --- a/Documentation/sparse.txt +++ b/Documentation/sparse.txt @@ -42,6 +42,14 @@ sure that bitwise types don't get mixed up (little-endian vs big-endian vs cpu-endian vs whatever), and there the constant "0" really _is_ special. +__bitwise__ - to be used for relatively compact stuff (gfp_t, etc.) that +is mostly warning-free and is supposed to stay that way. Warnings will +be generated without __CHECK_ENDIAN__. + +__bitwise - noisy stuff; in particular, __le*/__be* are that. We really +don't want to drown in noise unless we'd explicitly asked for it. + + Getting sparse ~~~~~~~~~~~~~~ -- cgit v1.2.3-55-g7522 From 9e5ec8615209f6a5bf2a612120d972b6021790da Mon Sep 17 00:00:00 2001 From: Maxime Bizon Date: Mon, 9 Feb 2009 18:49:52 +0100 Subject: kbuild: fix spurious initramfs rebuild When gen_initramfs_list is used to generate make dependencies, it includes symbolic links, for which make tracks the link target. Any change to that target will cause an initramfs rebuild, even if the symlink points to something outside of the initramfs directory. If the target happens to be /tmp, the rebuild occurs for each kernel build, since gen_initramfs_list uses mktemp... Proposed way to fix it is to omit symbolic links from generated dependencies, but this has a small drawback: changing perm/owner on a symlink will go unnoticed. Signed-off-by: Maxime Bizon Signed-off-by: Sam Ravnborg --- scripts/gen_initramfs_list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 3eea8f15131b..76af5f9623e3 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -97,7 +97,7 @@ print_mtime() { } list_parse() { - echo "$1 \\" + [ ! -L "$1" ] && echo "$1 \\" || : } # for each file print a line in following format -- cgit v1.2.3-55-g7522 From 2810ae8c73cbfb37891aa99dfbca46ffd40dbc91 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 10 Apr 2009 14:20:54 -0700 Subject: docbook: make cleandocs Add a 'make cleandocs' target to clean up all generated DocBook files. Signed-off-by: Randy Dunlap Signed-off-by: Sam Ravnborg --- Documentation/DocBook/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index a3a83d38f96f..8918a32c6b3a 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -31,7 +31,7 @@ PS_METHOD = $(prefer-db2x) ### # The targets that may be used. -PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs +PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) xmldocs: $(BOOKS) @@ -213,11 +213,12 @@ silent_gen_xml = : dochelp: @echo ' Linux kernel internal documentation in different formats:' @echo ' htmldocs - HTML' - @echo ' installmandocs - install man pages generated by mandocs' - @echo ' mandocs - man pages' @echo ' pdfdocs - PDF' @echo ' psdocs - Postscript' @echo ' xmldocs - XML DocBook' + @echo ' mandocs - man pages' + @echo ' installmandocs - install man pages generated by mandocs' + @echo ' cleandocs - clean all generated DocBook files' ### # Temporary files left by various tools @@ -235,6 +236,10 @@ clean-files := $(DOCBOOKS) \ clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man +cleandocs: + $(Q)rm -f $(call objectify, $(clean-files)) + $(Q)rm -rf $(call objectify, $(clean-dirs)) + # Declare the contents of the .PHONY variable as phony. We keep that # information in a variable se we can use it in if_changed and friends. -- cgit v1.2.3-55-g7522