bk://linux-sam.bkbits.net/kbuild
sam@mars.ravnborg.org|ChangeSet|20050404204528|51527 sam

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/04/04 18:35:15-07:00 akpm@bix.(none) 
#   Merge bk://linux-sam.bkbits.net/kbuild
#   into bix.(none):/usr/src/bk-kbuild
# 
# scripts/mod/sumversion.c
#   2005/04/04 18:35:07-07:00 akpm@bix.(none) +0 -3
#   Auto merged
# 
# init/Kconfig
#   2005/04/04 18:35:07-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# Makefile
#   2005/04/04 18:35:07-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/04/04 22:45:28+02:00 sam@mars.ravnborg.org 
#   kbuild: Default for LOCALVERSION_AUTO is n
#   
#   Generating local version requires perl and add a ~1 sec delay when compiling.
#   So set option to n for now.
#   If it get popular we will change it to y and update defconfig's accordingly
#   
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# init/Kconfig
#   2005/04/04 22:45:06+02:00 sam@mars.ravnborg.org +1 -1
#   Default is n
# 
# Makefile
#   2005/04/04 22:45:06+02:00 sam@mars.ravnborg.org +2 -1
#   Fit in 80 coloums
# 
# ChangeSet
#   2005/04/04 13:26:30-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild
# 
# Makefile
#   2005/04/04 13:26:25-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/04/03 22:26:47+02:00 sam@mars.ravnborg.org 
#   kbuild: Use -Wno-pointer-sign when building for host
#   
#   Avoid lot's of useless warning when building host utilities.
#   A brave sould may take a look sometime - but not all warnings are correct.
#   
#   From: Pawel Sikora <pluto@pld-linux.org>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# Makefile
#   2005/04/03 22:26:24+02:00 sam@mars.ravnborg.org +12 -4
#   -Wno-pointer-sign for gcc 4.xx when compiling host programs
# 
# ChangeSet
#   2005/04/03 21:45:25+02:00 ryan@michonline.com 
#   kbuild: Fix bug in make deb-pkg when using seperate source and output directories
#   
#   When running "make O=something deb-pkg", I get a failure that claims I
#   haven't configured my kernel (I have).  Running it a second time tells
#   me to run "make mrproper"  (include/linux/version.h got built on the
#   first run)
#   
#   Original patch from:
#   From: Ajay Patel <patela@gmail.com>
#   
#   With modifications from:
#   Signed-off-By: Ryan Anderson <ryan@michonline.com>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/package/builddeb
#   2005/04/03 21:36:54+02:00 ryan@michonline.com +1 -1
#   kbuild: Fix bug in make deb-pkg when using seperate source and output directories
# 
# scripts/package/Makefile
#   2005/04/03 21:38:04+02:00 ryan@michonline.com +2 -2
#   kbuild: Fix bug in make deb-pkg when using seperate source and output directories
# 
# ChangeSet
#   2005/04/03 21:29:35+02:00 ryan@michonline.com 
#   uml: Restore proper descriptions in make deb-pkg target
#   
#   This pulls the description from the Debian user-mode-linux package, and
#   puts $version back in the appropriate places for both descriptions.
#   
#   Signed-off-by: Ryan Anderson <ryan@michonline.com>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/package/builddeb
#   2005/03/13 02:40:50+01:00 ryan@michonline.com +26 -2
#   uml: Restore proper descriptions in make deb-pkg target
# 
# ChangeSet
#   2005/04/03 21:29:06+02:00 ryan@michonline.com 
#   uml: Make deb-pkg build target build a Debian-style user-mode-linux package
#   
#   Make the deb-pkg build target understand the "um" arch and set up the
#   package and directory structure to match a mainline-Debian style
#   user-mode-linux package.
#   
#   This is primarily so that it stops matching, exactly, the naming
#   convention used by normal, non-UML kernels generated by this command.
#   
#   Installing "linux-2.6.11" and "linux-2.6.11", where one is a UML kernel
#   doesn't do the right thing.  This fixes that.
#   
#   Signed-off-by: Ryan Anderson <ryan@michonline.com>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/package/builddeb
#   2005/03/07 19:21:16+01:00 ryan@michonline.com +26 -6
#   uml: Make deb-pkg build target build a Debian-style user-mode-linux package
# 
# ChangeSet
#   2005/04/03 21:16:06+02:00 ryan@michonline.com 
#   Automatically append a semi-random version for BK users
#   
#   Automatically append a semi-random version if the tree we're building
#   isn't tagged in BitKeeper and CONFIG_LOCALVERSION_AUTO is set.
#   
#   This fixes the case when Linus (or someone else) does a release and tags
#   it, someone else does a build of that release tree (i.e, 2.6.11), and
#   installs it.  Later, before another release occurs (i.e, -rc1), another
#   build happens, and the actual, released 2.6.11 is overwritten with the
#   -current tree.
#   
#   Two approachs are present here, a Perl version that is setup to handle
#   other automatic version appends (i.e, a CVS version shouldn't be much
#   effort to add), and a simplistic shell version that depends on "md5sum".
#   Both approaches generate the same hash.
#   
#   I've sent this twice before, gotten no comments, so I'm really looking
#   for feedback on the approach and idea, more than anything else.
#   
#   Signed-Off-By: Ryan Anderson <ryan@michonline.com>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# init/Kconfig
#   2005/04/03 21:06:03+02:00 ryan@michonline.com +18 -0
#   Automatically append a semi-random version for BK users
# 
# scripts/setlocalversion
#   2005/04/03 21:06:03+02:00 ryan@michonline.com +119 -0
#   Automatically append a semi-random version for BK users
# 
# Makefile
#   2005/04/03 21:06:00+02:00 ryan@michonline.com +20 -0
#   Automatically append a semi-random version for BK users
# 
# scripts/setlocalversion
#   2005/04/03 21:06:03+02:00 ryan@michonline.com +0 -0
#   BitKeeper file /home/sam/bk/kbuild/scripts/setlocalversion
# 
# ChangeSet
#   2005/04/03 21:03:16+02:00 agruen@suse.de 
#   kbuild: Don't fail if include/asm symlink exists
#   
#   we're having the following situation: There are user-space applications
#   that include kernel headers directly. With a completely unconfigured
#   /usr/src/linux tree, including most headers fails because essential
#   files are not there:
#   
#   	include/asm
#   	include/linux/autoconf.h
#   	include/linux/version.h
#   
#   So we create these files. On the other hand, we want to use
#   /usr/src/linux as read-only source for building kernels or additional
#   modules. Now when building a kernel with a separate output directory
#   (O=), there is a check in the main makefile for the include/asm symlink.
#   There is no real need for this check: if we ensure that
#   $(objdir)/include/asm is always created as the patch does,
#   $(srctree)/include/asm becomes irrelevant.
#   
#   From: Andreas Gruenbacher <agruen@suse.de>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# Makefile
#   2005/04/03 21:01:35+02:00 agruen@suse.de +4 -3
#   kbuild: Don't fail if include/asm symlink exists
# 
# ChangeSet
#   2005/04/03 20:59:20+02:00 sam@mars.ravnborg.org 
#   kbuild: Trivial spelling/documentation fixes
#   
#   From: Paul Walker <paul@blacksun.org.uk>
#   From: Ian Campbell <ijc@hellion.org.uk>
#   
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/Makefile.modpost
#   2005/04/03 20:58:58+02:00 sam@mars.ravnborg.org +3 -3
#   Spelling fixes
# 
# Makefile
#   2005/04/03 20:58:58+02:00 sam@mars.ravnborg.org +1 -1
#   Spelling fixes
# 
# Documentation/kbuild/modules.txt
#   2005/04/03 20:58:58+02:00 sam@mars.ravnborg.org +1 -1
#   Corrected example
# 
# ChangeSet
#   2005/04/03 20:34:08+02:00 blaisorblade@yahoo.it 
#   kbuild: describe Kbuild pitfall
#   
#   Whitespace is significant for make, and I just fought against this... so
#   please apply this patch.
#   
#   Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# Documentation/kbuild/makefiles.txt
#   2005/03/19 17:53:57+01:00 blaisorblade@yahoo.it +6 -0
#   kbuild: describe Kbuild pitfall
# 
# ChangeSet
#   2005/03/27 16:19:48-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild
# 
# Makefile
#   2005/03/27 16:19:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/17 21:54:01-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild
# 
# Makefile
#   2005/03/17 21:53:55-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/17 22:23:45+01:00 domen@coderock.org 
#   kbuild: scripts/mod/sumversion.c - replace strtok() with strsep()
#   
#   Replaces strtok() with strsep()
#   
#   Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
#   Signed-off-by: Domen Puncer <domen@coderock.org>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/mod/sumversion.c
#   2005/03/05 16:13:15+01:00 domen@coderock.org +3 -1
#   kbuild: scripts/mod/sumversion.c - replace strtok() with strsep()
# 
# ChangeSet
#   2005/03/14 23:26:47-08:00 akpm@bix.(none) 
#   Merge bk://linux-sam.bkbits.net/kbuild
#   into bix.(none):/usr/src/bk-kbuild
# 
# arch/i386/Makefile
#   2005/03/14 23:26:42-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# Makefile
#   2005/03/14 23:26:42-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/14 23:25:14-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild
# 
# Makefile
#   2005/03/14 23:25:08-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/14 22:57:57+01:00 rddunlap@osdl.org 
#   kbuild: fix buildcheck
#   
#   I should not have added init.text test here;
#   it's more than useless, it actually degrades the output.
#   
#   Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/reference_discarded.pl
#   2005/03/14 22:46:07+01:00 rddunlap@osdl.org +0 -2
#   kbuild: fix buildcheck
# 
# ChangeSet
#   2005/03/14 22:42:50+01:00 kaos@ocs.com.au 
#   kbuild: Add target debug_kallsyms
#   
#   Make it easier to generate maps for debugging kallsyms problems.
#   debug_kallsyms is only a debugging target so no help or silent mode.
#   
#   Signed-off-by: Keith Owens <kaos@ocs.com.au>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# Makefile
#   2005/02/26 11:30:54+01:00 kaos@ocs.com.au +10 -0
#   kbuild: Add target debug_kallsyms
# 
# ChangeSet
#   2005/03/14 22:36:24+01:00 mpm@selenic.com 
#   ikbuild: "PREEMPT" in UTS_VERSION
#   
#   Add PREEMPT to UTS_VERSION where enabled as is done for SMP to make
#   preempt kernels easily identifiable.
#   Added SMP PREEMPT as comment in compile.h to force it to be
#   updated when they change (sam).
#   
#   Signed-off-by: Matt Mackall <mpm@selenic.com>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/mkcompile_h
#   2005/03/14 21:43:50+01:00 mpm@selenic.com +8 -4
#   ikbuild: "PREEMPT" in UTS_VERSION
# 
# init/Makefile
#   2005/03/14 21:30:13+01:00 mpm@selenic.com +2 -1
#   ikbuild: "PREEMPT" in UTS_VERSION
# 
# ChangeSet
#   2005/03/14 22:29:01+01:00 sam@mars.ravnborg.org 
#   kbuild/i386: introduce make kernel_install
#   
#   Removing the dependency on vmlinux for the install target raised a few complaints,
#   so instead added a new target: kernel_install.
#   
#   kernel_install will install the kernel jsut like the ordinary install target. The only difference is
#   that install has a dependency on vmlinux, kernel_install does not.
#   
#   kernel_install is similar to modules_install in the fact that neither does a full kernel
#   compile before performing the install. In this way they are good for root use.
#   Also added back the dependency on vmlinux for the install target.
#   
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# arch/i386/Makefile
#   2005/03/14 22:28:40+01:00 sam@mars.ravnborg.org +4 -3
#   introduce kernel_install
# 
# ChangeSet
#   2005/03/14 20:56:01+01:00 sam@mars.ravnborg.org 
#   kbuild: Avoid inconsistent kallsyms data
#   
#   Several reports on inconsistent kallsyms data has been caused by the aliased symbols
#   __sched_text_start and __down to shift places in the output of nm.
#   The root cause was that on second pass ld aligned __sched_text_start to a 4 byte boundary
#   which is the function alignment on i386.
#   sched.text and spinlock.text is now aligned to an 8 byte boundary to make sure they
#   are aligned to a function alignemnt on most (all?) archs.
#   
#   Tested by: Paulo Marques <pmarques@grupopie.com>
#   Tested by: Alexander Stohr <Alexander.Stohr@gmx.de>
#   
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# include/asm-generic/vmlinux.lds.h
#   2005/03/14 20:55:39+01:00 sam@mars.ravnborg.org +9 -0
#   Align sched.text and spinlock.text to an 8 byte boundary
# 
# ChangeSet
#   2005/03/14 20:38:16+01:00 rddunlap@osdl.org 
#   buildcheck: reduce DEBUG_INFO noise from reference* scripts
#   
#   Reduce noise in 'make buildcheck' that is caused by CONFIG_DEBUG_INFO=y.
#   
#   Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/reference_init.pl
#   2005/03/14 19:40:19+01:00 rddunlap@osdl.org +1 -0
#   buildcheck: reduce DEBUG_INFO noise from reference* scripts
# 
# scripts/reference_discarded.pl
#   2005/03/14 19:38:47+01:00 rddunlap@osdl.org +3 -0
#   buildcheck: reduce DEBUG_INFO noise from reference* scripts
# 
# ChangeSet
#   2005/03/13 23:15:25+01:00 sam@mars.ravnborg.org 
#   kbuild/ppc: Tell when uImage was not build
#   
#   Tom Rini said:
#   Note that there is still a trivial'ish change to make.  When mkimage
#   doesn't exist on the host we should say "uImage not made" or
#   something similar.
#   
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# arch/ppc/boot/images/Makefile
#   2005/03/13 23:15:05+01:00 sam@mars.ravnborg.org +2 -1
#   Tell when uImage was not made
# 
# ChangeSet
#   2005/03/13 20:10:40+01:00 matthew@wil.cx 
#   kbuild: Fix build as root then user
#   
#   I inadvertently built a tree as root and then rebuilt it as a user.  I
#   got a lot of prompts ...
#   
#   mv: overwrite `drivers/char/drm/drm_auth.o', overriding mode 0644?
#   
#   Using mv -f fixes that.
#   
#   Signed-off-by: Matthew Wilcox <matthew@wil.cx>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# scripts/Makefile.build
#   2005/02/07 15:31:32+01:00 matthew@wil.cx +1 -1
#   kbuild: Fix build as root then user
# 
# ChangeSet
#   2005/03/13 16:58:21+01:00 sam@mars.ravnborg.org 
#   kbuild: Allow arch settings to CROSS_COMPILE to take effect
#   
#   Move definition os NOSTDINC_FLAGS below inclusion of arch Makefile, so any
#   arch specific settings to $(CC) takes effect before looking up the
#   compiler include directory.
#   
#   This decreases kernel compile time with 0.1 second (3.6 -> 3.5 seconds) when
#   running make on a fully build kernel
#   
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# Makefile
#   2005/03/13 16:58:00+01:00 sam@mars.ravnborg.org +4 -2
#   Allow arch settings to CROSS_COMPILE to take effect
# 
# ChangeSet
#   2005/03/12 21:28:11-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild
# 
# include/linux/module.h
#   2005/03/12 21:28:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/video/console/Makefile
#   2005/03/12 21:28:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/12 12:41:56-08:00 akpm@bix.(none) 
#   Merge bk://linux-sam.bkbits.net/kbuild
#   into bix.(none):/usr/src/bk-kbuild
# 
# kernel/kallsyms.c
#   2005/03/12 12:41:51-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# kernel/Makefile
#   2005/03/12 12:41:51-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/video/console/Makefile
#   2005/03/12 12:41:51-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/i386/Makefile
#   2005/03/12 12:41:51-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# Makefile
#   2005/03/12 12:41:51-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/12 12:40:11-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild
# 
# include/linux/module.h
#   2005/03/12 12:40:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/video/console/Makefile
#   2005/03/12 12:40:05-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/11 13:03:33-08:00 akpm@bix.(none) 
#   Merge bk://linux-sam.bkbits.net/kbuild
#   into bix.(none):/usr/src/bk-kbuild
# 
# Makefile
#   2005/03/11 13:03:28-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/10 17:43:14-08:00 akpm@bix.(none) 
#   Merge bk://linux-sam.bkbits.net/kbuild
#   into bix.(none):/usr/src/bk-kbuild
# 
# kernel/kallsyms.c
#   2005/03/10 17:43:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# kernel/Makefile
#   2005/03/10 17:43:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/video/console/Makefile
#   2005/03/10 17:43:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/i386/Makefile
#   2005/03/10 17:43:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# Makefile
#   2005/03/10 17:43:06-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
--- a/Documentation/kbuild/makefiles.txt	2005-04-04 18:36:48 -07:00
+++ b/Documentation/kbuild/makefiles.txt	2005-04-04 18:36:48 -07:00
@@ -872,7 +872,13 @@
 	Assignments to $(targets) are without $(obj)/ prefix.
 	if_changed may be used in conjunction with custom commands as
 	defined in 6.7 "Custom kbuild commands".
+
 	Note: It is a typical mistake to forget the FORCE prerequisite.
+	Another pitfall that bit me once is that whitespace is sometimes
+	significant; for instance, the below will fail (note the extra space
+	after the comma):
+		target: source(s) FORCE
+			$(call if_changed, ld/objcopy/gzip)
 
     ld
 	Link target. Often LDFLAGS_$@ is used to set specific options to ld.
diff -Nru a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
--- a/Documentation/kbuild/modules.txt	2005-04-04 18:36:48 -07:00
+++ b/Documentation/kbuild/modules.txt	2005-04-04 18:36:48 -07:00
@@ -252,7 +252,7 @@
 
 		--> filename: Makefile
 		ifneq ($(KERNELRELEASE),)
-		include Kbuild
+		$(src)/include Kbuild
 		else
 		# Normal Makefile
 
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2005-04-04 18:36:48 -07:00
+++ b/Makefile	2005-04-04 18:36:48 -07:00
@@ -201,10 +201,10 @@
 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
 	  else echo sh; fi ; fi)
 
-HOSTCC  	= gcc
-HOSTCXX  	= g++
-HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCXXFLAGS	= -O2
+HOSTCC  	:= gcc
+HOSTCXX  	:= g++
+HOSTCFLAGS	:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCXXFLAGS	:= -O2
 
 # 	Decide whether to build built-in, modular, or both.
 #	Normally, just do built-in.
@@ -281,7 +281,7 @@
 # See documentation in Documentation/kbuild/makefiles.txt
 
 # cc-option
-# Usage: cflags-y += $(call gcc-option, -march=winchip-c6, -march=i586)
+# 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 ;)
@@ -332,9 +332,7 @@
 PERL		= perl
 CHECK		= sparse
 
-NOSTDINC_FLAGS  = -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
-CHECKFLAGS     += $(NOSTDINC_FLAGS)
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
@@ -531,12 +529,24 @@
 
 include $(srctree)/arch/$(ARCH)/Makefile
 
+# arch Makefile may override CC so keep this after arch Makefile is included
+NOSTDINC_FLAGS := -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS     += $(NOSTDINC_FLAGS)
+
 # warn about C99 declaration after statement
 CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 
 # disable pointer signedness warnings in gcc 4.0
 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
+HOSTCFLAGS += $(shell if $(HOSTCC) $(HOSTCFLAGS) -Wno-pointer-sign -S \
+              -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
+               echo "-Wno-pointer-sign"; fi ;)
+
+HOSTCXXFLAGS += $(shell if $(HOSTCXX) $(HOSTCXXFLAGS) -Wno-pointer-sign -S \
+              -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
+               echo "-Wno-pointer-sign"; fi ;)
+
 # Default kernel image to build when no specific target is given.
 # KBUILD_IMAGE may be overruled on the commandline or
 # set in the environment
@@ -549,6 +559,27 @@
 # images. Default is /boot, but you can set it to other values
 export	INSTALL_PATH ?= /boot
 
+# If CONFIG_LOCALVERSION_AUTO is set, we automatically perform some tests
+# and try to determine if the current source tree is a release tree, of any sort,
+# or if is a pure development tree.
+#
+# A 'release tree' is any tree with a BitKeeper, or other SCM, TAG associated
+# with it.  The primary goal of this is to make it safe for a native
+# BitKeeper/CVS/SVN user to build a release tree (i.e, 2.6.9) and also to
+# continue developing against the current Linus tree, without having the Linus
+# tree overwrite the 2.6.9 tree when installed.
+#
+# Currently, only BitKeeper and CVS is supported.
+# Other SCMs can edit scripts/setlocalversion and add the appropriate
+# checks as needed.
+
+
+ifdef CONFIG_LOCALVERSION_AUTO
+	localversion-auto := \
+        	$(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree))
+	LOCALVERSION := $(LOCALVERSION)$(localversion-auto)
+endif
+
 #
 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
 # relocations required by build roots.  This is not defined in the
@@ -720,6 +751,16 @@
 # Needs to visit scripts/ before $(KALLSYMS) can be used.
 $(KALLSYMS): scripts ;
 
+# Generate some data for debugging strange kallsyms problems
+debug_kallsyms: .tmp_map$(last_kallsyms)
+
+.tmp_map%: .tmp_vmlinux% FORCE
+	($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@
+
+.tmp_map3: .tmp_map2
+
+.tmp_map2: .tmp_map1
+
 endif # ifdef CONFIG_KALLSYMS
 
 # vmlinux image - including updated kernel symbols
@@ -755,7 +796,7 @@
 prepare2:
 ifneq ($(KBUILD_SRC),)
 	@echo '  Using $(srctree) as source for kernel'
-	$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
+	$(Q)if [ -f $(srctree)/.config ]; then \
 		echo "  $(srctree) is not clean, please run 'make mrproper'";\
 		echo "  in the '$(srctree)' directory.";\
 		/bin/false; \
@@ -767,7 +808,8 @@
 # prepare1 creates a makefile if using a separate output directory
 prepare1: prepare2 outputmakefile
 
-prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
+prepare0: prepare1 include/linux/version.h $(objtree)/include/asm \
+                   include/config/MARKER
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
 	$(Q)mkdir -p $(MODVERDIR)
@@ -803,7 +845,7 @@
 #	hard to detect, but I suppose "make mrproper" is a good idea
 #	before switching between archs anyway.
 
-include/asm:
+$(objtree)/include/asm:
 	@echo '  SYMLINK $@ -> include/asm-$(ARCH)'
 	$(Q)if [ ! -d include ]; then mkdir -p include; fi;
 	@ln -fsn asm-$(ARCH) $@
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile	2005-04-04 18:36:48 -07:00
+++ b/arch/i386/Makefile	2005-04-04 18:36:48 -07:00
@@ -123,7 +123,7 @@
 boot := arch/i386/boot
 
 .PHONY: zImage bzImage compressed zlilo bzlilo \
-	zdisk bzdisk fdimage fdimage144 fdimage288 install
+	zdisk bzdisk fdimage fdimage144 fdimage288 install kernel_install
 
 all: bzImage
 
@@ -145,8 +145,9 @@
 fdimage fdimage144 fdimage288: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
 
-install:
-	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
+install: vmlinux
+install kernel_install:
+	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
 
 prepare: include/asm-$(ARCH)/asm_offsets.h
 CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
diff -Nru a/arch/ppc/boot/images/Makefile b/arch/ppc/boot/images/Makefile
--- a/arch/ppc/boot/images/Makefile	2005-04-04 18:36:48 -07:00
+++ b/arch/ppc/boot/images/Makefile	2005-04-04 18:36:48 -07:00
@@ -20,8 +20,9 @@
 
 targets += uImage
 $(obj)/uImage: $(obj)/vmlinux.gz
+	$(Q)rm -f $@
 	$(call if_changed,uimage)
-	@echo '  Image $@ is ready'
+	@echo '  Image: $@' $(if $(wildcard $@),'is ready','not made')
 
 # Files generated that shall be removed upon make clean
 clean-files	:= sImage vmapus vmlinux* miboot* zImage* uImage
diff -Nru a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
--- a/include/asm-generic/vmlinux.lds.h	2005-04-04 18:36:48 -07:00
+++ b/include/asm-generic/vmlinux.lds.h	2005-04-04 18:36:48 -07:00
@@ -6,6 +6,9 @@
 #define VMLINUX_SYMBOL(_sym_) _sym_
 #endif
 
+/* Align . to a 8 byte boundary equals to maximum function alignment. */
+#define ALIGN_FUNCTION()  . = ALIGN(8)
+
 #define RODATA								\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
 		*(.rodata) *(.rodata.*)					\
@@ -79,12 +82,18 @@
 		VMLINUX_SYMBOL(__security_initcall_end) = .;		\
 	}
 
+/* sched.text is aling to function alignment to secure we have same
+ * address even at second ld pass when generating System.map */
 #define SCHED_TEXT							\
+		ALIGN_FUNCTION();					\
 		VMLINUX_SYMBOL(__sched_text_start) = .;			\
 		*(.sched.text)						\
 		VMLINUX_SYMBOL(__sched_text_end) = .;
 
+/* spinlock.text is aling to function alignment to secure we have same
+ * address even at second ld pass when generating System.map */
 #define LOCK_TEXT							\
+		ALIGN_FUNCTION();					\
 		VMLINUX_SYMBOL(__lock_text_start) = .;			\
 		*(.spinlock.text)					\
 		VMLINUX_SYMBOL(__lock_text_end) = .;
diff -Nru a/init/Kconfig b/init/Kconfig
--- a/init/Kconfig	2005-04-04 18:36:48 -07:00
+++ b/init/Kconfig	2005-04-04 18:36:48 -07:00
@@ -77,6 +77,24 @@
 	  object and source tree, in that order.  Your total string can
 	  be a maximum of 64 characters.
 
+config LOCALVERSION_AUTO
+	bool "Automatically append version information to the version string"
+	default n
+	help
+	  This will try to automatically determine if the current tree is a
+	  release tree by looking for BitKeeper or CVS tags that
+	  belong to the current top of tree revision.
+
+	  A string of the format -BKxxxxxxxx will be added to the localversion
+	  if a BitKeeper based tree is found.  The string -cvs-$version will be
+	  added to the localversion if a CVS tree based on the BK->CVS tree is
+	  found.  The string generated by this will be appended after any
+	  matching localversion* files, and after the value set in
+	  CONFIG_LOCALVERSION
+
+	  Note: This requires Perl and the Digest::MD5 module, as well
+	  as BitKeeper and/or CVS.
+
 config SWAP
 	bool "Support for paging of anonymous memory (swap)"
 	depends on MMU
diff -Nru a/init/Makefile b/init/Makefile
--- a/init/Makefile	2005-04-04 18:36:48 -07:00
+++ b/init/Makefile	2005-04-04 18:36:48 -07:00
@@ -25,4 +25,5 @@
 
 include/linux/compile.h: FORCE
 	@echo '  CHK     $@'
-	@$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
+	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)"
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
--- a/scripts/Makefile.build	2005-04-04 18:36:48 -07:00
+++ b/scripts/Makefile.build	2005-04-04 18:36:48 -07:00
@@ -169,7 +169,7 @@
 			-T $(@D)/.tmp_$(@F:.o=.ver);			\
 		rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver);	\
 	else								\
-		mv $(@D)/.tmp_$(@F) $@;					\
+		mv -f $(@D)/.tmp_$(@F) $@;				\
 	fi;
 endif
 
diff -Nru a/scripts/Makefile.modpost b/scripts/Makefile.modpost
--- a/scripts/Makefile.modpost	2005-04-04 18:36:48 -07:00
+++ b/scripts/Makefile.modpost	2005-04-04 18:36:48 -07:00
@@ -25,12 +25,12 @@
 #     - GCC Version
 #   Module info
 #     - Module version (MODULE_VERSION)
-#     - Module alias'es (MODULE_ALIAS)
+#     - Module aliases (MODULE_ALIAS)
 #     - Module license (MODULE_LICENSE)
 #     - See include/linux/module.h for more details
 
 # Step 4 is solely used to allow module versioning in external modules,
-# where the CRC of each module is retreived from the Module.symers file.
+# where the CRC of each module is retrieved from the Module.symvers file.
 
 .PHONY: _modpost
 _modpost: __modpost
@@ -90,7 +90,7 @@
 targets += $(modules)
 
 
-# Add FORCE to the prequisites of a target to force it to be always rebuilt.
+# Add FORCE to the prerequisites of a target to force it to be always rebuilt.
 # ---------------------------------------------------------------------------
 
 .PHONY: FORCE
diff -Nru a/scripts/mkcompile_h b/scripts/mkcompile_h
--- a/scripts/mkcompile_h	2005-04-04 18:36:48 -07:00
+++ b/scripts/mkcompile_h	2005-04-04 18:36:48 -07:00
@@ -1,7 +1,8 @@
 TARGET=$1
 ARCH=$2
 SMP=$3
-CC=$4
+PREEMPT=$4
+CC=$5
 
 # If compile.h exists already and we don't own autoconf.h
 # (i.e. we're not the same user who did make *config), don't
@@ -26,8 +27,10 @@
 
 
 UTS_VERSION="#$VERSION"
-if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi
-UTS_VERSION="$UTS_VERSION `LC_ALL=C LANG=C date`"
+CONFIG_FLAGS=""
+if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
+if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
+UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
 
 # Truncate to maximum length
 
@@ -37,7 +40,8 @@
 # Generate a temporary compile.h
 
 ( echo /\* This file is auto generated, version $VERSION \*/
-
+  if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
+  
   echo \#define UTS_MACHINE \"$ARCH\"
 
   echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
diff -Nru a/scripts/package/Makefile b/scripts/package/Makefile
--- a/scripts/package/Makefile	2005-04-04 18:36:48 -07:00
+++ b/scripts/package/Makefile	2005-04-04 18:36:48 -07:00
@@ -59,7 +59,7 @@
 	$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
 	
 binrpm-pkg: $(objtree)/binkernel.spec
-	$(MAKE)
+	$(MAKE) KBUILD_SRC=
 	set -e; \
 	$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
 	set -e; \
@@ -74,7 +74,7 @@
 #
 .PHONY: deb-pkg
 deb-pkg:
-	$(MAKE)
+	$(MAKE) KBUILD_SRC=
 	$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
 
 clean-dirs += $(objtree)/debian/
diff -Nru a/scripts/package/builddeb b/scripts/package/builddeb
--- a/scripts/package/builddeb	2005-04-04 18:36:48 -07:00
+++ b/scripts/package/builddeb	2005-04-04 18:36:48 -07:00
@@ -14,18 +14,38 @@
 # Some variables and settings used throughout the script
 version=$KERNELRELEASE
 tmpdir="$objtree/debian/tmp"
+packagename=linux-$version
+
+if [ "$ARCH" == "um" ] ; then
+	packagename=user-mode-linux-$version
+fi
 
 # Setup the directory structure
 rm -rf "$tmpdir"
 mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
+if [ "$ARCH" == "um" ] ; then
+	mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin"
+fi
 
 # Build and install the kernel
-cp System.map "$tmpdir/boot/System.map-$version"
-cp .config "$tmpdir/boot/config-$version"
-cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
+if [ "$ARCH" == "um" ] ; then
+	$MAKE linux
+	cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
+	cp .config "$tmpdir/usr/share/doc/$packagename/config"
+	gzip "$tmpdir/usr/share/doc/$packagename/config"
+	cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version"
+else 
+	cp System.map "$tmpdir/boot/System.map-$version"
+	cp .config "$tmpdir/boot/config-$version"
+	cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
+fi
 
 if grep -q '^CONFIG_MODULES=y' .config ; then
-	INSTALL_MOD_PATH="$tmpdir" make modules_install
+	INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install
+	if [ "$ARCH" == "um" ] ; then
+		mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
+		rmdir "$tmpdir/lib/modules/$version"
+	fi
 fi
 
 # Install the maintainer scripts
@@ -53,6 +73,8 @@
 EOF
 
 # Generate a control file
+if [ "$ARCH" == "um" ]; then
+
 cat <<EOF > debian/control
 Source: linux
 Section: base
@@ -60,12 +82,34 @@
 Maintainer: $name
 Standards-Version: 3.6.1
 
-Package: linux-$version
+Package: $packagename
+Architecture: any
+Description: User Mode Linux kernel, version $version
+ User-mode Linux is a port of the Linux kernel to its own system call
+ interface.  It provides a kind of virtual machine, which runs Linux
+ as a user process under another Linux kernel.  This is useful for
+ kernel development, sandboxes, jails, experimentation, and
+ many other things.
+ .
+ This package contains the Linux kernel, modules and corresponding other
+ files version $version
+EOF
+
+else
+cat <<EOF > debian/control
+Source: linux
+Section: base
+Priority: optional
+Maintainer: $name
+Standards-Version: 3.6.1
+
+Package: $packagename
 Architecture: any
 Description: Linux kernel, version $version
  This package contains the Linux kernel, modules and corresponding other
- files version $version.
+ files version $version
 EOF
+fi
 
 # Fix some ownership and permissions
 chown -R root:root "$tmpdir"
diff -Nru a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl
--- a/scripts/reference_discarded.pl	2005-04-04 18:36:48 -07:00
+++ b/scripts/reference_discarded.pl	2005-04-04 18:36:48 -07:00
@@ -96,6 +96,7 @@
 		     $from !~ /\.debug_ranges$/ &&
 		     $from !~ /\.debug_line$/ &&
 		     $from !~ /\.debug_frame$/ &&
+		     $from !~ /\.debug_loc$/ &&
 		     $from !~ /\.exitcall\.exit$/ &&
 		     $from !~ /\.eh_frame$/ &&
 		     $from !~ /\.stab$/)) {
diff -Nru a/scripts/reference_init.pl b/scripts/reference_init.pl
--- a/scripts/reference_init.pl	2005-04-04 18:36:48 -07:00
+++ b/scripts/reference_init.pl	2005-04-04 18:36:48 -07:00
@@ -98,6 +98,7 @@
 		     $from !~ /\.pdr$/ &&
 		     $from !~ /\__param$/ &&
 		     $from !~ /\.altinstructions/ &&
+		     $from !~ /\.eh_frame/ &&
 		     $from !~ /\.debug_/)) {
 			printf("Error: %s %s refers to %s\n", $object, $from, $line);
 		}
diff -Nru a/scripts/setlocalversion b/scripts/setlocalversion
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/scripts/setlocalversion	2005-04-04 18:36:48 -07:00
@@ -0,0 +1,119 @@
+#!/usr/bin/perl
+# Copyright 2004 - Ryan Anderson <ryan@michonline.com>  GPL v2
+
+use strict;
+use warnings;
+use Digest::MD5;
+require 5.006;
+
+if (@ARGV != 1) {
+	print <<EOT;
+Usage: setlocalversion <srctree>
+EOT
+	exit(1);
+}
+
+my ($srctree) = @ARGV;
+chdir($srctree);
+
+my @LOCALVERSIONS = ();
+
+# BitKeeper Version Checks
+
+# We are going to use the following commands to try and determine if this
+# repository is at a Version boundary (i.e, 2.6.10 vs 2.6.10 + some patches) We
+# currently assume that all meaningful version boundaries are marked by a tag.
+# We don't care what the tag is, just that something exists.
+#
+# The process is as follows:
+#
+# 1. Get the key of the top of tree changeset:
+# 	cset=`bk changes -r+ -k`
+#    This will be something like:
+#    bunk@stusta.de[torvalds]|ChangeSet|20050314010036|43252
+#
+# 2. Get the tag, if any, associated with it:
+#       bk prs -h -d':TAG:\n' -r$cset
+#
+# 3. If no such tag exists, take the hex-encoded md5sum of the
+# changeset key, extract the first 8 characters of it, and add
+# -BK and the above 8 characters to the end of the version.
+
+sub do_bk_checks {
+	my $changeset = `bk changes -r+ -k`;
+	chomp $changeset; # strip trailing \n safely
+	my $tag = `bk prs -h -d':TAG:' -r'$changeset'`;
+
+	if (length($tag) == 0) {
+		# There is no tag at the Top of Tree changeset, so this is not
+		# a release tree.  To distinguish this from the previous
+		# release tree, something must be appended to the version to
+		# distinguish it.  
+		
+		# The changeset key in $changeset is unique, but unsuitable for
+		# direct use as a version, so semi-randomly mangle it using a
+		# MD5 hash.
+		my $localversion = Digest::MD5::md5_hex($changeset);
+		$localversion = substr($localversion,0,8);
+
+		push @LOCALVERSIONS, "BK" . $localversion;
+	}
+}
+
+# The BK->CVS gateway puts all tag information
+# in the file "ChangeSet", a 0-byte file.
+# The canonical top-of-tree can be found by looking at
+# the working revision of this file, and comparing that
+# to the version of the first tag encountered.
+#
+# On this check, there is no real need for a MD5 hash, so
+# the revision number is used directly.
+sub do_cvs_checks {
+	my $status = `LANG=C cvs status -v ChangeSet`;
+	my @lines = split /\n/, $status;
+
+	my ($working_revision,$revision_of_first_tag, $foundtag);
+	$foundtag = 0;
+	
+	foreach my $l (@lines) {
+		if ($l =~ m/Working revision:\W+(\d+\.\d+)\W/) {
+			$working_revision = $1;
+			next;
+		}
+
+		if ($l =~ m/Existing Tags:/) {
+			$foundtag = 1;
+			next;
+		}
+
+		if ($foundtag && $l =~ m/revision:\W+(\d+\.\d+)\)/) {
+			$revision_of_first_tag = $1;
+			last;
+		}
+	}
+
+	if ($working_revision != $revision_of_first_tag) {
+		push @LOCALVERSIONS, "cvs",$working_revision;
+	}
+	
+
+}
+
+
+if ( -d "BitKeeper" ) {
+	my $bk = `which bk`;
+	chomp $bk;
+	if (length($bk) != 0) {
+		do_bk_checks();
+	}
+}
+
+if ( -d "CVS" ) {
+	my $cvs = `which cvs`;
+	chomp $cvs;
+	if (length($cvs) != 0) {
+		do_cvs_checks();
+	}
+}
+
+printf "-%s\n", join("-",@LOCALVERSIONS) if (scalar @LOCALVERSIONS > 0);