GIT 172c3ae3e686f548a0eba950405e5cc321460005 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git commit 172c3ae3e686f548a0eba950405e5cc321460005 Author: Sam Ravnborg Date: Fri Mar 10 00:23:32 2006 +0100 kbuild: in makefile.txt note that Makefile is preferred name for kbuild files As noted by Roland Dreier makefiles.txt told one to use the name 'Kbuild' as preferred name for kbuild files. This is not yet true so let makefiles.txt reflect reality. Signed-off-by: Sam Ravnborg commit 0131705d589e2341dbc5e8946a60f83d8c1773dc Author: Sam Ravnborg Date: Wed Mar 8 18:39:05 2006 +0100 kbuild: replace PHONY with FORCE .PHONY: does not take patterns so use FORCE to achive same effect. Thanks to "Paul D. Smith" for noticing this. Signed-off-by: Sam Ravnborg commit f7b05e64bdb2fcc4b2dc94a4bd9426adc70c9599 Author: Luke Yang Date: Thu Mar 2 18:35:31 2006 +0800 kbuild: Fix bug in crc symbol generating of kernel and modules The scripts/genksyms/genksyms.c uses hardcoded "__crc_" prefix for crc symbols in kernel and modules. The prefix should be replaced by "MODULE_SYMBOL_PREFIX##__crc_" otherwise there will be warnings when MODULE_SYMBOL_PREFIX is not NULL. I am sorry my last patch for this issue is actually wrong. I revert it in this patch. Signed-off-by: Luke Yang Signed-off-by: Sam Ravnborg commit 4f1933620f57145212cdbb1ac6ce099eeeb21c5a Author: Paul Smith Date: Sun Mar 5 17:14:10 2006 -0500 kbuild: change kbuild to not rely on incorrect GNU make behavior The kbuild system takes advantage of an incorrect behavior in GNU make. Once this behavior is fixed, all files in the kernel rebuild every time, even if nothing has changed. This patch ensures kbuild works with both the incorrect and correct behaviors of GNU make. For more details on the incorrect behavior, see: http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html Changes in this patch: - Keep all targets that are to be marked .PHONY in a variable, PHONY. - Add .PHONY: $(PHONY) to mark them properly. - Remove any $(PHONY) files from the $? list when determining whether targets are up-to-date or not. Signed-off-by: Paul Smith Signed-off-by: Sam Ravnborg commit 7b75b13cda8bd21e8636ea985f76e1ce5bd1a470 Author: Sam Ravnborg Date: Sun Mar 5 13:48:58 2006 +0100 kbuild: when warning symbols exported twice now tell user this is the problem Warning now looks like this: WARNING: vmlinux: 'strcpy' exported twice. Previous export was in vmlinux Which gives much better hint how to fix it. Signed-off-by: Sam Ravnborg commit f6ecebd6592ea70e9450ec70efb24220dd961ebc Author: Sam Ravnborg Date: Sun Mar 5 12:10:58 2006 +0100 kbuild: fix make dir/file.xx when asm symlink is missing Added a dependency so we do full preparation before trying to build single file targets. This fixes a case where Andrew Morton did: make kernel/sched.o rm include/asm make kernel/sched.o -> splat Signed-off-by: Sam Ravnborg commit 43c74d179596ba1f8eceb8c6a5c7e11afe233662 Author: Sam Ravnborg Date: Sun Mar 5 12:02:46 2006 +0100 kbuild: in the section mismatch check try harder to find symbols When searching for symbols the only check performed was if offset equals st_value. Adding an additional check to see if st_name points t a valid name made us sort out a few more false positives and let us report more correct names in warnings. Signed-off-by: Sam Ravnborg commit e835a39c1c1f023ef443f735b0e98b08660ae0e4 Author: Sam Ravnborg Date: Sun Mar 5 11:34:15 2006 +0100 kbuild: fix section mismatch check for unwind on IA64 Parameters to strstr() was reversed. Signed-off-by: Sam Ravnborg commit 9209aed0726c77ad13b8d83e73a3cf9f59a8c2b2 Author: Sam Ravnborg Date: Sun Mar 5 00:16:26 2006 +0100 kbuild: kill false positives from section mismatch warnings for powerpc Building an allmodconfig kernel for ppc64 revealed a number of false positives - originally reported by Andrew Morton. This patch removes most if not all false positives for ppc64: Section .opd The .opd section contains function descriptors at least for ppc64. So ignore it for .init.text (was ignored for .exit.text). See description of function descriptors here: http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi-1.7.html Section .toc1 ppc64 places some static variables in .toc1 - ignore the. Section __bug_tabe BUG() and friends uses __bug_table. Ignore warnings from that section. Module parameters are placed in .data.rel for ppc64, for adjust pattern to match on section named .data* Tested with gcc: 3.4.0 and binutils 2.15.90.0.3 Signed-off-by: Sam Ravnborg commit 62070fa42c4ac23d1d71146a4c14702302b80245 Author: Sam Ravnborg Date: Fri Mar 3 16:46:04 2006 +0100 kbuild: kill trailing whitespace in modpost & friends Signed-off-by: Sam Ravnborg commit e11f04962cee8f7fb0dc14983a7a461ade8f71c3 Author: Jesper Juhl Date: Sat Feb 25 21:52:50 2006 +0100 kbuild: small update of allnoconfig description 'allnoconfig' is described by 'make help' as a "minimal config", that's not strictly correct. To be pedantic, a minimal config would be one where EMBEDDED was set to Y and most things therein disabled etc. Simply answering 'no' to all options does not give a minimal config. A better description of allnoconfig is that it answers all options with 'no'. This patch updates the description. Signed-off-by: Jesper Juhl Signed-off-by: Sam Ravnborg commit 3a25f0b19f2eefd158955ab809c8947ed8feadf1 Author: Aaron Brooks Date: Sun Feb 26 22:25:46 2006 -0500 kbuild: make namespace.pl CROSS_COMPILE happy Using the fixed path to /usr/bin/{nm,objdump} does not allow CROSS_COMPILE environments to use namespace.pl. This patch causes namespace.pl to use $NM and $OBJDUMP if defined or fall back to the nm and objdump found in the path. Signed-off-by: Aaron Brooks Signed-off-by: Sam Ravnborg commit 4c8fbca5836aaafd165aa8732d92ab5d4f3a6841 Author: Sam Ravnborg Date: Sun Feb 26 22:18:11 2006 +0100 kbuild: whitelist false section mismatch warnings In several cases the section mismatch check triggered false warnings. Following patch introduce a whitelist to 'false positives' are not warned of. Two types of patterns are recognised: 1) Typical case when a module parameter is _initdata 2) When a function pointer is assigned to a driver structure In both patterns we rely on the actual name of the variable assigned Signed-off-by: Sam Ravnborg commit cc006288fb538005a14ca4297250abbf0beeb0b9 Author: Sam Ravnborg Date: Sun Feb 26 20:15:58 2006 +0100 kbuild: ignore all generated files for make allmodconfig (x86_64) With following patch we now ignore all generated files for make allmodconfig for x86_64. Signed-off-by: Sam Ravnborg commit 382168f4791822de7d44d9c634fbfdf8bc08c91b Author: Sam Ravnborg Date: Sun Feb 26 20:11:17 2006 +0100 kbuild: Add copyright to modpost.c It seems popular to protect your work with copyright, so I decided to do so for modpost which I patch a great deal atm. Signed-off-by: Sam Ravnborg commit c3f9da90b6e63c968070aa72057fe15356b3f7b5 Author: Jan Beulich Date: Wed Feb 22 13:29:04 2006 +0100 kbuild: version.h should depend on .kernelrelease Rebuilding a previously built tree while using make's -j options from time to time results in the version.h check running at the same time as the updating of .kernelrelease, resulting in UTS_RELEASE remaining an empty string (and as a side effect causing the entire kernel to be rebuilt). Signed-Off-By: Jan Beulich Signed-off-by: Sam Ravnborg commit 6e10133fa4b2366e8ef18bc2ce34afe727b1c4ba Author: Sam Ravnborg Date: Wed Feb 22 21:24:50 2006 +0100 kbuild: do not warn when unwind sections references .init/.exit sections Andrew Morton reported a number of false positives for ia64 - like these: WARNING: drivers/acpi/button.o - Section mismatch: reference to .init.text: from .IA_64.unwind.init.text after '' (at offset 0x0) WARNING: drivers/acpi/button.o - Section mismatch: reference to .exit.text: from .IA_64.unwind.exit.text after '' (at offset 0x0) WARNING: drivers/acpi/processor.o - Section mismatch: reference to .init.text: from .IA_64.unwind after '' (at offset 0x1e8) They are all false positives - or at least the .c code looks OK. It is not known why sometimes a section name is appended and sometimes not. Fix is to accept references from all sections that includes "unwind." in the name. Signed-off-by: Sam Ravnborg commit fededcd2af6219de69b252b7d3ea4b4ec2f33c7a Author: akpm@osdl.org Date: Wed Feb 22 03:19:54 2006 -0800 kbuild: fix modpost compile with older gcc The kernel now requires that CC be 3.1.0 or higher. But we shouldn't place that requirement upon HOSTCC unless we really need to. Fixes my ia64 problem. Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg commit 0f558c333445a0181f33f9e6f996ce7cf008206a Author: Mattia Dongili Date: Sun Feb 19 13:50:37 2006 +0100 kbuild: fix a cscope bug (make cscope segfaults) Workaround a cscope bug where a trailing ':' in VPATH makes it segfault and let it build the cross-reference succesfully. VPATH=/home/mattia/devel/kernel/git/linux-2.6: cscope -b [1] 17555 segmentation fault VPATH=/home/mattia/devel/kernel/git/linux-2.6: cscope -b Signed-off-by: Mattia Dongili Signed-off-by: Sam Ravnborg commit 93684d3b8062d1cebdeaed398ec6d1f354cb41a9 Author: Sam Ravnborg Date: Sun Feb 19 11:53:35 2006 +0100 kbuild: include symbol names in section mismatch warnings Try to look up the symbol that is referenced. Include the symbol name in the warning message. Signed-off-by: Sam Ravnborg commit 8ea80ca4f583e377c902811d42626ccfce16913f Author: Sam Ravnborg Date: Sun Feb 19 09:56:18 2006 +0100 kbuild: fix segfault in modpost Do not try to look up section name until we know it is not a special section. Otherwise we will address outside legal space and segfault. Signed-off-by: Sam Ravnborg commit 41370d3b5ec6401c5cf0df82297ed989c03a64bd Author: Sam Ravnborg Date: Sun Feb 19 00:49:37 2006 +0100 kbuild: do not segfault in modpost if MODVERDIR is not defined A combination of calling modpost with option -a and MODVERDIR undefined caused segmentation fault. So provide a default value and accept the error messages it generates instead. Signed-off-by: Sam Ravnborg commit 9d6e7a709cdb8f43d9a9ac5532b54a3e70415b9b Author: Sam Ravnborg Date: Sat Feb 18 10:03:40 2006 +0100 kbuild: fix comment in Kbuild.include Noted by Olaf Hering Signed-off-by: Sam Ravnborg commit 18a43ba26dcbe2a7a51011c9daae37adc7fc5c93 Author: Brian Gerst Date: Wed Feb 15 01:01:58 2006 -0500 kbuild: remove checkconfig.pl checkconfig.pl is no longer needed now that autoconf.h is automatically included. Remove it and all references to it. Signed-off-by: Brian Gerst Signed-off-by: Sam Ravnborg commit e63046630c8a73825896cef140fbf49af233fd2a Author: Adrian Bunk Date: Tue Feb 14 15:58:15 2006 +0100 kbuild: remove a tab from an empty line Emacs warns if an otherwise empty line starts with a tab. Signed-off-by: Adrian Bunk Signed-off-by: Sam Ravnborg commit 96678281bfaa5f04752a98f9b93454041169fd3b Author: Jan Beulich Date: Mon Jan 30 10:05:09 2006 +0100 kbuild: fix mkmakefile With the current way of generating the Makefile in the output directory for builds outside of the source tree, specifying real targets (rather than phony ones) doesn't work in an already (partially) built tree, as the stub Makefile doesn't have any dependency information available. Thus, all targets where files may actually exist must be listed explicitly and, due to what I'd call a make misbehavior, directory targets must then also be special cased. Signed-Off-By: Jan Beulich Signed-off-by: Sam Ravnborg commit 6176aa9ae4b83e1957d3031774f8a8e59ff97420 Author: Jan Beulich Date: Mon Jan 30 10:04:27 2006 +0100 kbuild: consolidate command line escaping While the recent change to also escape # symbols when storing C-file compilation command lines was helpful, it should be in effect for all command lines, as much as the dollar escaping should be in effect for C-source compilation commands. Additionally, for better readability and maintenance, consolidating all the escaping (single quotes, dollars, and now sharps) was also desirable. Signed-Off-By: Jan Beulich Signed-off-by: Sam Ravnborg commit 20a468b51325b3636785a8ca0047ae514b39cbd5 Author: Sam Ravnborg Date: Sun Jan 22 13:34:15 2006 +0100 kbuild: make cc-version available in kbuild files Move $(CC) support functions to Kbuild.include so they are available in the kbuild files. In addition the following was done: o as-option documented in Documentation/kbuild/makefiles.txt o Moved documentation to new section to match new scope of functions o added cc-ifversion used to conditionally select a text string dependent on actual $(CC) version o documented cc-ifversion o change so Kbuild.include is read before the kbuild file Signed-off-by: Sam Ravnborg commit b39927cf4cc5a9123d2b157ffd396884cb8156eb Author: Sam Ravnborg Date: Fri Feb 17 22:42:02 2006 +0100 kbuild: check for section mismatch during modpost stage Section mismatch is identified as references to .init* sections from non .init sections. And likewise references to .exit.* sections outside .exit sections. .init.* sections are discarded after a module is initialized and references to .init.* sections are oops candidates. .exit.* sections are discarded when a module is built-in and thus references to .exit are also oops candidates. The checks were possible to do using 'make buildcheck' which called the two perl scripts: reference_discarded.pl and reference_init.pl. This patch just moves the same functionality inside modpost and the scripts are then obsoleted. They will though be kept for a while so users can do double checks - but note that some .o files are skipped by the perl scripts so result is not 1:1. All credit for the concept goes to Keith Owens who implemented the original perl scrips - this patch just moves it to modpost. Compared to the perl script the implmentation in modpost will be run for each kernel build - thus catching the error much sooner, but the downside is that the individual .o file are not always identified. Signed-off-by: Sam Ravnborg commit a67dc21a38055ec2d8d85b2f64d98091748569b3 Author: Sam Ravnborg Date: Sat Jan 28 23:51:57 2006 +0100 kbuild: run depmod when installing external modules Following patch enables depmod support when installing external modules. Signed-off-by: Sam Ravnborg commit fb3cbd2e575f9ac0700bfa1e7cb9f4119fbd0abd Author: Sam Ravnborg Date: Sat Jan 28 23:08:40 2006 +0100 kbuild: avoid stale modules in $(MODVERDIR) for external modules To avoid stale modules located in $(MODVERDIR) aka .tmp_versions/ always delete the directory when building an external module. Signed-off-by: Sam Ravnborg commit 8999257c292cb757828ae3def9f5e9d894a24741 Author: Martin Michlmayr Date: Sat Jan 28 18:38:15 2006 +0000 kbuild: Accept various mips sub-types in SUBARCH uname -m on MIPS can give a number of results, such as mips64. We need to add another substitution to the sed call for SUBARCH in the main Makefile. Signed-off-by: Martin Michlmayr Signed-off-by: Sam Ravnborg commit 379b5441aeb895fe55b877a8a9c187e8728f774c Author: Zach Brown Date: Fri Jan 27 14:02:47 2006 -0800 x86: align per-cpu section to configured cache bytes This matches the fix for a bug seen on x86-64. Test booted on old hardware that had 32 byte cachelines to begin with. Signed-off-by: Zach Brown Signed-off-by: Sam Ravnborg commit 8e70c45887a6bbe40393342ea5b426b0dd836dff Author: Sam Ravnborg Date: Sat Jan 28 22:22:33 2006 +0100 kbuild: warn about duplicate exported symbols In modpost introduce a check for symbols exported twice. This check caught only one victim (inet_bind_bucket_create) for which a patch is already sent to netdev. Signed-off-by: Sam Ravnborg commit 040fcc819a2e7783a570f4bdcdd1f2a7f5f06837 Author: Sam Ravnborg Date: Sat Jan 28 22:15:55 2006 +0100 kbuild: improved modversioning support for external modules With following patch a second option is enabled to obtain symbol information from a second external module when a external module is build. The recommended approach is to use a common kbuild file but that may be impractical in certain cases. With this patch one can copy over a Module.symvers from one external module to make symbols (and symbol versions) available for another external module. Updated documentation in Documentation/kbuild/modules.txt Signed-off-by: Sam Ravnborg commit 5c3ead8c72788d36d34c9f1689fb529d1339b405 Author: Sam Ravnborg Date: Sat Jan 28 17:19:35 2006 +0100 kbuild: apply CodingStyle to modpost.c Just some light CodingStyle updates - no functional changes. Signed-off-by: Sam Ravnborg commit cb80514d9c517cc1d101ef304529a0e9b76b4468 Author: Sam Ravnborg Date: Sat Jan 28 16:57:26 2006 +0100 kbuild: use warn()/fatal() consistent in modpost modpost.c provides warn() and fatal() - so use them all over the place. Signed-off-by: Sam Ravnborg commit 06300b21f4c79fd1578f4b7ca4b314fbab61a383 Author: Sam Ravnborg Date: Wed Jan 25 07:13:18 2006 +0100 kbuild: support building individual files for external modules Support building individual files when dealing with separate modules. So say you have a module named "foo" which consist of two .o files bar.o and fun.o. You can then do: make -C $KERNELSRC M=`pwd` bar.o make -C $KERNELSRC M=`pwd` bar.lst make -C $KERNELSRC M=`pwd` bar.i make -C $KERNELSRC M=`pwd` / <= will build all .o files and link foo.o make -C $KERNELSRC M=`pwd` foo.ko <= will build the module and do the modpost step to create foo.ko The above will also work if the external module is placed in a subdirectory using a hirachy of kbuild files. Thanks to Andreas Gruenbacher for initial feature request / bug report. Signed-off-by: Sam Ravnborg --- Signed-off-by: Andrew Morton --- dev/null | 65 -- Documentation/DocBook/Makefile | 8 Documentation/kbuild/makefiles.txt | 171 +++-- Documentation/kbuild/modules.txt | 98 ++- Documentation/smart-config.txt | 4 Makefile | 176 ++--- arch/arm/Makefile | 5 arch/arm/boot/Makefile | 5 arch/arm/boot/bootp/Makefile | 5 arch/arm26/Makefile | 7 arch/arm26/boot/Makefile | 5 arch/i386/Makefile | 4 arch/i386/kernel/vmlinux.lds.S | 3 arch/ia64/Makefile | 5 arch/m32r/Makefile | 5 arch/powerpc/Makefile | 2 arch/ppc/Makefile | 2 arch/ppc/boot/Makefile | 5 arch/ppc/boot/openfirmware/Makefile | 7 arch/sh/Makefile | 2 arch/um/Makefile | 7 arch/x86_64/Makefile | 4 drivers/atm/.gitignore | 5 drivers/video/matrox/matroxfb_DAC1064.c | 1 drivers/video/matrox/matroxfb_DAC1064.h | 1 drivers/video/matrox/matroxfb_Ti3026.c | 1 drivers/video/matrox/matroxfb_Ti3026.h | 1 drivers/video/matrox/matroxfb_base.c | 1 drivers/video/matrox/matroxfb_misc.c | 1 scripts/Kbuild.include | 65 +- scripts/Makefile.build | 23 scripts/Makefile.clean | 10 scripts/Makefile.modinst | 10 scripts/Makefile.modpost | 19 scripts/basic/fixdep.c | 14 scripts/genksyms/genksyms.c | 4 scripts/kconfig/Makefile | 6 scripts/kconfig/lxdialog/Makefile | 6 scripts/mkmakefile | 8 scripts/mod/file2alias.c | 17 scripts/mod/mk_elfconfig.c | 4 scripts/mod/modpost.c | 698 +++++++++++++++++----- scripts/mod/modpost.h | 25 scripts/mod/sumversion.c | 32 - scripts/namespace.pl | 4 scripts/package/Makefile | 20 sound/oss/.gitignore | 4 47 files changed, 1082 insertions(+), 493 deletions(-) diff -puN arch/arm26/boot/Makefile~git-kbuild arch/arm26/boot/Makefile --- devel/arch/arm26/boot/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/arm26/boot/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # arch/arm26/boot/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. @@ -60,7 +63,7 @@ $(obj)/xipImage: vmlinux FORCE @echo ' Kernel: $@ is ready' endif -.PHONY: initrd +PHONY += initrd initrd: @test "$(INITRD_PHYS)" != "" || \ (echo This machine does not support INITRD; exit -1) diff -puN arch/arm26/Makefile~git-kbuild arch/arm26/Makefile --- devel/arch/arm26/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/arm26/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # arch/arm26/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. @@ -49,9 +52,9 @@ all: zImage boot := arch/arm26/boot -.PHONY: maketools FORCE +PHONY += maketools FORCE maketools: FORCE - + # Convert bzImage to zImage bzImage: vmlinux diff -puN arch/arm/boot/bootp/Makefile~git-kbuild arch/arm/boot/bootp/Makefile --- devel/arch/arm/boot/bootp/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/arm/boot/bootp/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # linux/arch/arm/boot/bootp/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# LDFLAGS_bootp :=-p --no-undefined -X \ --defsym initrd_phys=$(INITRD_PHYS) \ @@ -21,4 +24,4 @@ $(obj)/kernel.o: arch/arm/boot/zImage FO $(obj)/initrd.o: $(INITRD) FORCE -.PHONY: $(INITRD) FORCE +PHONY += $(INITRD) FORCE diff -puN arch/arm/boot/Makefile~git-kbuild arch/arm/boot/Makefile --- devel/arch/arm/boot/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/arm/boot/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # arch/arm/boot/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. @@ -73,7 +76,7 @@ $(obj)/bootpImage: $(obj)/bootp/bootp FO $(call if_changed,objcopy) @echo ' Kernel: $@ is ready' -.PHONY: initrd FORCE +PHONY += initrd FORCE initrd: @test "$(INITRD_PHYS)" != "" || \ (echo This machine does not support INITRD; exit -1) diff -puN arch/arm/Makefile~git-kbuild arch/arm/Makefile --- devel/arch/arm/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/arm/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # arch/arm/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. @@ -176,7 +179,7 @@ endif archprepare: maketools -.PHONY: maketools FORCE +PHONY += maketools FORCE maketools: include/linux/version.h include/asm-arm/.arch FORCE $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h diff -puN arch/i386/kernel/vmlinux.lds.S~git-kbuild arch/i386/kernel/vmlinux.lds.S --- devel/arch/i386/kernel/vmlinux.lds.S~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/i386/kernel/vmlinux.lds.S 2006-03-11 17:01:48.000000000 -0800 @@ -7,6 +7,7 @@ #include #include #include +#include OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) @@ -115,7 +116,7 @@ SECTIONS __initramfs_start = .; .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } __initramfs_end = .; - . = ALIGN(32); + . = ALIGN(L1_CACHE_BYTES); __per_cpu_start = .; .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } __per_cpu_end = .; diff -puN arch/i386/Makefile~git-kbuild arch/i386/Makefile --- devel/arch/i386/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/i386/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -99,8 +99,8 @@ AFLAGS += $(mflags-y) boot := arch/i386/boot -.PHONY: zImage bzImage compressed zlilo bzlilo \ - zdisk bzdisk fdimage fdimage144 fdimage288 install +PHONY += zImage bzImage compressed zlilo bzlilo \ + zdisk bzdisk fdimage fdimage144 fdimage288 install all: bzImage diff -puN arch/ia64/Makefile~git-kbuild arch/ia64/Makefile --- devel/arch/ia64/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/ia64/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # ia64/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. @@ -62,7 +65,7 @@ drivers-$(CONFIG_OPROFILE) += arch/ia64/ boot := arch/ia64/hp/sim/boot -.PHONY: boot compressed check +PHONY += boot compressed check all: compressed unwcheck diff -puN arch/m32r/Makefile~git-kbuild arch/m32r/Makefile --- devel/arch/m32r/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/m32r/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # m32r/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# LDFLAGS := OBJCOPYFLAGS := -O binary -R .note -R .comment -S @@ -39,7 +42,7 @@ drivers-$(CONFIG_OPROFILE) += arch/m32r/ boot := arch/m32r/boot -.PHONY: zImage +PHONY += zImage all: zImage diff -puN arch/powerpc/Makefile~git-kbuild arch/powerpc/Makefile --- devel/arch/powerpc/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/powerpc/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -150,7 +150,7 @@ CPPFLAGS_vmlinux.lds := -Upowerpc BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage -.PHONY: $(BOOT_TARGETS) +PHONY += $(BOOT_TARGETS) boot := arch/$(ARCH)/boot diff -puN arch/ppc/boot/Makefile~git-kbuild arch/ppc/boot/Makefile --- devel/arch/ppc/boot/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/ppc/boot/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,6 +1,9 @@ # # arch/ppc/boot/Makefile # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. @@ -25,7 +28,7 @@ subdir- += simple openfirmware hostprogs-y := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree) -.PHONY: $(BOOT_TARGETS) $(bootdir-y) +PHONY += $(BOOT_TARGETS) $(bootdir-y) $(BOOT_TARGETS): $(bootdir-y) diff -puN arch/ppc/boot/openfirmware/Makefile~git-kbuild arch/ppc/boot/openfirmware/Makefile --- devel/arch/ppc/boot/openfirmware/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/ppc/boot/openfirmware/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,5 +1,8 @@ # Makefile for making bootable images on various OpenFirmware machines. # +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # Paul Mackerras January 1997 # XCOFF bootable images for PowerMacs # Geert Uytterhoeven September 1997 @@ -86,7 +89,7 @@ $(images)/zImage.chrp-rs6k $(images)/zIm # The targets used on the make command-line -.PHONY: zImage zImage.initrd +PHONY += zImage zImage.initrd zImage: $(images)/zImage.chrp \ $(images)/zImage.chrp-rs6k @echo ' kernel: $@ is ready ($<)' @@ -96,7 +99,7 @@ zImage.initrd: $(images)/zImage.initrd. TFTPIMAGE := /tftpboot/zImage -.PHONY: znetboot znetboot.initrd +PHONY += znetboot znetboot.initrd znetboot: $(images)/zImage.chrp cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END) @echo ' kernel: $@ is ready ($<)' diff -puN arch/ppc/Makefile~git-kbuild arch/ppc/Makefile --- devel/arch/ppc/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/ppc/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -82,7 +82,7 @@ drivers-$(CONFIG_OPROFILE) += arch/power BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm -.PHONY: $(BOOT_TARGETS) +PHONY += $(BOOT_TARGETS) all: uImage zImage diff -puN arch/sh/Makefile~git-kbuild arch/sh/Makefile --- devel/arch/sh/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/sh/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -172,7 +172,7 @@ include/asm-sh/.mach: $(wildcard include archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach -.PHONY: maketools FORCE +PHONY += maketools FORCE maketools: include/linux/version.h FORCE $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h diff -puN arch/um/Makefile~git-kbuild arch/um/Makefile --- devel/arch/um/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/um/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -1,4 +1,7 @@ -# +# +# This file is included by the global makefile so that you can add your own +# architecture-specific flags and dependencies. +# # Copyright (C) 2002 Jeff Dike (jdike@karaya.com) # Licensed under the GPL # @@ -88,7 +91,7 @@ CONFIG_KERNEL_HALF_GIGS ?= 0 SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) -.PHONY: linux +PHONY += linux all: linux diff -puN arch/x86_64/Makefile~git-kbuild arch/x86_64/Makefile --- devel/arch/x86_64/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/arch/x86_64/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -67,8 +67,8 @@ drivers-$(CONFIG_OPROFILE) += arch/x86_ boot := arch/x86_64/boot -.PHONY: bzImage bzlilo install archmrproper \ - fdimage fdimage144 fdimage288 archclean +PHONY += bzImage bzlilo install archmrproper \ + fdimage fdimage144 fdimage288 archclean #Default target when executing "make" all: bzImage diff -puN Documentation/DocBook/Makefile~git-kbuild Documentation/DocBook/Makefile --- devel/Documentation/DocBook/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/Documentation/DocBook/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -28,7 +28,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 BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) xmldocs: $(BOOKS) @@ -211,3 +211,9 @@ clean-dirs := $(patsubst %.xml,%,$(DOCBO #man put files in man subdir - traverse down subdir- := man/ + + +# 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. + +.PHONY: $(PHONY) diff -puN Documentation/kbuild/makefiles.txt~git-kbuild Documentation/kbuild/makefiles.txt --- devel/Documentation/kbuild/makefiles.txt~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/Documentation/kbuild/makefiles.txt 2006-03-11 17:01:48.000000000 -0800 @@ -17,6 +17,7 @@ This document describes the Linux kernel --- 3.8 Command line dependency --- 3.9 Dependency tracking --- 3.10 Special Rules + --- 3.11 $(CC) support functions === 4 Host Program support --- 4.1 Simple Host Program @@ -38,7 +39,6 @@ This document describes the Linux kernel --- 6.6 Commands useful for building a boot image --- 6.7 Custom kbuild commands --- 6.8 Preprocessing linker scripts - --- 6.9 $(CC) support functions === 7 Kbuild Variables === 8 Makefile language @@ -106,9 +106,9 @@ This document is aimed towards normal de Most Makefiles within the kernel are kbuild Makefiles that use the kbuild infrastructure. This chapter introduce the syntax used in the kbuild makefiles. -The preferred name for the kbuild files is 'Kbuild' but 'Makefile' will -continue to be supported. All new developmen is expected to use the -Kbuild filename. +The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can +be used and if both a 'Makefile' and a 'Kbuild' file exists then the 'Kbuild' +file will be used. Section 3.1 "Goal definitions" is a quick intro, further chapters provide more details, with real examples. @@ -385,6 +385,102 @@ more details, with real examples. to prerequisites are referenced with $(src) (because they are not generated files). +--- 3.11 $(CC) support functions + + The kernel may be build with several different versions of + $(CC), each supporting a unique set of features and options. + kbuild provide basic support to check for valid options for $(CC). + $(CC) is useally the gcc compiler, but other alternatives are + available. + + as-option + as-option is used to check if $(CC) when used to compile + assembler (*.S) files supports the given option. An optional + second option may be specified if first option are not supported. + + Example: + #arch/sh/Makefile + cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) + + In the above example cflags-y will be assinged the the option + -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC). + The second argument is optional, and if supplied will be used + if first argument is not supported. + + cc-option + cc-option is used to check if $(CC) support a given option, and not + supported to use an optional second option. + + Example: + #arch/i386/Makefile + cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) + + In the above example cflags-y will be assigned the option + -march=pentium-mmx if supported by $(CC), otherwise -march-i586. + The second argument to cc-option is optional, and if omitted + cflags-y will be assigned no value if first option is not supported. + + cc-option-yn + cc-option-yn is used to check if gcc supports a given option + and return 'y' if supported, otherwise 'n'. + + Example: + #arch/ppc/Makefile + biarch := $(call cc-option-yn, -m32) + aflags-$(biarch) += -a32 + cflags-$(biarch) += -m32 + + In the above example $(biarch) is set to y if $(CC) supports the -m32 + option. When $(biarch) equals to y the expanded variables $(aflags-y) + and $(cflags-y) will be assigned the values -a32 and -m32. + + cc-option-align + gcc version >= 3.0 shifted type of options used to speify + alignment of functions, loops etc. $(cc-option-align) whrn used + as prefix to the align options will select the right prefix: + gcc < 3.00 + cc-option-align = -malign + gcc >= 3.00 + cc-option-align = -falign + + Example: + CFLAGS += $(cc-option-align)-functions=4 + + In the above example the option -falign-functions=4 is used for + gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used. + + cc-version + cc-version return a numerical version of the $(CC) compiler version. + The format is where both are two digits. So for example + gcc 3.41 would return 0341. + cc-version is useful when a specific $(CC) version is faulty in one + area, for example the -mregparm=3 were broken in some gcc version + even though the option was accepted by gcc. + + Example: + #arch/i386/Makefile + cflags-y += $(shell \ + if [ $(call cc-version) -ge 0300 ] ; then \ + echo "-mregparm=3"; fi ;) + + In the above example -mregparm=3 is only used for gcc version greater + than or equal to gcc 3.0. + + cc-ifversion + cc-ifversion test the version of $(CC) and equals last argument if + version expression is true. + + Example: + #fs/reiserfs/Makefile + EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0402, -O1) + + In this example EXTRA_CFLAGS will be assigned the value -O1 if the + $(CC) version is less than 4.2. + cc-ifversion takes all the shell operators: + -eq, -ne, -lt, -le, -gt, and -ge + The third parameter may be a text as in this example, but it may also + be an expanded variable or a macro. + === 4 Host Program support @@ -973,74 +1069,6 @@ When kbuild executes the following steps architecture specific files. ---- 6.9 $(CC) support functions - - The kernel may be build with several different versions of - $(CC), each supporting a unique set of features and options. - kbuild provide basic support to check for valid options for $(CC). - $(CC) is useally the gcc compiler, but other alternatives are - available. - - cc-option - cc-option is used to check if $(CC) support a given option, and not - supported to use an optional second option. - - Example: - #arch/i386/Makefile - cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) - - In the above example cflags-y will be assigned the option - -march=pentium-mmx if supported by $(CC), otherwise -march-i586. - The second argument to cc-option is optional, and if omitted - cflags-y will be assigned no value if first option is not supported. - - cc-option-yn - cc-option-yn is used to check if gcc supports a given option - and return 'y' if supported, otherwise 'n'. - - Example: - #arch/ppc/Makefile - biarch := $(call cc-option-yn, -m32) - aflags-$(biarch) += -a32 - cflags-$(biarch) += -m32 - - In the above example $(biarch) is set to y if $(CC) supports the -m32 - option. When $(biarch) equals to y the expanded variables $(aflags-y) - and $(cflags-y) will be assigned the values -a32 and -m32. - - cc-option-align - gcc version >= 3.0 shifted type of options used to speify - alignment of functions, loops etc. $(cc-option-align) whrn used - as prefix to the align options will select the right prefix: - gcc < 3.00 - cc-option-align = -malign - gcc >= 3.00 - cc-option-align = -falign - - Example: - CFLAGS += $(cc-option-align)-functions=4 - - In the above example the option -falign-functions=4 is used for - gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used. - - cc-version - cc-version return a numerical version of the $(CC) compiler version. - The format is where both are two digits. So for example - gcc 3.41 would return 0341. - cc-version is useful when a specific $(CC) version is faulty in one - area, for example the -mregparm=3 were broken in some gcc version - even though the option was accepted by gcc. - - Example: - #arch/i386/Makefile - cflags-y += $(shell \ - if [ $(call cc-version) -ge 0300 ] ; then \ - echo "-mregparm=3"; fi ;) - - In the above example -mregparm=3 is only used for gcc version greater - than or equal to gcc 3.0. - - === 7 Kbuild Variables The top Makefile exports the following variables: diff -puN Documentation/kbuild/modules.txt~git-kbuild Documentation/kbuild/modules.txt --- devel/Documentation/kbuild/modules.txt~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/Documentation/kbuild/modules.txt 2006-03-11 17:01:48.000000000 -0800 @@ -13,6 +13,7 @@ In this document you will find informati --- 2.2 Available targets --- 2.3 Available options --- 2.4 Preparing the kernel tree for module build + --- 2.5 Building separate files for a module === 3. Example commands === 4. Creating a kbuild file for an external module === 5. Include files @@ -22,7 +23,10 @@ In this document you will find informati === 6. Module installation --- 6.1 INSTALL_MOD_PATH --- 6.2 INSTALL_MOD_DIR - === 7. Module versioning + === 7. Module versioning & Module.symvers + --- 7.1 Symbols fron the kernel (vmlinux + modules) + --- 7.2 Symbols and external modules + --- 7.3 Symbols from another external module === 8. Tips & Tricks --- 8.1 Testing for CONFIG_FOO_BAR @@ -88,7 +92,8 @@ when building an external module. make -C $KDIR M=$PWD modules_install Install the external module(s). Installation default is in /lib/modules//extra, - but may be prefixed with INSTALL_MOD_PATH - see separate chapter. + but may be prefixed with INSTALL_MOD_PATH - see separate + chapter. make -C $KDIR M=$PWD clean Remove all generated files for the module - the kernel @@ -131,6 +136,16 @@ when building an external module. Therefore a full kernel build needs to be executed to make module versioning work. +--- 2.5 Building separate files for a module + It is possible to build single files which is part of a module. + This works equal for the kernel, a module and even for external + modules. + Examples (module foo.ko, consist of bar.o, baz.o): + make -C $KDIR M=`pwd` bar.lst + make -C $KDIR M=`pwd` bar.o + make -C $KDIR M=`pwd` foo.ko + make -C $KDIR M=`pwd` / + === 3. Example commands @@ -422,7 +437,7 @@ External modules are installed in the di => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf -=== 7. Module versioning +=== 7. Module versioning & Module.symvers Module versioning is enabled by the CONFIG_MODVERSIONS tag. @@ -432,11 +447,80 @@ when a module is loaded/used then the CR compared with similar values in the module. If they are not equal then the kernel refuses to load the module. -During a kernel build a file named Module.symvers will be generated. This -file includes the symbol version of all symbols within the kernel. If the -Module.symvers file is saved from the last full kernel compile one does not -have to do a full kernel compile to build a module version's compatible module. +Module.symvers contains a list of all exported symbols from a kernel build. + +--- 7.1 Symbols fron the kernel (vmlinux + modules) + + During a kernel build a file named Module.symvers will be generated. + Module.symvers contains all exported symbols from the kernel and + compiled modules. For each symbols the corresponding CRC value + is stored too. + + The syntax of the Module.symvers file is: + + Sample: + 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod + + For a kernel build without CONFIG_MODVERSIONING enabled the crc + would read: 0x00000000 + + Module.symvers serve two purposes. + 1) It list all exported symbols both from vmlinux and all modules + 2) It list CRC if CONFIG_MODVERSION is enabled + +--- 7.2 Symbols and external modules + + When building an external module the build system needs access to + the symbols from the kernel to check if all external symbols are + defined. This is done in the MODPOST step and to obtain all + symbols modpost reads Module.symvers from the kernel. + If a Module.symvers file is present in the directory where + the external module is being build this file will be read too. + During the MODPOST step a new Module.symvers file will be written + containing all exported symbols that was not defined in the kernel. + +--- 7.3 Symbols from another external module + Sometimes one external module uses exported symbols from another + external module. Kbuild needs to have full knowledge on all symbols + to avoid spitting out warnings about undefined symbols. + Two solutions exist to let kbuild know all symbols of more than + one external module. + The method with a top-level kbuild file is recommended but may be + impractical in certain situations. + + Use a top-level Kbuild file + If you have two modules: 'foo', 'bar' and 'foo' needs symbols + from 'bar' then one can use a common top-level kbuild file so + both modules are compiled in same build. + + Consider following directory layout: + ./foo/ <= contains the foo module + ./bar/ <= contains the bar module + The top-level Kbuild file would then look like: + + #./Kbuild: (this file may also be named Makefile) + obj-y := foo/ bar/ + + Executing: + make -C $KDIR M=`pwd` + + will then do the expected and compile both modules with full + knowledge on symbols from both modules. + + Use an extra Module.symvers file + When an external module is build a Module.symvers file is + generated containing all exported symbols which are not + defined in the kernel. + To get access to symbols from module 'bar' one can copy the + Module.symvers file from the compilation of the 'bar' module + to the directory where the 'foo' module is build. + During the module build kbuild will read the Module.symvers + file in the directory of the external module and when the + build is finished a new Module.symvers file is created + containing the sum of all symbols defined and not part of the + kernel. + === 8. Tips & Tricks --- 8.1 Testing for CONFIG_FOO_BAR diff -puN Documentation/smart-config.txt~git-kbuild Documentation/smart-config.txt --- devel/Documentation/smart-config.txt~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/Documentation/smart-config.txt 2006-03-11 17:01:48.000000000 -0800 @@ -56,10 +56,6 @@ Here is the solution: writing one file per option. It updates only the files for options that have changed. - mkdep.c no longer generates warning messages for missing or unneeded - lines. The new top-level target 'make checkconfig' - checks for these problems. - Flag Dependencies Martin Von Loewis contributed another feature to this patch: diff -puN /dev/null drivers/atm/.gitignore --- /dev/null 2003-09-15 06:40:47.000000000 -0700 +++ devel-akpm/drivers/atm/.gitignore 2006-03-11 17:01:48.000000000 -0800 @@ -0,0 +1,5 @@ +# Ignore generated files +fore200e_mkfirm +fore200e_pca_fw.c +pca200e.bin + diff -puN drivers/video/matrox/matroxfb_base.c~git-kbuild drivers/video/matrox/matroxfb_base.c --- devel/drivers/video/matrox/matroxfb_base.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/drivers/video/matrox/matroxfb_base.c 2006-03-11 17:01:49.000000000 -0800 @@ -99,7 +99,6 @@ * */ -/* make checkconfig does not check included files... */ #include #include diff -puN drivers/video/matrox/matroxfb_DAC1064.c~git-kbuild drivers/video/matrox/matroxfb_DAC1064.c --- devel/drivers/video/matrox/matroxfb_DAC1064.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/drivers/video/matrox/matroxfb_DAC1064.c 2006-03-11 17:01:48.000000000 -0800 @@ -12,7 +12,6 @@ * */ -/* make checkconfig does not walk through include tree :-( */ #include #include "matroxfb_DAC1064.h" diff -puN drivers/video/matrox/matroxfb_DAC1064.h~git-kbuild drivers/video/matrox/matroxfb_DAC1064.h --- devel/drivers/video/matrox/matroxfb_DAC1064.h~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/drivers/video/matrox/matroxfb_DAC1064.h 2006-03-11 17:01:48.000000000 -0800 @@ -1,7 +1,6 @@ #ifndef __MATROXFB_DAC1064_H__ #define __MATROXFB_DAC1064_H__ -/* make checkconfig does not walk through include tree */ #include #include "matroxfb_base.h" diff -puN drivers/video/matrox/matroxfb_misc.c~git-kbuild drivers/video/matrox/matroxfb_misc.c --- devel/drivers/video/matrox/matroxfb_misc.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/drivers/video/matrox/matroxfb_misc.c 2006-03-11 17:01:49.000000000 -0800 @@ -84,7 +84,6 @@ * */ -/* make checkconfig does not check includes for this... */ #include #include "matroxfb_misc.h" diff -puN drivers/video/matrox/matroxfb_Ti3026.c~git-kbuild drivers/video/matrox/matroxfb_Ti3026.c --- devel/drivers/video/matrox/matroxfb_Ti3026.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/drivers/video/matrox/matroxfb_Ti3026.c 2006-03-11 17:01:48.000000000 -0800 @@ -78,7 +78,6 @@ * */ -/* make checkconfig does not verify included files... */ #include #include "matroxfb_Ti3026.h" diff -puN drivers/video/matrox/matroxfb_Ti3026.h~git-kbuild drivers/video/matrox/matroxfb_Ti3026.h --- devel/drivers/video/matrox/matroxfb_Ti3026.h~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/drivers/video/matrox/matroxfb_Ti3026.h 2006-03-11 17:01:48.000000000 -0800 @@ -1,7 +1,6 @@ #ifndef __MATROXFB_TI3026_H__ #define __MATROXFB_TI3026_H__ -/* make checkconfig does not walk through whole include tree */ #include #include "matroxfb_base.h" diff -puN Makefile~git-kbuild Makefile --- Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/Makefile 2006-03-11 17:01:48.000000000 -0800 @@ -95,7 +95,7 @@ ifdef O endif # That's our default target when none is given on the command line -.PHONY: _all +PHONY := _all _all: ifneq ($(KBUILD_OUTPUT),) @@ -106,7 +106,7 @@ KBUILD_OUTPUT := $(shell cd $(KBUILD_OUT $(if $(KBUILD_OUTPUT),, \ $(error output directory "$(saved-output)" does not exist)) -.PHONY: $(MAKECMDGOALS) +PHONY += $(MAKECMDGOALS) $(filter-out _all,$(MAKECMDGOALS)) _all: $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ @@ -123,7 +123,7 @@ ifeq ($(skip-makefile),) # If building an external module we do not care about the all: rule # but instead _all depend on modules -.PHONY: all +PHONY += all ifeq ($(KBUILD_EXTMOD),) _all: all else @@ -137,7 +137,7 @@ objtree := $(CURDIR) src := $(srctree) obj := $(objtree) -VPATH := $(srctree) +VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) export srctree objtree VPATH TOPDIR @@ -151,7 +151,7 @@ export srctree objtree VPATH TOPDIR SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ ) + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) # Cross compiling and selecting different set of gcc/bin-utils # --------------------------------------------------------------------------- @@ -258,38 +258,6 @@ endif export quiet Q KBUILD_VERBOSE -###### -# cc support functions to be used (only) in arch/$(ARCH)/Makefile -# See documentation in Documentation/kbuild/makefiles.txt - -# as-option -# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) - -as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ - -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ - else echo "$(2)"; fi ;) - -# cc-option -# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) - -cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) - -# cc-option-yn -# Usage: flag := $(call cc-option-yn, -march=winchip-c6) -cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) - -# cc-option-align -# Prefix align with either -falign or -malign -cc-option-align = $(subst -functions=0,,\ - $(call cc-option,-falign-functions=0,-malign-functions=0)) - -# cc-version -# Usage gcc-ver := $(call cc-version $(CC)) -cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ - $(if $(1), $(1), $(CC))) - # Look for make include files relative to root of kernel src MAKEFLAGS += --include-dir=$(srctree) @@ -369,14 +337,14 @@ export RCS_TAR_IGNORE := --exclude SCCS # Rules shared between *config targets and build targets # Basic helpers built in scripts/ -.PHONY: scripts_basic +PHONY += scripts_basic scripts_basic: $(Q)$(MAKE) $(build)=scripts/basic # To avoid any implicit rule to kick in, define an empty command. scripts/basic/%: scripts_basic ; -.PHONY: outputmakefile +PHONY += outputmakefile # outputmakefile generate a Makefile to be placed in output directory, if # using a seperate output directory. This allows convinient use # of make in output directory @@ -452,7 +420,7 @@ ifeq ($(KBUILD_EXTMOD),) # Additional helpers built in scripts/ # Carefully list dependencies so we do not try to build scripts twice # in parrallel -.PHONY: scripts +PHONY += scripts scripts: scripts_basic include/config/MARKER $(Q)$(MAKE) $(build)=$(@) @@ -752,7 +720,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) # make menuconfig etc. # Error messages still appears in the original language -.PHONY: $(vmlinux-dirs) +PHONY += $(vmlinux-dirs) $(vmlinux-dirs): prepare scripts $(Q)$(MAKE) $(build)=$@ @@ -805,10 +773,10 @@ kernelrelease = $(KERNELVERSION)$(localv # version.h and scripts_basic is processed / created. # Listed in dependency order -.PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3 +PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 # prepare-all is deprecated, use prepare as valid replacement -.PHONY: prepare-all +PHONY += prepare-all # prepare3 is used to check if we are building in a separate output directory, # and if so do: @@ -849,27 +817,6 @@ prepare prepare-all: prepare0 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) -# Single targets -# --------------------------------------------------------------------------- - -%.s: %.c scripts FORCE - $(Q)$(MAKE) $(build)=$(@D) $@ -%.i: %.c scripts FORCE - $(Q)$(MAKE) $(build)=$(@D) $@ -%.o: %.c scripts FORCE - $(Q)$(MAKE) $(build)=$(@D) $@ -%.ko: scripts FORCE - $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D) $(@:.ko=.o) - $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost -%/: scripts prepare FORCE - $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(@D) -%.lst: %.c scripts FORCE - $(Q)$(MAKE) $(build)=$(@D) $@ -%.s: %.S scripts FORCE - $(Q)$(MAKE) $(build)=$(@D) $@ -%.o: %.S scripts FORCE - $(Q)$(MAKE) $(build)=$(@D) $@ - # FIXME: The asm symlink changes when $(ARCH) changes. That's # hard to detect, but I suppose "make mrproper" is a good idea # before switching between archs anyway. @@ -925,21 +872,21 @@ all: modules # Build modules -.PHONY: modules +PHONY += modules modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) @echo ' Building modules, stage 2.'; $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost # Target to prepare building external modules -.PHONY: modules_prepare +PHONY += modules_prepare modules_prepare: prepare scripts # Target to install modules -.PHONY: modules_install +PHONY += modules_install modules_install: _modinst_ _modinst_post -.PHONY: _modinst_ +PHONY += _modinst_ _modinst_: @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ echo "Warning: you may need to install module-init-tools"; \ @@ -966,7 +913,7 @@ depmod_opts := else depmod_opts := -b $(INSTALL_MOD_PATH) -r endif -.PHONY: _modinst_post +PHONY += _modinst_post _modinst_post: _modinst_ if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi @@ -1009,7 +956,7 @@ clean: rm-dirs := $(CLEAN_DIRS) clean: rm-files := $(CLEAN_FILES) clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) -.PHONY: $(clean-dirs) clean archclean +PHONY += $(clean-dirs) clean archclean $(clean-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) @@ -1027,7 +974,7 @@ mrproper: rm-dirs := $(wildcard $(MRPRO mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) -.PHONY: $(mrproper-dirs) mrproper archmrproper +PHONY += $(mrproper-dirs) mrproper archmrproper $(mrproper-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) @@ -1037,7 +984,7 @@ mrproper: clean archmrproper $(mrproper- # distclean # -.PHONY: distclean +PHONY += distclean distclean: mrproper @find $(srctree) $(RCS_FIND_IGNORE) \ @@ -1053,8 +1000,6 @@ distclean: mrproper # rpm target kept for backward compatibility package-dir := $(srctree)/scripts/package -.PHONY: %-pkg rpm - %pkg: FORCE $(Q)$(MAKE) -f $(package-dir)/Makefile $@ rpm: FORCE @@ -1145,11 +1090,12 @@ else # KBUILD_EXTMOD # We are always building modules KBUILD_MODULES := 1 -.PHONY: crmodverdir +PHONY += crmodverdir crmodverdir: + $(Q)rm -rf $(MODVERDIR) $(Q)mkdir -p $(MODVERDIR) -.PHONY: $(objtree)/Module.symvers +PHONY += $(objtree)/Module.symvers $(objtree)/Module.symvers: @test -e $(objtree)/Module.symvers || ( \ echo; \ @@ -1158,7 +1104,7 @@ $(objtree)/Module.symvers: echo ) module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) -.PHONY: $(module-dirs) modules +PHONY += $(module-dirs) modules $(module-dirs): crmodverdir $(objtree)/Module.symvers $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) @@ -1166,13 +1112,32 @@ modules: $(module-dirs) @echo ' Building modules, stage 2.'; $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost -.PHONY: modules_install -modules_install: +PHONY += modules_install +modules_install: _emodinst_ _emodinst_post + +install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) +PHONY += _emodinst_ +_emodinst_: + $(Q)rm -rf $(MODLIB)/$(install-dir) + $(Q)mkdir -p $(MODLIB)/$(install-dir) $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst +# Run depmod only is we have System.map and depmod is executable +quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) + cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ + $(DEPMOD) -ae -F System.map \ + $(if $(strip $(INSTALL_MOD_PATH)), \ + -b $(INSTALL_MOD_PATH) -r) \ + $(KERNELRELEASE); \ + fi + +PHONY += _emodinst_post +_emodinst_post: _emodinst_ + $(call cmd,depmod) + clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) -.PHONY: $(clean-dirs) clean +PHONY += $(clean-dirs) clean $(clean-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) @@ -1192,6 +1157,11 @@ help: @echo ' modules_install - install the module' @echo ' clean - remove generated files in module directory only' @echo '' + +# Dummies... +PHONY += prepare scripts +prepare: ; +scripts: ; endif # KBUILD_EXTMOD # Generate tags for editors @@ -1302,7 +1272,7 @@ namespacecheck: endif #ifeq ($(config-targets),1) endif #ifeq ($(mixed-targets),1) -.PHONY: checkstack +PHONY += checkstack checkstack: $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ $(PERL) $(src)/scripts/checkstack.pl $(ARCH) @@ -1313,6 +1283,44 @@ kernelrelease: kernelversion: @echo $(KERNELVERSION) +# Single targets +# --------------------------------------------------------------------------- +# The directory part is taken from first prerequisite, so this +# works even with external modules +%.s: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) +%.i: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) +%.o: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) +%.lst: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) +%.s: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) +%.o: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(dir $<) $(dir $<)$(notdir $@) + +# For external modules we shall include any directory of the target, +# but usual case there is no directory part. +# make M=`pwd` module.o => $(dir $@)=./ +# make M=`pwd` foo/module.o => $(dir $@)=foo/ +# make M=`pwd` / => $(dir $@)=/ + +ifeq ($(KBUILD_EXTMOD),) + target-dir = $(@D) +else + zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) + target-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) +endif + +/ %/: scripts prepare FORCE + $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(build)=$(target-dir) +%.ko: scripts FORCE + $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(build)=$(target-dir) $(@:.ko=.o) + $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost + # FIXME Should go into a make.lib or something # =========================================================================== @@ -1347,4 +1355,10 @@ clean := -f $(if $(KBUILD_SRC),$(srctree endif # skip-makefile +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. +.PHONY: $(PHONY) diff -puN scripts/basic/fixdep.c~git-kbuild scripts/basic/fixdep.c --- devel/scripts/basic/fixdep.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/basic/fixdep.c 2006-03-11 17:01:49.000000000 -0800 @@ -132,20 +132,10 @@ void usage(void) /* * Print out the commandline prefixed with cmd_ := - * If commandline contains '#' escape with '\' so make to not see - * the '#' as a start-of-comment symbol - **/ + */ void print_cmdline(void) { - char *p = cmdline; - - printf("cmd_%s := ", target); - for (; *p; p++) { - if (*p == '#') - printf("\\"); - printf("%c", *p); - } - printf("\n\n"); + printf("cmd_%s := %s\n\n", target, cmdline); } char * str_config = NULL; diff -L scripts/checkconfig.pl -puN scripts/checkconfig.pl~git-kbuild /dev/null --- devel/scripts/checkconfig.pl +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,65 +0,0 @@ -#! /usr/bin/perl -# -# checkconfig: find uses of CONFIG_* names without matching definitions. -# Copyright abandoned, 1998, Michael Elizabeth Chastain . - -use integer; - -$| = 1; - -foreach $file (@ARGV) -{ - # Open this file. - open(FILE, $file) || die "Can't open $file: $!\n"; - - # Initialize variables. - my $fInComment = 0; - my $fInString = 0; - my $fUseConfig = 0; - my $iLinuxConfig = 0; - my %configList = (); - - LINE: while ( ) - { - # Strip comments. - $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next); - m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1))); - - # Pick up definitions. - if ( m/^\s*#/o ) - { - $iLinuxConfig = $. if m/^\s*#\s*include\s*"linux\/config\.h"/o; - $configList{uc $1} = 1 if m/^\s*#\s*include\s*"config\/(\S*)\.h"/o; - } - - # Strip strings. - $fInString && (s+^.*?"+ +o ? ($fInString = 0) : next); - m+"+o && (s+".*?"+ +go, (s+".*$+ +o && ($fInString = 1))); - - # Pick up definitions. - if ( m/^\s*#/o ) - { - $iLinuxConfig = $. if m/^\s*#\s*include\s*/o; - $configList{uc $1} = 1 if m/^\s*#\s*include\s*/o; - $configList{$1} = 1 if m/^\s*#\s*define\s+CONFIG_(\w*)/o; - $configList{$1} = 1 if m/^\s*#\s*undef\s+CONFIG_(\w*)/o; - } - - # Look for usages. - next unless m/CONFIG_/o; - WORD: while ( m/\bCONFIG_(\w+)/og ) - { - $fUseConfig = 1; - last LINE if $iLinuxConfig; - next WORD if exists $configList{$1}; - print "$file: $.: need CONFIG_$1.\n"; - $configList{$1} = 0; - } - } - - # Report superfluous includes. - if ( $iLinuxConfig && ! $fUseConfig ) - { print "$file: $iLinuxConfig: linux/config.h not needed.\n"; } - - close(FILE); -} diff -puN scripts/genksyms/genksyms.c~git-kbuild scripts/genksyms/genksyms.c --- devel/scripts/genksyms/genksyms.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/genksyms/genksyms.c 2006-03-11 17:01:49.000000000 -0800 @@ -32,7 +32,7 @@ #endif /* __GNU_LIBRARY__ */ #include "genksyms.h" - +#include "../mod/elfconfig.h" /*----------------------------------------------------------------------*/ #define HASH_BUCKETS 4096 @@ -458,7 +458,7 @@ export_symbol(const char *name) fputs(">\n", debugfile); /* Used as a linker script. */ - printf("__crc_%s = 0x%08lx ;\n", name, crc); + printf("%s__crc_%s = 0x%08lx ;\n", MODULE_SYMBOL_PREFIX, name, crc); } } diff -puN scripts/Kbuild.include~git-kbuild scripts/Kbuild.include --- devel/scripts/Kbuild.include~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/Kbuild.include 2006-03-11 17:01:49.000000000 -0800 @@ -44,6 +44,43 @@ define filechk fi endef +###### +# gcc support functions +# See documentation in Documentation/kbuild/makefiles.txt + +# as-option +# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) + +as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ + -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ + else echo "$(2)"; fi ;) + +# cc-option +# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) + +cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ + > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) + +# cc-option-yn +# Usage: flag := $(call cc-option-yn, -march=winchip-c6) +cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ + > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) + +# cc-option-align +# Prefix align with either -falign or -malign +cc-option-align = $(subst -functions=0,,\ + $(call cc-option,-falign-functions=0,-malign-functions=0)) + +# cc-version +# Usage gcc-ver := $(call cc-version, $(CC)) +cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ + $(if $(1), $(1), $(CC))) + +# cc-ifversion +# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) +cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ + echo $(3); fi;) + ### # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Usage: @@ -51,8 +88,7 @@ endef build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj # If quiet is set, only print short version of command -cmd = @$(if $($(quiet)cmd_$(1)),\ - echo ' $(call escsq,$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) +cmd = @$(echo-cmd) $(cmd_$(1)) # Add $(obj)/ for paths that is not absolute objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) @@ -75,30 +111,33 @@ endif echo-cmd = $(if $($(quiet)cmd_$(1)), \ echo ' $(call escsq,$($(quiet)cmd_$(1)))';) +make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) + # function to only execute the passed command if necessary # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file # note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars -# -if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ +# +if_changed = $(if $(strip $(filter-out $(PHONY),$?) \ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ @set -e; \ - $(echo-cmd) \ - $(cmd_$(1)); \ - echo 'cmd_$@ := $(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).cmd) + $(echo-cmd) $(cmd_$(1)); \ + echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd) # execute the command and also postprocess generated .d dependencies # file -if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ - $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ +if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \ + $(filter-out FORCE $(wildcard $^),$^) \ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ @set -e; \ - $(echo-cmd) \ - $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ + $(echo-cmd) $(cmd_$(1)); \ + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) # Usage: $(call if_changed_rule,foo) # will check if $(cmd_foo) changed, or any of the prequisites changed, # and if so will execute $(rule_foo) -if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ +if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ @set -e; \ $(rule_$(1))) diff -puN scripts/kconfig/lxdialog/Makefile~git-kbuild scripts/kconfig/lxdialog/Makefile --- devel/scripts/kconfig/lxdialog/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/kconfig/lxdialog/Makefile 2006-03-11 17:01:49.000000000 -0800 @@ -7,10 +7,10 @@ check-lxdialog := $(srctree)/$(src)/che # we really need to do so. (Do not call gcc as part of make mrproper) HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) - -HOST_EXTRACFLAGS += -DLOCALE -.PHONY: dochecklxdialog +HOST_EXTRACFLAGS += -DLOCALE + +PHONY += dochecklxdialog $(obj)/dochecklxdialog: $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) diff -puN scripts/kconfig/Makefile~git-kbuild scripts/kconfig/Makefile --- devel/scripts/kconfig/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/kconfig/Makefile 2006-03-11 17:01:49.000000000 -0800 @@ -2,7 +2,7 @@ # Kernel configuration targets # These targets are used from top-level makefile -.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config +PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config xconfig: $(obj)/qconf $< arch/$(ARCH)/Kconfig @@ -42,7 +42,7 @@ update-po-config: $(obj)/kxgettext $(Q)rm -f arch/um/Kconfig_arch $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot -.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig +PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig randconfig: $(obj)/conf $< -r arch/$(ARCH)/Kconfig @@ -78,7 +78,7 @@ help: @echo ' defconfig - New config with default answer to all options' @echo ' allmodconfig - New config selecting modules when possible' @echo ' allyesconfig - New config where all options are accepted with yes' - @echo ' allnoconfig - New minimal config' + @echo ' allnoconfig - New config where all options are answered with no' # =========================================================================== # Shared Makefile for the various kconfig executables: diff -puN scripts/Makefile.build~git-kbuild scripts/Makefile.build --- devel/scripts/Makefile.build~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/Makefile.build 2006-03-11 17:01:49.000000000 -0800 @@ -4,17 +4,18 @@ src := $(obj) -.PHONY: __build +PHONY := __build __build: # Read .config if it exist, otherwise ignore -include .config +include scripts/Kbuild.include + # The filename Kbuild has precedence over Makefile kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) -include scripts/Kbuild.include include scripts/Makefile.lib ifdef host-progs @@ -177,12 +178,10 @@ cmd_modversions = \ endif define rule_cc_o_c - $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ - $(cmd_checksrc) \ - $(if $($(quiet)cmd_cc_o_c),echo ' $(call escsq,$($(quiet)cmd_cc_o_c))';) \ - $(cmd_cc_o_c); \ + $(call echo-cmd,checksrc) $(cmd_checksrc) \ + $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ $(cmd_modversions) \ - scripts/basic/fixdep $(depfile) $@ '$(call escsq,$(cmd_cc_o_c))' > $(@D)/.$(@F).tmp; \ + scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd endef @@ -309,14 +308,14 @@ targets += $(multi-used-y) $(multi-used- # Descending # --------------------------------------------------------------------------- -.PHONY: $(subdir-ym) +PHONY += $(subdir-ym) $(subdir-ym): $(Q)$(MAKE) $(build)=$@ # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- -.PHONY: FORCE +PHONY += FORCE FORCE: @@ -331,3 +330,9 @@ cmd_files := $(wildcard $(foreach f,$(ta ifneq ($(cmd_files),) include $(cmd_files) endif + + +# 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. + +.PHONY: $(PHONY) diff -puN scripts/Makefile.clean~git-kbuild scripts/Makefile.clean --- devel/scripts/Makefile.clean~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/Makefile.clean 2006-03-11 17:01:49.000000000 -0800 @@ -4,7 +4,7 @@ src := $(obj) -.PHONY: __clean +PHONY := __clean __clean: # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir @@ -87,10 +87,16 @@ endif # Descending # --------------------------------------------------------------------------- -.PHONY: $(subdir-ymn) +PHONY += $(subdir-ymn) $(subdir-ymn): $(Q)$(MAKE) $(clean)=$@ # If quiet is set, only print short version of command cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) + + +# 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. + +.PHONY: $(PHONY) diff -puN scripts/Makefile.modinst~git-kbuild scripts/Makefile.modinst --- devel/scripts/Makefile.modinst~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/Makefile.modinst 2006-03-11 17:01:49.000000000 -0800 @@ -2,7 +2,7 @@ # Installing modules # ========================================================================== -.PHONY: __modinst +PHONY := __modinst __modinst: include scripts/Kbuild.include @@ -12,7 +12,7 @@ include scripts/Kbuild.include __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) -.PHONY: $(modules) +PHONY += $(modules) __modinst: $(modules) @: @@ -27,3 +27,9 @@ modinst_dir = $(if $(KBUILD_EXTMOD),$(ex $(modules): $(call cmd,modules_install,$(MODLIB)/$(modinst_dir)) + + +# 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. + +.PHONY: $(PHONY) diff -puN scripts/Makefile.modpost~git-kbuild scripts/Makefile.modpost --- devel/scripts/Makefile.modpost~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/Makefile.modpost 2006-03-11 17:01:49.000000000 -0800 @@ -32,14 +32,15 @@ # Step 4 is solely used to allow module versioning in external modules, # where the CRC of each module is retrieved from the Module.symers file. -.PHONY: _modpost +PHONY := _modpost _modpost: __modpost include .config include scripts/Kbuild.include include scripts/Makefile.lib -symverfile := $(objtree)/Module.symvers +kernelsymfile := $(objtree)/Module.symvers +modulesymfile := $(KBUILD_EXTMOD)/Modules.symvers # Step 1), find all modules listed in $(MODVERDIR)/ __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) @@ -54,10 +55,12 @@ quiet_cmd_modpost = MODPOST cmd_modpost = scripts/mod/modpost \ $(if $(CONFIG_MODVERSIONS),-m) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ - $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \ + $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ + $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ + $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(filter-out FORCE,$^) -.PHONY: __modpost +PHONY += __modpost __modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE $(call cmd,modpost) @@ -94,7 +97,7 @@ targets += $(modules) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- -.PHONY: FORCE +PHONY += FORCE FORCE: @@ -109,3 +112,9 @@ cmd_files := $(wildcard $(foreach f,$(ta ifneq ($(cmd_files),) include $(cmd_files) endif + + +# 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. + +.PHONY: $(PHONY) diff -puN scripts/mkmakefile~git-kbuild scripts/mkmakefile --- devel/scripts/mkmakefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/mkmakefile 2006-03-11 17:01:49.000000000 -0800 @@ -21,11 +21,13 @@ KERNELOUTPUT := $2 MAKEFLAGS += --no-print-directory +.PHONY: all \$(MAKECMDGOALS) + all: \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) -%:: - \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@ +Makefile:; +\$(filter-out all Makefile,\$(MAKECMDGOALS)) %/: + \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@ EOF - diff -puN scripts/mod/file2alias.c~git-kbuild scripts/mod/file2alias.c --- devel/scripts/mod/file2alias.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/mod/file2alias.c 2006-03-11 17:01:49.000000000 -0800 @@ -34,7 +34,7 @@ typedef uint16_t __u16; typedef unsigned char __u8; /* Big exception to the "don't include kernel headers into userspace, which - * even potentially has different endianness and word sizes, since + * even potentially has different endianness and word sizes, since * we handle those differences explicitly below */ #include "../../include/linux/mod_devicetable.h" #include "../../include/linux/input.h" @@ -153,8 +153,8 @@ static void do_usb_table(void *symval, u const unsigned long id_size = sizeof(struct usb_device_id); if (size % id_size || size < id_size) { - fprintf(stderr, "*** Warning: %s ids %lu bad size " - "(each on %lu)\n", mod->name, size, id_size); + warn("%s ids %lu bad size " + "(each on %lu)\n", mod->name, size, id_size); } /* Leave last one: it's the terminator. */ size -= id_size; @@ -217,9 +217,8 @@ static int do_pci_entry(const char *file if ((baseclass_mask != 0 && baseclass_mask != 0xFF) || (subclass_mask != 0 && subclass_mask != 0xFF) || (interface_mask != 0 && interface_mask != 0xFF)) { - fprintf(stderr, - "*** Warning: Can't handle masks in %s:%04X\n", - filename, id->class_mask); + warn("Can't handle masks in %s:%04X\n", + filename, id->class_mask); return 0; } @@ -229,7 +228,7 @@ static int do_pci_entry(const char *file return 1; } -/* looks like: "ccw:tNmNdtNdmN" */ +/* looks like: "ccw:tNmNdtNdmN" */ static int do_ccw_entry(const char *filename, struct ccw_device_id *id, char *alias) { @@ -445,8 +444,8 @@ static void do_table(void *symval, unsig int (*do_entry)(const char *, void *entry, char *alias) = function; if (size % id_size || size < id_size) { - fprintf(stderr, "*** Warning: %s ids %lu bad size " - "(each on %lu)\n", mod->name, size, id_size); + warn("%s ids %lu bad size " + "(each on %lu)\n", mod->name, size, id_size); } /* Leave last one: it's the terminator. */ size -= id_size; diff -puN scripts/mod/mk_elfconfig.c~git-kbuild scripts/mod/mk_elfconfig.c --- devel/scripts/mod/mk_elfconfig.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/mod/mk_elfconfig.c 2006-03-11 17:01:49.000000000 -0800 @@ -6,7 +6,7 @@ int main(int argc, char **argv) { - unsigned char ei[EI_NIDENT]; + unsigned char ei[EI_NIDENT]; union { short s; char c[2]; } endian_test; if (argc != 2) { @@ -57,7 +57,7 @@ main(int argc, char **argv) if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0)) printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); - else + else printf("#define MODULE_SYMBOL_PREFIX \"\"\n"); return 0; diff -puN scripts/mod/modpost.c~git-kbuild scripts/mod/modpost.c --- devel/scripts/mod/modpost.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/mod/modpost.c 2006-03-11 17:01:49.000000000 -0800 @@ -2,7 +2,7 @@ * * Copyright 2003 Kai Germaschewski * Copyright 2002-2004 Rusty Russell, IBM Corporation - * + * Copyright 2006 Sam Ravnborg * Based in part on module-init-tools/depmod.c,file2alias * * This software may be used and distributed according to the terms @@ -20,9 +20,10 @@ int modversions = 0; int have_vmlinux = 0; /* Is CONFIG_MODULE_SRCVERSION_ALL set? */ static int all_versions = 0; +/* If we are modposting external module set to 1 */ +static int external_module = 0; -void -fatal(const char *fmt, ...) +void fatal(const char *fmt, ...) { va_list arglist; @@ -35,8 +36,7 @@ fatal(const char *fmt, ...) exit(1); } -void -warn(const char *fmt, ...) +void warn(const char *fmt, ...) { va_list arglist; @@ -47,6 +47,18 @@ warn(const char *fmt, ...) va_end(arglist); } +static int is_vmlinux(const char *modname) +{ + const char *myname; + + if ((myname = strrchr(modname, '/'))) + myname++; + else + myname = modname; + + return strcmp(myname, "vmlinux") == 0; +} + void *do_nofail(void *ptr, const char *expr) { if (!ptr) { @@ -59,8 +71,7 @@ void *do_nofail(void *ptr, const char *e static struct module *modules; -struct module * -find_module(char *modname) +static struct module *find_module(char *modname) { struct module *mod; @@ -70,12 +81,11 @@ find_module(char *modname) return mod; } -struct module * -new_module(char *modname) +static struct module *new_module(char *modname) { struct module *mod; char *p, *s; - + mod = NOFAIL(malloc(sizeof(*mod))); memset(mod, 0, sizeof(*mod)); p = NOFAIL(strdup(modname)); @@ -104,6 +114,10 @@ struct symbol { unsigned int crc; int crc_valid; unsigned int weak:1; + unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */ + unsigned int kernel:1; /* 1 if symbol is from kernel + * (only for external modules) **/ + unsigned int preloaded:1; /* 1 if symbol from Module.symvers */ char name[0]; }; @@ -122,11 +136,12 @@ static inline unsigned int tdb_hash(cons return (1103515243 * value + 12345); } -/* Allocate a new symbols for use in the hash of exported symbols or - * the list of unresolved symbols per module */ - -struct symbol * -alloc_symbol(const char *name, unsigned int weak, struct symbol *next) +/** + * Allocate a new symbols for use in the hash of exported symbols or + * the list of unresolved symbols per module + **/ +static struct symbol *alloc_symbol(const char *name, unsigned int weak, + struct symbol *next) { struct symbol *s = NOFAIL(malloc(sizeof(*s) + strlen(name) + 1)); @@ -138,9 +153,7 @@ alloc_symbol(const char *name, unsigned } /* For the hash of exported symbols */ - -void -new_symbol(const char *name, struct module *module, unsigned int *crc) +static struct symbol *new_symbol(const char *name, struct module *module) { unsigned int hash; struct symbol *new; @@ -148,14 +161,10 @@ new_symbol(const char *name, struct modu hash = tdb_hash(name) % SYMBOL_HASH_SIZE; new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); new->module = module; - if (crc) { - new->crc = *crc; - new->crc_valid = 1; - } + return new; } -struct symbol * -find_symbol(const char *name) +static struct symbol *find_symbol(const char *name) { struct symbol *s; @@ -170,25 +179,42 @@ find_symbol(const char *name) return NULL; } -/* Add an exported symbol - it may have already been added without a - * CRC, in this case just update the CRC */ -void -add_exported_symbol(const char *name, struct module *module, unsigned int *crc) +/** + * Add an exported symbol - it may have already been added without a + * CRC, in this case just update the CRC + **/ +static struct symbol *sym_add_exported(const char *name, struct module *mod) { struct symbol *s = find_symbol(name); if (!s) { - new_symbol(name, module, crc); - return; - } - if (crc) { - s->crc = *crc; - s->crc_valid = 1; + s = new_symbol(name, mod); + } else { + if (!s->preloaded) { + warn("%s: '%s' exported twice. Previous export " + "was in %s%s\n", mod->name, name, + s->module->name, + is_vmlinux(s->module->name) ?"":".ko"); + } } + s->preloaded = 0; + s->vmlinux = is_vmlinux(mod->name); + s->kernel = 0; + return s; +} + +static void sym_update_crc(const char *name, struct module *mod, + unsigned int crc) +{ + struct symbol *s = find_symbol(name); + + if (!s) + s = new_symbol(name, mod); + s->crc = crc; + s->crc_valid = 1; } -void * -grab_file(const char *filename, unsigned long *size) +void *grab_file(const char *filename, unsigned long *size) { struct stat st; void *map; @@ -207,13 +233,12 @@ grab_file(const char *filename, unsigned return map; } -/* - Return a copy of the next line in a mmap'ed file. - spaces in the beginning of the line is trimmed away. - Return a pointer to a static buffer. -*/ -char* -get_next_line(unsigned long *pos, void *file, unsigned long size) +/** + * Return a copy of the next line in a mmap'ed file. + * spaces in the beginning of the line is trimmed away. + * Return a pointer to a static buffer. + **/ +char* get_next_line(unsigned long *pos, void *file, unsigned long size) { static char line[4096]; int skip = 1; @@ -243,14 +268,12 @@ get_next_line(unsigned long *pos, void * return NULL; } -void -release_file(void *file, unsigned long size) +void release_file(void *file, unsigned long size) { munmap(file, size); } -void -parse_elf(struct elf_info *info, const char *filename) +static void parse_elf(struct elf_info *info, const char *filename) { unsigned int i; Elf_Ehdr *hdr = info->hdr; @@ -297,14 +320,13 @@ parse_elf(struct elf_info *info, const c continue; info->symtab_start = (void *)hdr + sechdrs[i].sh_offset; - info->symtab_stop = (void *)hdr + sechdrs[i].sh_offset + info->symtab_stop = (void *)hdr + sechdrs[i].sh_offset + sechdrs[i].sh_size; - info->strtab = (void *)hdr + + info->strtab = (void *)hdr + sechdrs[sechdrs[i].sh_link].sh_offset; } if (!info->symtab_start) { - fprintf(stderr, "modpost: %s no symtab?\n", filename); - abort(); + fatal("%s has no symtab?\n", filename); } /* Fix endianness in symbols */ for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { @@ -316,36 +338,31 @@ parse_elf(struct elf_info *info, const c return; truncated: - fprintf(stderr, "modpost: %s is truncated.\n", filename); - abort(); + fatal("%s is truncated.\n", filename); } -void -parse_elf_finish(struct elf_info *info) +static void parse_elf_finish(struct elf_info *info) { release_file(info->hdr, info->size); } -#define CRC_PFX "__crc_" -#define KSYMTAB_PFX "__ksymtab_" +#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" +#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" -void -handle_modversions(struct module *mod, struct elf_info *info, - Elf_Sym *sym, const char *symname) +static void handle_modversions(struct module *mod, struct elf_info *info, + Elf_Sym *sym, const char *symname) { unsigned int crc; switch (sym->st_shndx) { case SHN_COMMON: - fprintf(stderr, "*** Warning: \"%s\" [%s] is COMMON symbol\n", - symname, mod->name); + warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); break; case SHN_ABS: /* CRC'd symbol */ if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { crc = (unsigned int) sym->st_value; - add_exported_symbol(symname + strlen(CRC_PFX), - mod, &crc); + sym_update_crc(symname + strlen(CRC_PFX), mod, crc); } break; case SHN_UNDEF: @@ -370,15 +387,15 @@ handle_modversions(struct module *mod, s /* Ignore register directives. */ if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) break; - if (symname[0] == '.') { - char *munged = strdup(symname); - munged[0] = '_'; - munged[1] = toupper(munged[1]); - symname = munged; - } + if (symname[0] == '.') { + char *munged = strdup(symname); + munged[0] = '_'; + munged[1] = toupper(munged[1]); + symname = munged; + } } #endif - + if (memcmp(symname, MODULE_SYMBOL_PREFIX, strlen(MODULE_SYMBOL_PREFIX)) == 0) mod->unres = alloc_symbol(symname + @@ -389,8 +406,7 @@ handle_modversions(struct module *mod, s default: /* All exported symbols */ if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { - add_exported_symbol(symname + strlen(KSYMTAB_PFX), - mod, NULL); + sym_add_exported(symname + strlen(KSYMTAB_PFX), mod); } if (strcmp(symname, MODULE_SYMBOL_PREFIX "init_module") == 0) mod->has_init = 1; @@ -400,20 +416,9 @@ handle_modversions(struct module *mod, s } } -int -is_vmlinux(const char *modname) -{ - const char *myname; - - if ((myname = strrchr(modname, '/'))) - myname++; - else - myname = modname; - - return strcmp(myname, "vmlinux") == 0; -} - -/* Parse tag=value strings from .modinfo section */ +/** + * Parse tag=value strings from .modinfo section + **/ static char *next_string(char *string, unsigned long *secsize) { /* Skip non-zero chars */ @@ -446,8 +451,418 @@ static char *get_modinfo(void *modinfo, return NULL; } -void -read_symbols(char *modname) +/** + * Test if string s ends in string sub + * return 0 if match + **/ +static int strrcmp(const char *s, const char *sub) +{ + int slen, sublen; + + if (!s || !sub) + return 1; + + slen = strlen(s); + sublen = strlen(sub); + + if ((slen == 0) || (sublen == 0)) + return 1; + + if (sublen > slen) + return 1; + + return memcmp(s + slen - sublen, sub, sublen); +} + +/** + * Whitelist to allow certain references to pass with no warning. + * Pattern 1: + * If a module parameter is declared __initdata and permissions=0 + * then this is legal despite the warning generated. + * We cannot see value of permissions here, so just ignore + * this pattern. + * The pattern is identified by: + * tosec = .init.data + * fromsec = .data* + * atsym =__param* + * + * Pattern 2: + * Many drivers utilise a *_driver container with references to + * add, remove, probe functions etc. + * These functions may often be marked __init and we do not want to + * warn here. + * the pattern is identified by: + * tosec = .init.text | .exit.text + * fromsec = .data + * atsym = *_driver, *_ops, *_probe, *probe_one + **/ +static int secref_whitelist(const char *tosec, const char *fromsec, + const char *atsym) +{ + int f1 = 1, f2 = 1; + const char **s; + const char *pat2sym[] = { + "_driver", + "_ops", + "_probe", + "_probe_one", + NULL + }; + + /* Check for pattern 1 */ + if (strcmp(tosec, ".init.data") != 0) + f1 = 0; + if (strncmp(fromsec, ".data", strlen(".data")) != 0) + f1 = 0; + if (strncmp(atsym, "__param", strlen("__param")) != 0) + f1 = 0; + + if (f1) + return f1; + + /* Check for pattern 2 */ + if ((strcmp(tosec, ".init.text") != 0) && + (strcmp(tosec, ".exit.text") != 0)) + f2 = 0; + if (strcmp(fromsec, ".data") != 0) + f2 = 0; + + for (s = pat2sym; *s; s++) + if (strrcmp(atsym, *s) == 0) + f1 = 1; + + return f1 && f2; +} + +/** + * Find symbol based on relocation record info. + * In some cases the symbol supplied is a valid symbol so + * return refsym. If st_name != 0 we assume this is a valid symbol. + * In other cases the symbol needs to be looked up in the symbol table + * based on section and address. + * **/ +static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr, + Elf_Sym *relsym) +{ + Elf_Sym *sym; + + if (relsym->st_name != 0) + return relsym; + for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { + if (sym->st_shndx != relsym->st_shndx) + continue; + if (sym->st_value == addr) + return sym; + } + return NULL; +} + +/* + * Find symbols before or equal addr and after addr - in the section sec. + * If we find two symbols with equal offset prefer one with a valid name. + * The ELF format may have a better way to detect what type of symbol + * it is, but this works for now. + **/ +static void find_symbols_between(struct elf_info *elf, Elf_Addr addr, + const char *sec, + Elf_Sym **before, Elf_Sym **after) +{ + Elf_Sym *sym; + Elf_Ehdr *hdr = elf->hdr; + Elf_Addr beforediff = ~0; + Elf_Addr afterdiff = ~0; + const char *secstrings = (void *)hdr + + elf->sechdrs[hdr->e_shstrndx].sh_offset; + + *before = NULL; + *after = NULL; + + for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { + const char *symsec; + + if (sym->st_shndx >= SHN_LORESERVE) + continue; + symsec = secstrings + elf->sechdrs[sym->st_shndx].sh_name; + if (strcmp(symsec, sec) != 0) + continue; + if (sym->st_value <= addr) { + if ((addr - sym->st_value) < beforediff) { + beforediff = addr - sym->st_value; + *before = sym; + } + else if ((addr - sym->st_value) == beforediff) { + /* equal offset, valid name? */ + const char *name = elf->strtab + sym->st_name; + if (name && strlen(name)) + *before = sym; + } + } + else + { + if ((sym->st_value - addr) < afterdiff) { + afterdiff = sym->st_value - addr; + *after = sym; + } + else if ((sym->st_value - addr) == afterdiff) { + /* equal offset, valid name? */ + const char *name = elf->strtab + sym->st_name; + if (name && strlen(name)) + *after = sym; + } + } + } +} + +/** + * Print a warning about a section mismatch. + * Try to find symbols near it so user can find it. + * Check whitelist before warning - it may be a false positive. + **/ +static void warn_sec_mismatch(const char *modname, const char *fromsec, + struct elf_info *elf, Elf_Sym *sym, Elf_Rela r) +{ + const char *refsymname = ""; + Elf_Sym *before, *after; + Elf_Sym *refsym; + Elf_Ehdr *hdr = elf->hdr; + Elf_Shdr *sechdrs = elf->sechdrs; + const char *secstrings = (void *)hdr + + sechdrs[hdr->e_shstrndx].sh_offset; + const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name; + + find_symbols_between(elf, r.r_offset, fromsec, &before, &after); + + refsym = find_elf_symbol(elf, r.r_addend, sym); + if (refsym && strlen(elf->strtab + refsym->st_name)) + refsymname = elf->strtab + refsym->st_name; + + /* check whitelist - we may ignore it */ + if (before && + secref_whitelist(secname, fromsec, elf->strtab + before->st_name)) + return; + + if (before && after) { + warn("%s - Section mismatch: reference to %s:%s from %s " + "between '%s' (at offset 0x%llx) and '%s'\n", + modname, secname, refsymname, fromsec, + elf->strtab + before->st_name, + (long long)r.r_offset, + elf->strtab + after->st_name); + } else if (before) { + warn("%s - Section mismatch: reference to %s:%s from %s " + "after '%s' (at offset 0x%llx)\n", + modname, secname, refsymname, fromsec, + elf->strtab + before->st_name, + (long long)r.r_offset); + } else if (after) { + warn("%s - Section mismatch: reference to %s:%s from %s " + "before '%s' (at offset -0x%llx)\n", + modname, secname, refsymname, fromsec, + elf->strtab + before->st_name, + (long long)r.r_offset); + } else { + warn("%s - Section mismatch: reference to %s:%s from %s " + "(offset 0x%llx)\n", + modname, secname, fromsec, refsymname, + (long long)r.r_offset); + } +} + +/** + * A module includes a number of sections that are discarded + * either when loaded or when used as built-in. + * For loaded modules all functions marked __init and all data + * marked __initdata will be discarded when the module has been intialized. + * Likewise for modules used built-in the sections marked __exit + * are discarded because __exit marked function are supposed to be called + * only when a moduel is unloaded which never happes for built-in modules. + * The check_sec_ref() function traverses all relocation records + * to find all references to a section that reference a section that will + * be discarded and warns about it. + **/ +static void check_sec_ref(struct module *mod, const char *modname, + struct elf_info *elf, + int section(const char*), + int section_ref_ok(const char *)) +{ + int i; + Elf_Sym *sym; + Elf_Ehdr *hdr = elf->hdr; + Elf_Shdr *sechdrs = elf->sechdrs; + const char *secstrings = (void *)hdr + + sechdrs[hdr->e_shstrndx].sh_offset; + + /* Walk through all sections */ + for (i = 0; i < hdr->e_shnum; i++) { + Elf_Rela *rela; + Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset; + Elf_Rela *stop = (void*)start + sechdrs[i].sh_size; + const char *name = secstrings + sechdrs[i].sh_name + + strlen(".rela"); + /* We want to process only relocation sections and not .init */ + if (section_ref_ok(name) || (sechdrs[i].sh_type != SHT_RELA)) + continue; + + for (rela = start; rela < stop; rela++) { + Elf_Rela r; + const char *secname; + r.r_offset = TO_NATIVE(rela->r_offset); + r.r_info = TO_NATIVE(rela->r_info); + r.r_addend = TO_NATIVE(rela->r_addend); + sym = elf->symtab_start + ELF_R_SYM(r.r_info); + /* Skip special sections */ + if (sym->st_shndx >= SHN_LORESERVE) + continue; + + secname = secstrings + sechdrs[sym->st_shndx].sh_name; + if (section(secname)) + warn_sec_mismatch(modname, name, elf, sym, r); + } + } +} + +/** + * Functions used only during module init is marked __init and is stored in + * a .init.text section. Likewise data is marked __initdata and stored in + * a .init.data section. + * If this section is one of these sections return 1 + * See include/linux/init.h for the details + **/ +static int init_section(const char *name) +{ + if (strcmp(name, ".init") == 0) + return 1; + if (strncmp(name, ".init.", strlen(".init.")) == 0) + return 1; + return 0; +} + +/** + * Identify sections from which references to a .init section is OK. + * + * Unfortunately references to read only data that referenced .init + * sections had to be excluded. Almost all of these are false + * positives, they are created by gcc. The downside of excluding rodata + * is that there really are some user references from rodata to + * init code, e.g. drivers/video/vgacon.c: + * + * const struct consw vga_con = { + * con_startup: vgacon_startup, + * + * where vgacon_startup is __init. If you want to wade through the false + * positives, take out the check for rodata. + **/ +static int init_section_ref_ok(const char *name) +{ + const char **s; + /* Absolute section names */ + const char *namelist1[] = { + ".init", + ".opd", /* see comment [OPD] at exit_section_ref_ok() */ + ".toc1", /* used by ppc64 */ + ".stab", + ".rodata", + ".text.lock", + "__bug_table", /* used by powerpc for BUG() */ + ".pci_fixup_header", + ".pci_fixup_final", + ".pdr", + "__param", + NULL + }; + /* Start of section names */ + const char *namelist2[] = { + ".init.", + ".altinstructions", + ".eh_frame", + ".debug", + NULL + }; + /* part of section name */ + const char *namelist3 [] = { + ".unwind", /* sample: IA_64.unwind.init.text */ + NULL + }; + + for (s = namelist1; *s; s++) + if (strcmp(*s, name) == 0) + return 1; + for (s = namelist2; *s; s++) + if (strncmp(*s, name, strlen(*s)) == 0) + return 1; + for (s = namelist3; *s; s++) + if (strstr(name, *s) != NULL) + return 1; + return 0; +} + +/* + * Functions used only during module exit is marked __exit and is stored in + * a .exit.text section. Likewise data is marked __exitdata and stored in + * a .exit.data section. + * If this section is one of these sections return 1 + * See include/linux/init.h for the details + **/ +static int exit_section(const char *name) +{ + if (strcmp(name, ".exit.text") == 0) + return 1; + if (strcmp(name, ".exit.data") == 0) + return 1; + return 0; + +} + +/* + * Identify sections from which references to a .exit section is OK. + * + * [OPD] Keith Ownes commented: + * For our future {in}sanity, add a comment that this is the ppc .opd + * section, not the ia64 .opd section. + * ia64 .opd should not point to discarded sections. + **/ +static int exit_section_ref_ok(const char *name) +{ + const char **s; + /* Absolute section names */ + const char *namelist1[] = { + ".exit.text", + ".exit.data", + ".init.text", + ".opd", /* See comment [OPD] */ + ".toc1", /* used by ppc64 */ + ".altinstructions", + ".pdr", + "__bug_table", /* used by powerpc for BUG() */ + ".exitcall.exit", + ".eh_frame", + ".stab", + NULL + }; + /* Start of section names */ + const char *namelist2[] = { + ".debug", + NULL + }; + /* part of section name */ + const char *namelist3 [] = { + ".unwind", /* Sample: IA_64.unwind.exit.text */ + NULL + }; + + for (s = namelist1; *s; s++) + if (strcmp(*s, name) == 0) + return 1; + for (s = namelist2; *s; s++) + if (strncmp(*s, name, strlen(*s)) == 0) + return 1; + for (s = namelist3; *s; s++) + if (strstr(name, *s) != NULL) + return 1; + return 0; +} + +static void read_symbols(char *modname) { const char *symname; char *version; @@ -462,9 +877,7 @@ read_symbols(char *modname) /* When there's no vmlinux, don't print warnings about * unresolved symbols (since there'll be too many ;) */ if (is_vmlinux(modname)) { - unsigned int fake_crc = 0; have_vmlinux = 1; - add_exported_symbol("struct_module", mod, &fake_crc); mod->skip = 1; } @@ -474,6 +887,8 @@ read_symbols(char *modname) handle_modversions(mod, &info, sym, symname); handle_moddevtable(mod, &info, sym, symname); } + check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok); + check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok); version = get_modinfo(info.modinfo, info.modinfo_len, "version"); if (version) @@ -499,13 +914,13 @@ read_symbols(char *modname) * following helper, then compare to the file on disk and * only update the later if anything changed */ -void __attribute__((format(printf, 2, 3))) -buf_printf(struct buffer *buf, const char *fmt, ...) +void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf, + const char *fmt, ...) { char tmp[SZ]; int len; va_list ap; - + va_start(ap, fmt); len = vsnprintf(tmp, SZ, fmt, ap); if (buf->size - buf->pos < len + 1) { @@ -517,8 +932,7 @@ buf_printf(struct buffer *buf, const cha va_end(ap); } -void -buf_write(struct buffer *buf, const char *s, int len) +void buf_write(struct buffer *buf, const char *s, int len) { if (buf->size - buf->pos < len) { buf->size += len; @@ -528,10 +942,10 @@ buf_write(struct buffer *buf, const char buf->pos += len; } -/* Header for the generated file */ - -void -add_header(struct buffer *b, struct module *mod) +/** + * Header for the generated file + **/ +static void add_header(struct buffer *b, struct module *mod) { buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); @@ -551,10 +965,10 @@ add_header(struct buffer *b, struct modu buf_printf(b, "};\n"); } -/* Record CRCs for unresolved symbols */ - -void -add_versions(struct buffer *b, struct module *mod) +/** + * Record CRCs for unresolved symbols + **/ +static void add_versions(struct buffer *b, struct module *mod) { struct symbol *s, *exp; @@ -562,8 +976,8 @@ add_versions(struct buffer *b, struct mo exp = find_symbol(s->name); if (!exp || exp->module == mod) { if (have_vmlinux && !s->weak) - fprintf(stderr, "*** Warning: \"%s\" [%s.ko] " - "undefined!\n", s->name, mod->name); + warn("\"%s\" [%s.ko] undefined!\n", + s->name, mod->name); continue; } s->module = exp->module; @@ -584,8 +998,7 @@ add_versions(struct buffer *b, struct mo continue; } if (!s->crc_valid) { - fprintf(stderr, "*** Warning: \"%s\" [%s.ko] " - "has no CRC!\n", + warn("\"%s\" [%s.ko] has no CRC!\n", s->name, mod->name); continue; } @@ -595,8 +1008,8 @@ add_versions(struct buffer *b, struct mo buf_printf(b, "};\n"); } -void -add_depends(struct buffer *b, struct module *mod, struct module *modules) +static void add_depends(struct buffer *b, struct module *mod, + struct module *modules) { struct symbol *s; struct module *m; @@ -626,8 +1039,7 @@ add_depends(struct buffer *b, struct mod buf_printf(b, "\";\n"); } -void -add_srcversion(struct buffer *b, struct module *mod) +static void add_srcversion(struct buffer *b, struct module *mod) { if (mod->srcversion[0]) { buf_printf(b, "\n"); @@ -636,8 +1048,7 @@ add_srcversion(struct buffer *b, struct } } -void -write_if_changed(struct buffer *b, const char *fname) +static void write_if_changed(struct buffer *b, const char *fname) { char *tmp; FILE *file; @@ -681,8 +1092,7 @@ write_if_changed(struct buffer *b, const fclose(file); } -void -read_dump(const char *fname) +static void read_dump(const char *fname, unsigned int kernel) { unsigned long size, pos = 0; void *file = grab_file(fname, &size); @@ -696,6 +1106,7 @@ read_dump(const char *fname) char *symname, *modname, *d; unsigned int crc; struct module *mod; + struct symbol *s; if (!(symname = strchr(line, '\t'))) goto fail; @@ -716,15 +1127,30 @@ read_dump(const char *fname) mod = new_module(NOFAIL(strdup(modname))); mod->skip = 1; } - add_exported_symbol(symname, mod, &crc); + s = sym_add_exported(symname, mod); + s->kernel = kernel; + s->preloaded = 1; + sym_update_crc(symname, mod, crc); } return; fail: fatal("parse error in symbol dump file\n"); } -void -write_dump(const char *fname) +/* For normal builds always dump all symbols. + * For external modules only dump symbols + * that are not read from kernel Module.symvers. + **/ +static int dump_sym(struct symbol *sym) +{ + if (!external_module) + return 1; + if (sym->vmlinux || sym->kernel) + return 0; + return 1; +} + +static void write_dump(const char *fname) { struct buffer buf = { }; struct symbol *symbol; @@ -733,34 +1159,33 @@ write_dump(const char *fname) for (n = 0; n < SYMBOL_HASH_SIZE ; n++) { symbol = symbolhash[n]; while (symbol) { - symbol = symbol->next; - } - } - - for (n = 0; n < SYMBOL_HASH_SIZE ; n++) { - symbol = symbolhash[n]; - while (symbol) { - buf_printf(&buf, "0x%08x\t%s\t%s\n", symbol->crc, - symbol->name, symbol->module->name); + if (dump_sym(symbol)) + buf_printf(&buf, "0x%08x\t%s\t%s\n", + symbol->crc, symbol->name, + symbol->module->name); symbol = symbol->next; } } write_if_changed(&buf, fname); } -int -main(int argc, char **argv) +int main(int argc, char **argv) { struct module *mod; struct buffer buf = { }; char fname[SZ]; - char *dump_read = NULL, *dump_write = NULL; + char *kernel_read = NULL, *module_read = NULL; + char *dump_write = NULL; int opt; - while ((opt = getopt(argc, argv, "i:mo:a")) != -1) { + while ((opt = getopt(argc, argv, "i:I:mo:a")) != -1) { switch(opt) { case 'i': - dump_read = optarg; + kernel_read = optarg; + break; + case 'I': + module_read = optarg; + external_module = 1; break; case 'm': modversions = 1; @@ -776,8 +1201,10 @@ main(int argc, char **argv) } } - if (dump_read) - read_dump(dump_read); + if (kernel_read) + read_dump(kernel_read, 1); + if (module_read) + read_dump(module_read, 0); while (optind < argc) { read_symbols(argv[optind++]); @@ -804,4 +1231,3 @@ main(int argc, char **argv) return 0; } - diff -puN scripts/mod/modpost.h~git-kbuild scripts/mod/modpost.h --- devel/scripts/mod/modpost.h~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/mod/modpost.h 2006-03-11 17:01:49.000000000 -0800 @@ -13,20 +13,30 @@ #if KERNEL_ELFCLASS == ELFCLASS32 -#define Elf_Ehdr Elf32_Ehdr -#define Elf_Shdr Elf32_Shdr +#define Elf_Ehdr Elf32_Ehdr +#define Elf_Shdr Elf32_Shdr #define Elf_Sym Elf32_Sym +#define Elf_Addr Elf32_Addr +#define Elf_Section Elf32_Section #define ELF_ST_BIND ELF32_ST_BIND #define ELF_ST_TYPE ELF32_ST_TYPE +#define Elf_Rela Elf32_Rela +#define ELF_R_SYM ELF32_R_SYM +#define ELF_R_TYPE ELF32_R_TYPE #else -#define Elf_Ehdr Elf64_Ehdr -#define Elf_Shdr Elf64_Shdr +#define Elf_Ehdr Elf64_Ehdr +#define Elf_Shdr Elf64_Shdr #define Elf_Sym Elf64_Sym +#define Elf_Addr Elf64_Addr +#define Elf_Section Elf64_Section #define ELF_ST_BIND ELF64_ST_BIND #define ELF_ST_TYPE ELF64_ST_TYPE +#define Elf_Rela Elf64_Rela +#define ELF_R_SYM ELF64_R_SYM +#define ELF_R_TYPE ELF64_R_TYPE #endif #if KERNEL_ELFDATA != HOST_ELFDATA @@ -91,17 +101,22 @@ struct elf_info { unsigned int modinfo_len; }; +/* file2alias.c */ void handle_moddevtable(struct module *mod, struct elf_info *info, Elf_Sym *sym, const char *symname); - void add_moddevtable(struct buffer *buf, struct module *mod); +/* sumversion.c */ void maybe_frob_rcs_version(const char *modfilename, char *version, void *modinfo, unsigned long modinfo_offset); void get_src_version(const char *modname, char sum[], unsigned sumlen); +/* from modpost.c */ void *grab_file(const char *filename, unsigned long *size); char* get_next_line(unsigned long *pos, void *file, unsigned long size); void release_file(void *file, unsigned long size); + +void fatal(const char *fmt, ...); +void warn(const char *fmt, ...); diff -puN scripts/mod/sumversion.c~git-kbuild scripts/mod/sumversion.c --- devel/scripts/mod/sumversion.c~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/mod/sumversion.c 2006-03-11 17:01:49.000000000 -0800 @@ -316,8 +316,7 @@ static int parse_source_files(const char file = grab_file(cmd, &flen); if (!file) { - fprintf(stderr, "Warning: could not find %s for %s\n", - cmd, objfile); + warn("could not find %s for %s\n", cmd, objfile); goto out; } @@ -355,9 +354,8 @@ static int parse_source_files(const char /* Check if this file is in same dir as objfile */ if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) { if (!parse_file(line, md)) { - fprintf(stderr, - "Warning: could not open %s: %s\n", - line, strerror(errno)); + warn("could not open %s: %s\n", + line, strerror(errno)); goto out_file; } @@ -383,8 +381,11 @@ void get_src_version(const char *modname struct md4_ctx md; char *sources, *end, *fname; const char *basename; - char filelist[strlen(getenv("MODVERDIR")) + strlen("/") + - strlen(modname) - strlen(".o") + strlen(".mod") + 1 ]; + char filelist[PATH_MAX + 1]; + char *modverdir = getenv("MODVERDIR"); + + if (!modverdir) + modverdir = "."; /* Source files for module are in .tmp_versions/modname.mod, after the first line. */ @@ -392,28 +393,25 @@ void get_src_version(const char *modname basename = strrchr(modname, '/') + 1; else basename = modname; - sprintf(filelist, "%s/%.*s.mod", getenv("MODVERDIR"), + sprintf(filelist, "%s/%.*s.mod", modverdir, (int) strlen(basename) - 2, basename); file = grab_file(filelist, &len); if (!file) { - fprintf(stderr, "Warning: could not find versions for %s\n", - filelist); + warn("could not find versions for %s\n", filelist); return; } sources = strchr(file, '\n'); if (!sources) { - fprintf(stderr, "Warning: malformed versions file for %s\n", - modname); + warn("malformed versions file for %s\n", modname); goto release; } sources++; end = strchr(sources, '\n'); if (!end) { - fprintf(stderr, "Warning: bad ending versions file for %s\n", - modname); + warn("bad ending versions file for %s\n", modname); goto release; } *end = '\0'; @@ -438,19 +436,19 @@ static void write_version(const char *fi fd = open(filename, O_RDWR); if (fd < 0) { - fprintf(stderr, "Warning: changing sum in %s failed: %s\n", + warn("changing sum in %s failed: %s\n", filename, strerror(errno)); return; } if (lseek(fd, offset, SEEK_SET) == (off_t)-1) { - fprintf(stderr, "Warning: changing sum in %s:%lu failed: %s\n", + warn("changing sum in %s:%lu failed: %s\n", filename, offset, strerror(errno)); goto out; } if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) { - fprintf(stderr, "Warning: writing sum in %s failed: %s\n", + warn("writing sum in %s failed: %s\n", filename, strerror(errno)); goto out; } diff -puN scripts/namespace.pl~git-kbuild scripts/namespace.pl --- devel/scripts/namespace.pl~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/namespace.pl 2006-03-11 17:01:49.000000000 -0800 @@ -66,8 +66,8 @@ require 5; # at least perl 5 use strict; use File::Find; -my $nm = "/usr/bin/nm -p"; -my $objdump = "/usr/bin/objdump -s -j .comment"; +my $nm = ($ENV{'NM'} || "nm") . " -p"; +my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment"; my $srctree = ""; my $objtree = ""; $srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'})); diff -puN scripts/package/Makefile~git-kbuild scripts/package/Makefile --- devel/scripts/package/Makefile~git-kbuild 2006-03-11 17:01:48.000000000 -0800 +++ devel-akpm/scripts/package/Makefile 2006-03-11 17:01:49.000000000 -0800 @@ -32,12 +32,11 @@ MKSPEC := $(srctree)/scripts/package PREV := set -e; cd ..; # rpm-pkg -.PHONY: rpm-pkg rpm - +# --------------------------------------------------------------------------- $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile $(CONFIG_SHELL) $(MKSPEC) > $@ -rpm-pkg rpm: $(objtree)/kernel.spec +rpm-pkg rpm: $(objtree)/kernel.spec FORCE $(MAKE) clean $(PREV) ln -sf $(srctree) $(KERNELPATH) $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. @@ -54,11 +53,11 @@ rpm-pkg rpm: $(objtree)/kernel.spec clean-files := $(objtree)/kernel.spec # binrpm-pkg -.PHONY: binrpm-pkg +# --------------------------------------------------------------------------- $(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ - -binrpm-pkg: $(objtree)/binkernel.spec + +binrpm-pkg: $(objtree)/binkernel.spec FORCE $(MAKE) KBUILD_SRC= set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version @@ -71,9 +70,7 @@ clean-files += $(objtree)/binkernel.spec # Deb target # --------------------------------------------------------------------------- -# -.PHONY: deb-pkg -deb-pkg: +deb-pkg: FORCE $(MAKE) KBUILD_SRC= $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb @@ -82,8 +79,7 @@ clean-dirs += $(objtree)/debian/ # tarball targets # --------------------------------------------------------------------------- -.PHONY: tar%pkg -tar%pkg: +tar%pkg: FORCE $(MAKE) KBUILD_SRC= $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ @@ -92,7 +88,7 @@ clean-dirs += $(objtree)/tar-install/ # Help text displayed when executing 'make help' # --------------------------------------------------------------------------- -help: +help: FORCE @echo ' rpm-pkg - Build the kernel as an RPM package' @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel' @echo ' and modules' diff -puN /dev/null sound/oss/.gitignore --- /dev/null 2003-09-15 06:40:47.000000000 -0700 +++ devel-akpm/sound/oss/.gitignore 2006-03-11 17:01:49.000000000 -0800 @@ -0,0 +1,4 @@ +#Ignore generated files +maui_boot.h +pss_boot.h +trix_boot.h _