bk://linux-sam.bkbits.net/kbuild sam@mars.ravnborg.org|ChangeSet|20040906204443|55631 sam # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/09/06 22:44:43+02:00 sam@mars.ravnborg.org # kbuild: Drop use of built-in.o in top level makefile # # built-in.o were introduced in top-level Makefile to saves us from # linking the same .o files several times when kallsyms were enabled. # Unfortunately this caused a hard lock-up on x86_64 - so this patch drops # built-in.o again. Please note is was working on i386. # # This patch also fixes some wording/spellings noticed by: Horst von Brand # # Signed-off-by: Sam Ravnborg # # Makefile # 2004/09/06 22:44:26+02:00 sam@mars.ravnborg.org +15 -23 # Drop use og intermidiate step (built-in.o) # # ChangeSet # 2004/09/06 20:22:17+02:00 sam@mars.ravnborg.org # kbuild: Enable compile after localversion change # # Last minute change to localversion patch were faulty. # filechk needs a valid '$^' file. In this case unused but make sure to supply one. # # Signed-off-by: Sam Ravnborg # # Makefile # 2004/09/06 20:22:01+02:00 sam@mars.ravnborg.org +1 -1 # Fix brown paper bag bug - filechk needs a valid $^ file. # # ChangeSet # 2004/09/05 15:42:40-07:00 akpm@bix.(none) # Merge # # init/Kconfig # 2004/09/05 15:42:36-07:00 akpm@bix.(none) +0 -0 # SCCS merged # # ChangeSet # 2004/09/05 22:16:38+02:00 elenstev@mesatop.com # scripts: Update ver_linux for recent reiserfsprogs # # The ver_linux script is fixed to report recent versions of # reiserfsprogs. (Older versions had "reiserfsprogs" in the # line containing the version number, while recent versions # report "reiserfsck" followed by version number). # # The ver_linux script is updated to report the reiser4progs # version number. # # This was tested with reiserfsprogs 3.6.11, 3.6.18 and # reiser4progs 1.0.0. # # Signed-off-by: Steven Cole # Signed-off-by: Sam Ravnborg # # scripts/ver_linux # 2004/09/05 22:16:19+02:00 elenstev@mesatop.com +5 -2 # scripts: Update ver_linux for recent reiserfsprogs # # ChangeSet # 2004/09/05 22:02:17+02:00 sam@mars.ravnborg.org # kbuild: Simplify generating vmlinux # # Generating vmlinux in top-level Makefile were getting a bit messy after kallsyms # support were added. Also the full link of all the .o files were duplicaed a number of times. # This patch does the following: # - Introduce built-in.o which is a prelink of most .o files # - Make the build process a bit more verbose telling when linking .tmpvmlinux* # - Use less magic when determing when to generate a new version # - Allow architectures to override the defineition of cmd_vmlinux__ # - Add more comments to the MAkefile and clean up soem other comments # - Display more commends during V=1 builds # # The resulting kernel boots and rn here. # # Signed-off-by: Sam Ravnborg # # Makefile # 2004/09/05 22:02:00+02:00 sam@mars.ravnborg.org +130 -89 # Simplify generating vmlinux # # ChangeSet # 2004/09/05 21:54:23+02:00 ianw@gelato.unsw.edu.au # kbuild: Support LOCALVERSION # # Add LOCALVERSION so we can append strings that show up in uname # without having to fiddle with the Makefile and EXTRAVERSION, etc. # # * localversion* files are read first # * config variable is appended last # * LOCALVERSION from the command line overrides all of this # * check is forced on build, since we can't really know when # the config or environment options change. # # Signed-off-by: Ian Wienand # Signed-off-by: Sam Ravnborg # # init/Kconfig # 2004/09/05 21:32:47+02:00 ianw@gelato.unsw.edu.au +10 -0 # kbuild: Support LOCALVERSION # # Makefile # 2004/09/05 21:38:41+02:00 ianw@gelato.unsw.edu.au +24 -6 # kbuild: Support LOCALVERSION # # ChangeSet # 2004/09/05 21:53:04+02:00 bgerst@quark.didntduck.org # kbuild: use KERNELRELEASE # # This patch changes several places where the kernel version string is put # together from it's components with $KERNELRELEASE. # # From: Brian Gerst # Signed-off-by: Sam Ravnborg # # scripts/package/mkspec # 2004/09/04 00:25:40+02:00 bgerst@quark.didntduck.org +8 -8 # kbuild: use KERNELRELEASE # # scripts/package/builddeb # 2004/09/04 00:30:52+02:00 bgerst@quark.didntduck.org +1 -1 # kbuild: use KERNELRELEASE # # scripts/kconfig/gconf.c # 2004/09/04 00:36:18+02:00 bgerst@quark.didntduck.org +2 -3 # kbuild: use KERNELRELEASE # # arch/arm26/boot/Makefile # 2004/09/04 00:34:51+02:00 bgerst@quark.didntduck.org +2 -2 # kbuild: use KERNELRELEASE # # ChangeSet # 2004/09/01 22:08:21+02:00 blaisorblade_spam@yahoo.it # kbuild: Set cflags before including arch Makefile # # Please note that this patch, even if UML-related, should be immediately # discussed for merging in mainline, if possible. The UML patch to handle # this has therefore been separated. # # Patch purpose: # If arch/$(ARCH)/Makefile is included before adding -O2 (and the rest) to # CFLAGS, I must duplicate the addition of it to USER_CFLAGS for UML. # So let's fix this. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Sam Ravnborg # # Makefile # 2004/08/29 14:40:50+02:00 blaisorblade_spam@yahoo.it +9 -9 # kbuild: Set cflags before including arch Makefile # # ChangeSet # 2004/09/01 21:54:53+02:00 sam@mars.ravnborg.org # kbuild: Remove last signs of LDFLAGS_BLOB # # From: Paolo 'Blaisorblade' Giarrusso # The LDFLAGS_BLOB var (which used to be defined in arch Makefiles) is now unused,as specified inside usr/initramfs_data.S. So this patch removes the remaining # references. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Sam Ravnborg # # arch/um/Makefile-i386 # 2004/09/01 21:54:35+02:00 sam@mars.ravnborg.org +0 -1 # Remove LD_FLAGS_BLOB # # arch/cris/Makefile # 2004/09/01 21:54:35+02:00 sam@mars.ravnborg.org +0 -2 # Remove LD_FLAGS_BLOB # # arch/arm26/Makefile # 2004/09/01 21:54:35+02:00 sam@mars.ravnborg.org +0 -2 # Remove LD_FLAGS_BLOB # # arch/arm/Makefile # 2004/09/01 21:54:35+02:00 sam@mars.ravnborg.org +0 -1 # Remove LD_FLAGS_BLOB # # Makefile # 2004/09/01 21:54:35+02:00 sam@mars.ravnborg.org +1 -1 # Remove LD_FLAGS_BLOB # # Documentation/kbuild/makefiles.txt # 2004/09/01 21:54:35+02:00 sam@mars.ravnborg.org +0 -9 # Remove LD_FLAGS_BLOB # # ChangeSet # 2004/08/31 21:36:26+02:00 sam@mars.ravnborg.org # kbuild: Fix modules_install # # modules_install failed for modules with 'ko' in their name. # Fixes this. # # Signed-off-by: Sam Ravnborg # # scripts/Makefile.modinst # 2004/08/31 21:36:09+02:00 sam@mars.ravnborg.org +1 -1 # Fix installing of modules with ko in their name - do not find too many filenames in $(MODVERDIR) # # ChangeSet # 2004/08/30 21:23:24+02:00 sam@mars.ravnborg.org # kbuild: Add stactic analyser tools to make help # # Added the tools that seems to be maintained. # There is a bunch that has not been touched for a while - ignore them for now. # # Signed-off-by: Sam Ravnborg # # Makefile # 2004/08/30 21:23:05+02:00 sam@mars.ravnborg.org +9 -3 # Updated help and use $(srctree) as replacement for $(src) # # ChangeSet # 2004/08/30 20:51:06+02:00 sam@mars.ravnborg.org # kbuild: Updates to namespacecheck.pl # # From: Keith Owens # # This now supports the absolute symbols from modversions, handles # recent binutils changes and supports O=. # # Signed-off-by: Keith Owens # Signed-off-by: Sam Ravnborg # # scripts/namespace.pl # 2004/08/30 20:50:49+02:00 sam@mars.ravnborg.org +86 -53 # This now supports the absolute symbols from modversions, handles # recent binutils changes and supports O=. # # ChangeSet # 2004/08/30 20:38:47+02:00 sam@mars.ravnborg.org # bk: Ignore arch/i386/kernel/vsyscall.lds # # Signed-off-by: Sam Ravnborg # # BitKeeper/etc/ignore # 2004/08/30 20:37:31+02:00 sam@mars.ravnborg.org +1 -0 # added arch/i386/kernel/vsyscall.lds # # ChangeSet # 2004/08/30 20:34:05+02:00 sam@mars.ravnborg.org # kbuild: fix stage 2 of module build # # When building allmodconfig the following error were seen: # scripts/Makefile.modpost:86: target `fs/nls/nls_koi8-ru.ko' given more than once in the same rule. # This happened for all modules with 'ko' inside their name. # This bug were introduced when head ... were replaced by grep. # # Signed off by: Sam Ravnborg # # scripts/Makefile.modpost # 2004/08/30 20:33:49+02:00 sam@mars.ravnborg.org +1 -1 # grep .ko would match any string with ko in it. # Limit this to strings with the suffix .ko # # ChangeSet # 2004/08/29 10:17:02+02:00 kaos@ocs.com.au # kbuild: Add 'make namespacecheck' # # make namespacecheck lists globally visible symbols that are not used # outside the file that defines them. These symbols are candidates for # static declarations. It also lists multiply defined symbols. # namespace.pl knows about lots of special cases in the kernel code, # including exported symbols and conglomerate objects. # # The patch also corrects the usage of scripts/reference*.pl, they need # $(src). # # Signed-off-by: Keith Owens # Signed-off-by: Sam Ravnborg # # Index: 2.6.9-rc1/Makefile # =================================================================== # # Makefile # 2004/08/29 09:27:51+02:00 kaos@ocs.com.au +5 -2 # kbuild: Add 'make namespacecheck' # # scripts/namespace.pl # 2004/08/29 09:53:21+02:00 kaos@ocs.com.au +416 -0 # kbuild: Add 'make namespacecheck' # # scripts/namespace.pl # 2004/08/29 09:53:21+02:00 kaos@ocs.com.au +0 -0 # BitKeeper file /home/sam/bk/kbuild/scripts/namespace.pl # # ChangeSet # 2004/08/29 09:32:19+02:00 trini@kernel.crashing.org # kbuild: Solaris fixes in various kbuild Makfiles's # # Additional Makefile fixes for Solaris 2.8 # # On Solaris, 'head' doesn't take a -q argument. But we can use 'grep -h' # instead, so do that in Makefile.mod{inst,post}. The built-in test to # /bin/sh doesn't like 'if ! cmd' syntax, so when determining if we need # to do modversion stuff, invert the if/else cases. The built-in test # also doesn't understand -ef, so invoke a real version of test which does. # # Signed-off-by: Tom Rini # Signed-off-by: Sam Ravnborg # # scripts/Makefile.modpost # 2004/08/27 23:47:07+02:00 trini@kernel.crashing.org +1 -1 # kbuild: Solaris fixes in various kbuild Makfiles's # # scripts/Makefile.modinst # 2004/08/27 23:47:07+02:00 trini@kernel.crashing.org +1 -1 # kbuild: Solaris fixes in various kbuild Makfiles's # # scripts/Makefile.build # 2004/08/27 23:47:07+02:00 trini@kernel.crashing.org +3 -3 # kbuild: Solaris fixes in various kbuild Makfiles's # # Makefile # 2004/08/27 23:47:07+02:00 trini@kernel.crashing.org +4 -4 # kbuild: Solaris fixes in various kbuild Makfiles's # # ChangeSet # 2004/08/29 09:31:53+02:00 trini@kernel.crashing.org # kbuild: Use getopt_long in genksyms only when available # # Use getopt_long() or getopt(), depending on the host # # From: Jean-Christophe Dubois . # # We do not always have GNU getopt_long(), so when we don't, just use # getopt() and the short options. We do this based on __GNU_LIBRARY__ # being set, or not. Originally from Jean-Christophe Dubois . # # Signed-off-by: Tom Rini # Signed-off-by: Sam Ravnborg # # scripts/genksyms/genksyms.c # 2004/08/27 23:47:06+02:00 trini@kernel.crashing.org +15 -0 # kbuild: Use getopt_long in genksyms only when available # # ChangeSet # 2004/08/29 09:31:26+02:00 trini@kernel.crashing.org # kbuild: Use inttypes.h when stdint.h are not available # # The following is from Jean-Christophe Dubois . # On Solaris 2.8, does not exist, but does. # However, on Cygwin (the other odd place that the kernel is compiled # on) doesn't exist. So we end up testing for __sun__ and # using there, and everywhere else. # # Signed-off-by: Tom Rini # Signed-off-by: Sam Ravnborg # # scripts/mod/sumversion.c # 2004/08/27 23:29:36+02:00 trini@kernel.crashing.org +4 -0 # kbuild: Use inttypes.h when stdint.h are not available # # arch/ppc/boot/utils/mktree.c # 2004/08/27 23:29:36+02:00 trini@kernel.crashing.org +4 -0 # kbuild: Use inttypes.h when stdint.h are not available # # arch/ppc/boot/utils/mkbugboot.c # 2004/08/27 23:29:36+02:00 trini@kernel.crashing.org +6 -6 # kbuild: Use inttypes.h when stdint.h are not available # diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt --- a/Documentation/kbuild/makefiles.txt 2004-09-06 17:50:45 -07:00 +++ b/Documentation/kbuild/makefiles.txt 2004-09-06 17:50:45 -07:00 @@ -664,15 +664,6 @@ #arch/i386/Makefile LDFLAGS_vmlinux := -e stext - LDFLAGS_BLOB Options for $(LD) when linking the initramfs blob - - The image used for initramfs is made during the build process. - LDFLAGS_BLOB is used to specify additional flags to be used when - creating the initramfs_data.o file. - Example: - #arch/i386/Makefile - LDFLAGS_BLOB := --format binary --oformat elf32-i386 - OBJCOPYFLAGS objcopy flags When $(call if_changed,objcopy) is used to translate a .o file, diff -Nru a/Makefile b/Makefile --- a/Makefile 2004-09-06 17:50:45 -07:00 +++ b/Makefile 2004-09-06 17:50:45 -07:00 @@ -141,7 +141,25 @@ export srctree objtree VPATH TOPDIR -KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) +nullstring := +space := $(nullstring) # end of line + +# Take the contents of any files called localversion* and the config +# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. Be +# careful not to include files twice if building in the source +# directory. LOCALVERSION from the command line override all of this + +ifeq ($(objtree),$(srctree)) +localversion-files := $(wildcard $(srctree)/localversion*) +else +localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*) +endif + +LOCALVERSION = $(subst $(space),, \ + $(shell cat /dev/null $(localversion-files)) \ + $(subst ",,$(CONFIG_LOCALVERSION))) + +KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION) # SUBARCH tells the usermode build what the underlying arch is. That is set # first, and if a usermode build is happening, the "ARCH=um" on the command @@ -329,10 +347,10 @@ -fno-strict-aliasing -fno-common AFLAGS := -D__ASSEMBLY__ -export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ - CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ +export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION LOCALVERSION KERNELRELEASE \ + ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ - HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK CHECKFLAGS + HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE @@ -456,15 +474,6 @@ include/linux/autoconf.h: ; endif -include $(srctree)/arch/$(ARCH)/Makefile - -# Default kernel image to build when no specific target is given. -# KBUILD_IMAGE may be overruled on the commandline or -# set in the environment -# Also any assingments in arch/$(ARCH)/Makefiel take precedence over -# this default value -export KBUILD_IMAGE ?= vmlinux - # The all: target is the default when no target is given on the # command line. # This allow a user to issue only 'make' to build a kernel including modules @@ -488,6 +497,15 @@ # warn about C99 declaration after statement CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) +include $(srctree)/arch/$(ARCH)/Makefile + +# Default kernel image to build when no specific target is given. +# KBUILD_IMAGE may be overruled on the commandline or +# set in the environment +# Also any assingments in arch/$(ARCH)/Makefiel take precedence over +# this default value +export KBUILD_IMAGE ?= vmlinux + # # INSTALL_PATH specifies where to place the updated kernel and system map # images. Uncomment if you want to place them anywhere other than root. @@ -527,67 +545,94 @@ # Build vmlinux # --------------------------------------------------------------------------- +# vmlinux is build from the objects selected by $(vmlinux-init) and +# $(vmlinux-main). Most are built-in.o files from top-level directories +# in the kernel tree, others are specified in arch/$(ARCH)Makefile. +# Ordering when linking is important, and $(vmlinux-init) must be first. +# +# vmlinux +# ^ +# | +# +-< $(vmlinux-init) +# | +--< init/version.o + more +# | +# +--< $(vmlinux-main) +# | +--< driver/built-in.o mm/built-in.o + more +# | +# +-< kallsyms.o (see description in CONFIG_KALLSYMS section) +# +# vmlinux version (uname -v) cannot be updated during normal +# descending-into-subdirs phase since we do not yet know if we need to +# update vmlinux. +# Therefore this step is delayed until just before final link of vmlinux - +# except in the kallsyms case where it is done just before adding the +# symbols to the kernel. +# +# System.map is generated to document addresses of all kernel symbols -# This is a bit tricky: If we need to relink vmlinux, we want -# the version number incremented, which means recompile init/version.o -# and relink init/init.o. However, we cannot do this during the -# normal descending-into-subdirs phase, since at that time -# we cannot yet know if we will need to relink vmlinux. -# So we descend into init/ inside the rule for vmlinux again. -vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y) - -quiet_cmd_vmlinux__ = LD $@ -define cmd_vmlinux__ - $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \ - --start-group \ - $(core-y) \ - $(libs-y) \ - $(drivers-y) \ - $(net-y) \ - --end-group \ - $(filter .tmp_kallsyms%,$^) \ - -o $@ -endef +vmlinux-init := $(head-y) $(init-y) +vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y) +vmlinux-all := $(vmlinux-init) $(vmlinux-main) +vmlinux-lds := arch/$(ARCH)/kernel/vmlinux.lds + +# Rule to link vmlinux - also used during CONFIG_KALLSYMS +# May be overridden by arch/$(ARCH)/Makefile +# Require first prerequisite to be the lds file +quiet_cmd_vmlinux__ = LD $@ + cmd_vmlinux__ = $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \ + -T $(vmlinux-lds) $(vmlinux-init) \ + --start-group $(vmlinux-main) --end-group \ + $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^) + +# Generate new vmlinux version +quiet_cmd_vmlinux_version = GEN .version + cmd_vmlinux_version = set -e; \ + . $(srctree)/scripts/mkversion > .tmp_version; \ + mv -f .tmp_version .version; \ + $(MAKE) $(build)=init + +# Generate System.map +quiet_cmd_sysmap = SYSMAP + cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap -# set -e makes the rule exit immediately on error +# Link of vmlinux +# If CONFIG_KALLSYMS is set .version is already updated +# Generate System.map and verify that the content is consistent define rule_vmlinux__ - +set -e; \ - $(if $(filter .tmp_kallsyms%,$^),, \ - echo ' GEN .version'; \ - . $(srctree)/scripts/mkversion > .tmp_version; \ - mv -f .tmp_version .version; \ - $(MAKE) $(build)=init; \ - ) \ - $(if $($(quiet)cmd_vmlinux__), \ - echo ' $($(quiet)cmd_vmlinux__)' &&) \ - $(cmd_vmlinux__); \ - echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd + $(if $(CONFIG_KALLSYMS),,$(call cmd,vmlinux_version)) + + $(call cmd,vmlinux__) + $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd + + $(Q)$(if $($(quiet)cmd_sysmap), \ + echo ' $($(quiet)cmd_sysmap) System.map' &&) \ + $(cmd_sysmap) $@ System.map; \ + if [ $$? -ne 0 ]; then \ + rm -f $@; \ + /bin/false; \ + fi; + $(verify_kallsyms) endef -quiet_cmd_sysmap = SYSMAP - cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap - -LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds - -# Generate section listing all symbols and add it into vmlinux -# It's a three stage process: -# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is -# empty -# Running kallsyms on that gives us .tmp_kallsyms1.o with -# the right size -# o .tmp_vmlinux2 now has a __kallsyms section of the right size, -# but due to the added section, some addresses have shifted -# From here, we generate a correct .tmp_kallsyms2.o -# o The correct .tmp_kallsyms2.o is linked into the final vmlinux. -# o Verify that the System.map from vmlinux matches the map from -# .tmp_vmlinux2, just in case we did not generate kallsyms correctly. -# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using -# .tmp_vmlinux3 and .tmp_kallsyms3.o. This is only meant as a -# temporary bypass to allow the kernel to be built while the -# maintainers work out what went wrong with kallsyms. ifdef CONFIG_KALLSYMS +# Generate section listing all symbols and add it into vmlinux $(kallsyms.o) +# It's a three stage process: +# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is +# empty +# Running kallsyms on that gives us .tmp_kallsyms1.o with +# the right size - vmlinux version (uname -v) is updated during this step +# o .tmp_vmlinux2 now has a __kallsyms section of the right size, +# but due to the added section, some addresses have shifted. +# From here, we generate a correct .tmp_kallsyms2.o +# o The correct .tmp_kallsyms2.o is linked into the final vmlinux. +# o Verify that the System.map from vmlinux matches the map from +# .tmp_vmlinux2, just in case we did not generate kallsyms correctly. +# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using +# .tmp_vmlinux3 and .tmp_kallsyms3.o. This is only meant as a +# temporary bypass to allow the kernel to be built while the +# maintainers work out what went wrong with kallsyms. ifdef CONFIG_KALLSYMS_EXTRA_PASS last_kallsyms := 3 @@ -597,16 +642,28 @@ kallsyms.o := .tmp_kallsyms$(last_kallsyms).o -define rule_verify_kallsyms +define verify_kallsyms $(Q)$(if $($(quiet)cmd_sysmap), \ echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \ $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map - $(Q)cmp -s System.map .tmp_System.map || \ - (echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false) + $(Q)cmp -s System.map .tmp_System.map || \ + (echo Inconsistent kallsyms data; \ + echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \ + rm .tmp_kallsyms* ; /bin/false ) +endef + +# Update vmlinux version before link +cmd_ksym_ld = $(cmd_vmlinux__) +define rule_ksym_ld + $(call cmd,vmlinux_version) + $(call cmd,vmlinux__) + $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd endef +# Generate .S file with all kernel symbols quiet_cmd_kallsyms = KSYM $@ -cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ + cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \ + $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE $(call if_changed_dep,as_o_S) @@ -614,43 +671,28 @@ .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS) $(call cmd,kallsyms) -.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds FORCE - $(call if_changed_rule,vmlinux__) +# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version +.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE + $(call if_changed_rule,ksym_ld) -.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/kernel/vmlinux.lds FORCE - $(call if_changed_rule,vmlinux__) +.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE + $(call if_changed,vmlinux__) -.tmp_vmlinux3: $(vmlinux-objs) .tmp_kallsyms2.o arch/$(ARCH)/kernel/vmlinux.lds FORCE - $(call if_changed_rule,vmlinux__) +.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE + $(call if_changed,vmlinux__) # Needs to visit scripts/ before $(KALLSYMS) can be used. $(KALLSYMS): scripts ; -endif - -# Finally the vmlinux rule -# This rule is also used to generate System.map -# and to verify that the content of kallsyms are consistent - -define rule_vmlinux - $(rule_vmlinux__); - $(Q)$(if $($(quiet)cmd_sysmap), \ - echo ' $($(quiet)cmd_sysmap) System.map' &&) \ - $(cmd_sysmap) $@ System.map; \ - if [ $$? -ne 0 ]; then \ - rm -f $@; \ - /bin/false; \ - fi; - $(rule_verify_kallsyms) -endef - -vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds FORCE - $(call if_changed_rule,vmlinux) +endif # ifdef CONFIG_KALLSYMS -# The actual objects are generated when descending, -# make sure no implicit rule kicks in +# vmlinux image - including updated kernel symbols +vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE + $(call if_changed_rule,vmlinux__) -$(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds: $(vmlinux-dirs) ; +# The actual objects are generated when descending, +# make sure no implicit rule kicks in +$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; # Handle descending into subdirectories listed in $(vmlinux-dirs) # Preset locale variables to speed up the build process. Limit locale @@ -673,10 +715,10 @@ # using a seperate output directory. This allows convinient use # of make in output directory prepare2: - $(Q)if [ ! $(srctree) -ef $(objtree) ]; then \ - $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ - $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \ - > $(objtree)/Makefile; \ + $(Q)if /usr/bin/env test ! $(srctree) -ef $(objtree); then \ + $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ + $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \ + > $(objtree)/Makefile; \ fi # prepare1 is used to check if we are building in a separate output directory, @@ -747,8 +789,8 @@ # Generate some files # --------------------------------------------------------------------------- -# version.h changes when $(KERNELRELEASE) etc change, as defined in -# this Makefile +# KERNELRELEASE can change from a few different places, meaning version.h +# needs to be updated, so this check is forced on all builds uts_len := 64 @@ -763,7 +805,7 @@ ) endef -include/linux/version.h: Makefile +include/linux/version.h: $(srctree)/Makefile FORCE $(call filechk,version.h) # --------------------------------------------------------------------------- @@ -963,7 +1005,13 @@ @echo ' rpm - Build a kernel as an RPM package' @echo ' tags/TAGS - Generate tags file for editors' @echo ' cscope - Generate cscope index' + @echo '' + @echo 'Static analysers' + @echo ' buildcheck - List dangling references to vmlinux discarded sections' + @echo ' and init sections from non-init sections' @echo ' checkstack - Generate a list of stack hogs' + @echo ' namespacecheck - Name space analysis on compiled kernel' + @echo '' @echo 'Kernel packaging:' @$(MAKE) -f $(package-dir)/Makefile help @echo '' @@ -1123,8 +1171,11 @@ | xargs $(PERL) -w scripts/checkversion.pl buildcheck: - $(PERL) scripts/reference_discarded.pl - $(PERL) scripts/reference_init.pl + $(PERL) $(srctree)/scripts/reference_discarded.pl + $(PERL) $(srctree)/scripts/reference_init.pl + +namespacecheck: + $(PERL) $(srctree)/scripts/namespace.pl endif #ifeq ($(config-targets),1) endif #ifeq ($(mixed-targets),1) @@ -1161,13 +1212,22 @@ include $(cmd_files) endif +# Execute command and generate cmd file +if_changed = $(if $(strip $? \ + $(filter-out $(cmd_$(1)),$(cmd_$@))\ + $(filter-out $(cmd_$@),$(cmd_$(1)))),\ + @set -e; \ + $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ + $(cmd_$(1)); \ + echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) + + # execute the command and also postprocess generated .d dependencies # file - if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ $(filter-out $(cmd_$(1)),$(cmd_$@))\ $(filter-out $(cmd_$@),$(cmd_$(1)))),\ - @set -e; \ + $(Q)set -e; \ $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ $(cmd_$(1)); \ scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ @@ -1181,7 +1241,7 @@ if_changed_rule = $(if $(strip $? \ $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ - @$(rule_$(1))) + $(Q)$(rule_$(1))) # If quiet is set, only print short version of command diff -Nru a/arch/arm/Makefile b/arch/arm/Makefile --- a/arch/arm/Makefile 2004-09-06 17:50:45 -07:00 +++ b/arch/arm/Makefile 2004-09-06 17:50:45 -07:00 @@ -8,7 +8,6 @@ # Copyright (C) 1995-2001 by Russell King LDFLAGS_vmlinux :=-p --no-undefined -X -LDFLAGS_BLOB :=--format binary CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) OBJCOPYFLAGS :=-O binary -R .note -R .comment -S GZFLAGS :=-9 diff -Nru a/arch/arm26/Makefile b/arch/arm26/Makefile --- a/arch/arm26/Makefile 2004-09-06 17:50:45 -07:00 +++ b/arch/arm26/Makefile 2004-09-06 17:50:45 -07:00 @@ -8,7 +8,6 @@ # Copyright (C) 1995-2001 by Russell King LDFLAGS_vmlinux :=-p -X -LDFLAGS_BLOB :=--format binary CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) OBJCOPYFLAGS :=-O binary -R .note -R .comment -S GZFLAGS :=-9 @@ -28,7 +27,6 @@ AFLAGS +=-mapcs-26 -mcpu=arm3 -mno-fpu -msoft-float -Wa,-mno-fpu head-y := arch/arm26/machine/head.o arch/arm26/kernel/init_task.o -LDFLAGS_BLOB += --oformat elf32-littlearm ifeq ($(CONFIG_XIP_KERNEL),y) TEXTADDR := 0x03880000 diff -Nru a/arch/arm26/boot/Makefile b/arch/arm26/boot/Makefile --- a/arch/arm26/boot/Makefile 2004-09-06 17:50:45 -07:00 +++ b/arch/arm26/boot/Makefile 2004-09-06 17:50:45 -07:00 @@ -67,12 +67,12 @@ install: $(obj)/Image $(CONFIG_SHELL) $(obj)/install.sh \ - $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \ + $(KERNELRELEASE) \ $(obj)/Image System.map "$(INSTALL_PATH)" zinstall: $(obj)/zImage $(CONFIG_SHELL) $(obj)/install.sh \ - $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \ + $(KERNELRELEASE) \ $(obj)/zImage System.map "$(INSTALL_PATH)" subdir- := compressed diff -Nru a/arch/cris/Makefile b/arch/cris/Makefile --- a/arch/cris/Makefile 2004-09-06 17:50:45 -07:00 +++ b/arch/cris/Makefile 2004-09-06 17:50:45 -07:00 @@ -24,8 +24,6 @@ endif LD = $(CROSS_COMPILE)ld -mcrislinux -LDFLAGS_BLOB := --format binary --oformat elf32-cris \ - -T arch/cris/$(SARCH)/output_arch.ld OBJCOPYFLAGS := -O binary -R .note -R .comment -S diff -Nru a/arch/ppc/boot/utils/mkbugboot.c b/arch/ppc/boot/utils/mkbugboot.c --- a/arch/ppc/boot/utils/mkbugboot.c 2004-09-06 17:50:45 -07:00 +++ b/arch/ppc/boot/utils/mkbugboot.c 2004-09-06 17:50:45 -07:00 @@ -1,5 +1,5 @@ /* - * arch/ppc/pp3boot/mkbugboot.c + * arch/ppc/boot/utils/mkbugboot.c * * Makes a Motorola PPCBUG ROM bootable image which can be flashed * into one of the FLASH banks on a Motorola PowerPlus board. @@ -21,6 +21,11 @@ #include #include #include +#ifdef __sun__ +#include +#else +#include +#endif #ifdef __i386__ #define cpu_to_be32(x) le32_to_cpu(x) @@ -48,11 +53,6 @@ /* size of read buffer */ #define SIZE 0x1000 - -/* typedef long int32_t; */ -typedef unsigned long uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; /* PPCBUG ROM boot header */ typedef struct bug_boot_header { diff -Nru a/arch/ppc/boot/utils/mktree.c b/arch/ppc/boot/utils/mktree.c --- a/arch/ppc/boot/utils/mktree.c 2004-09-06 17:50:45 -07:00 +++ b/arch/ppc/boot/utils/mktree.c 2004-09-06 17:50:45 -07:00 @@ -15,7 +15,11 @@ #include #include #include +#ifdef __sun__ +#include +#else #include +#endif /* This gets tacked on the front of the image. There are also a few * bytes allocated after the _start label used by the boot rom (see diff -Nru a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 --- a/arch/um/Makefile-i386 2004-09-06 17:50:45 -07:00 +++ b/arch/um/Makefile-i386 2004-09-06 17:50:45 -07:00 @@ -9,7 +9,6 @@ ELF_FORMAT = elf32-$(SUBARCH) OBJCOPYFLAGS := -O binary -R .note -R .comment -S -LDFLAGS_BLOB := --format binary --oformat elf32-i386 SYS_DIR := $(ARCH_DIR)/include/sysdep-i386 SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util diff -Nru a/init/Kconfig b/init/Kconfig --- a/init/Kconfig 2004-09-06 17:50:45 -07:00 +++ b/init/Kconfig 2004-09-06 17:50:45 -07:00 @@ -283,6 +283,16 @@ If unsure, say N. +config LOCALVERSION + string "Local Version" + help + Append an extra string to the end of your kernel version. + This will show up when you type uname, for example. + The string you set here will be appended after the contents of=20 + any files with a filename matching localversion* in your=20 + object and source tree, in that order. Your total string can + be a maximum of 64 characters. + config SHMEM default y bool "Use full shmem filesystem" if EMBEDDED && MMU diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build --- a/scripts/Makefile.build 2004-09-06 17:50:45 -07:00 +++ b/scripts/Makefile.build 2004-09-06 17:50:45 -07:00 @@ -160,9 +160,7 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< cmd_modversions = \ - if ! $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ - mv $(@D)/.tmp_$(@F) $@; \ - else \ + if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | $(GENKSYMS) \ > $(@D)/.tmp_$(@F:.o=.ver); \ @@ -170,6 +168,8 @@ $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ -T $(@D)/.tmp_$(@F:.o=.ver); \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ + else \ + mv $(@D)/.tmp_$(@F) $@; \ fi; endif diff -Nru a/scripts/Makefile.modinst b/scripts/Makefile.modinst --- a/scripts/Makefile.modinst 2004-09-06 17:50:45 -07:00 +++ b/scripts/Makefile.modinst 2004-09-06 17:50:45 -07:00 @@ -9,7 +9,7 @@ # -__modules := $(sort $(shell head -q -n1 /dev/null $(wildcard $(MODVERDIR)/*.mod))) +__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) .PHONY: $(modules) diff -Nru a/scripts/Makefile.modpost b/scripts/Makefile.modpost --- a/scripts/Makefile.modpost 2004-09-06 17:50:45 -07:00 +++ b/scripts/Makefile.modpost 2004-09-06 17:50:45 -07:00 @@ -41,7 +41,7 @@ symverfile := $(objtree)/Module.symvers # Step 1), find all modules listed in $(MODVERDIR)/ -__modules := $(sort $(shell head -q -n1 /dev/null $(wildcard $(MODVERDIR)/*.mod))) +__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) _modpost: $(modules) diff -Nru a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c --- a/scripts/genksyms/genksyms.c 2004-09-06 17:50:45 -07:00 +++ b/scripts/genksyms/genksyms.c 2004-09-06 17:50:45 -07:00 @@ -27,7 +27,9 @@ #include #include #include +#ifdef __GNU_LIBRARY__ #include +#endif /* __GNU_LIBRARY__ */ #include "genksyms.h" @@ -502,12 +504,21 @@ fputs("Usage:\n" "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n" "\n" +#ifdef __GNU_LIBRARY__ " -d, --debug Increment the debug level (repeatable)\n" " -D, --dump Dump expanded symbol defs (for debugging only)\n" " -w, --warnings Enable warnings\n" " -q, --quiet Disable warnings (default)\n" " -h, --help Print this message\n" " -V, --version Print the release version\n" +#else /* __GNU_LIBRARY__ */ + " -d Increment the debug level (repeatable)\n" + " -D Dump expanded symbol defs (for debugging only)\n" + " -w Enable warnings\n" + " -q Disable warnings (default)\n" + " -h Print this message\n" + " -V Print the release version\n" +#endif /* __GNU_LIBRARY__ */ , stderr); } @@ -516,6 +527,7 @@ { int o; +#ifdef __GNU_LIBRARY__ struct option long_opts[] = { {"debug", 0, 0, 'd'}, {"warnings", 0, 0, 'w'}, @@ -528,6 +540,9 @@ while ((o = getopt_long(argc, argv, "dwqVDk:p:", &long_opts[0], NULL)) != EOF) +#else /* __GNU_LIBRARY__ */ + while ((o = getopt(argc, argv, "dwqVDk:p:")) != EOF) +#endif /* __GNU_LIBRARY__ */ switch (o) { case 'd': diff -Nru a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c --- a/scripts/kconfig/gconf.c 2004-09-06 17:50:45 -07:00 +++ b/scripts/kconfig/gconf.c 2004-09-06 17:50:45 -07:00 @@ -275,9 +275,8 @@ /*"style", PANGO_STYLE_OBLIQUE, */ NULL); - sprintf(title, "Linux Kernel v%s.%s.%s%s Configuration", - getenv("VERSION"), getenv("PATCHLEVEL"), - getenv("SUBLEVEL"), getenv("EXTRAVERSION")); + sprintf(title, "Linux Kernel v%s Configuration", + getenv("KERNELRELEASE")); gtk_window_set_title(GTK_WINDOW(main_wnd), title); gtk_widget_show(main_wnd); diff -Nru a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c --- a/scripts/mod/sumversion.c 2004-09-06 17:50:45 -07:00 +++ b/scripts/mod/sumversion.c 2004-09-06 17:50:45 -07:00 @@ -1,5 +1,9 @@ #include +#ifdef __sun__ +#include +#else #include +#endif #include #include #include diff -Nru a/scripts/namespace.pl b/scripts/namespace.pl --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/scripts/namespace.pl 2004-09-06 17:50:45 -07:00 @@ -0,0 +1,449 @@ +#!/usr/bin/perl -w +# +# namespace.pl. Mon Aug 30 2004 +# +# Perform a name space analysis on the linux kernel. +# +# Copyright Keith Owens . GPL. +# +# Invoke by changing directory to the top of the kernel object +# tree then namespace.pl, no parameters. +# +# Tuned for 2.1.x kernels with the new module handling, it will +# work with 2.0 kernels as well. +# +# Last change 2.6.9-rc1, adding support for separate source and object +# trees. +# +# The source must be compiled/assembled first, the object files +# are the primary input to this script. Incomplete or missing +# objects will result in a flawed analysis. Compile both vmlinux +# and modules. +# +# Even with complete objects, treat the result of the analysis +# with caution. Some external references are only used by +# certain architectures, others with certain combinations of +# configuration parameters. Ideally the source should include +# something like +# +# #ifndef CONFIG_... +# static +# #endif +# symbol_definition; +# +# so the symbols are defined as static unless a particular +# CONFIG_... requires it to be external. +# +# A symbol that is suffixed with '(export only)' has these properties +# +# * It is global. +# * It is marked EXPORT_SYMBOL or EXPORT_SYMBOL_GPL, either in the same +# source file or a different source file. +# * Given the current .config, nothing uses the symbol. +# +# The symbol is a candidate for conversion to static, plus removal of the +# export. But be careful that a different .config might use the symbol. +# +# +# Name space analysis and cleanup is an iterative process. You cannot +# expect to find all the problems in a single pass. +# +# * Identify possibly unnecessary global declarations, verify that they +# really are unnecessary and change them to static. +# * Compile and fix up gcc warnings about static, removing dead symbols +# as necessary. +# * make clean and rebuild with different configs (especially +# CONFIG_MODULES=n) to see which symbols are being defined when the +# config does not require them. These symbols bloat the kernel object +# for no good reason, which is frustrating for embedded systems. +# * Wrap config sensitive symbols in #ifdef CONFIG_foo, as long as the +# code does not get too ugly. +# * Repeat the name space analysis until you can live with with the +# result. +# + +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 $srctree = ""; +my $objtree = ""; +$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'})); +$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'})); + +if ($#ARGV != -1) { + print STDERR "usage: $0 takes no parameters\n"; + die("giving up\n"); +} + +my %nmdata = (); # nm data for each object +my %def = (); # all definitions for each name +my %ksymtab = (); # names that appear in __ksymtab_ +my %ref = (); # $ref{$name} exists if there is a true external reference to $name +my %export = (); # $export{$name} exists if there is an EXPORT_... of $name + +&find(\&linux_objects, '.'); # find the objects and do_nm on them +&list_multiply_defined(); +&resolve_external_references(); +&list_extra_externals(); + +exit(0); + +sub linux_objects +{ + # Select objects, ignoring objects which are only created by + # merging other objects. Also ignore all of modules, scripts + # and compressed. Most conglomerate objects are handled by do_nm, + # this list only contains the special cases. These include objects + # that are linked from just one other object and objects for which + # there is really no permanent source file. + my $basename = $_; + $_ = $File::Find::name; + s:^\./::; + if (/.*\.o$/ && + ! ( + m:/built-in.o$: + || m:arch/i386/kernel/vsyscall-syms.o$: + || m:arch/ia64/ia32/ia32.o$: + || m:arch/ia64/kernel/gate-syms.o$: + || m:arch/ia64/lib/__divdi3.o$: + || m:arch/ia64/lib/__divsi3.o$: + || m:arch/ia64/lib/__moddi3.o$: + || m:arch/ia64/lib/__modsi3.o$: + || m:arch/ia64/lib/__udivdi3.o$: + || m:arch/ia64/lib/__udivsi3.o$: + || m:arch/ia64/lib/__umoddi3.o$: + || m:arch/ia64/lib/__umodsi3.o$: + || m:arch/ia64/scripts/check_gas_for_hint.o$: + || m:arch/ia64/sn/kernel/xp.o$: + || m:boot/bbootsect.o$: + || m:boot/bsetup.o$: + || m:/bootsect.o$: + || m:/boot/setup.o$: + || m:/compressed/: + || m:drivers/cdrom/driver.o$: + || m:drivers/char/drm/tdfx_drv.o$: + || m:drivers/ide/ide-detect.o$: + || m:drivers/ide/pci/idedriver-pci.o$: + || m:drivers/media/media.o$: + || m:drivers/scsi/sd_mod.o$: + || m:drivers/video/video.o$: + || m:fs/devpts/devpts.o$: + || m:fs/exportfs/exportfs.o$: + || m:fs/hugetlbfs/hugetlbfs.o$: + || m:fs/msdos/msdos.o$: + || m:fs/nls/nls.o$: + || m:fs/ramfs/ramfs.o$: + || m:fs/romfs/romfs.o$: + || m:fs/vfat/vfat.o$: + || m:init/mounts.o$: + || m:^modules/: + || m:net/netlink/netlink.o$: + || m:net/sched/sched.o$: + || m:/piggy.o$: + || m:^scripts/: + || m:sound/.*/snd-: + || m:^.*/\.tmp_: + || m:^\.tmp_: + || m:/vmlinux-obj.o$: + ) + ) { + do_nm($basename, $_); + } + $_ = $basename; # File::Find expects $_ untouched (undocumented) +} + +sub do_nm +{ + my ($basename, $fullname) = @_; + my ($source, $type, $name); + if (! -e $basename) { + printf STDERR "$basename does not exist\n"; + return; + } + if ($fullname !~ /\.o$/) { + printf STDERR "$fullname is not an object file\n"; + return; + } + ($source = $fullname) =~ s/\.o$//; + if (-e "$objtree$source.c" || -e "$objtree$source.S") { + $source = "$objtree$source"; + } else { + $source = "$srctree$source"; + } + if (! -e "$source.c" && ! -e "$source.S") { + # No obvious source, exclude the object if it is conglomerate + if (! open(OBJDUMPDATA, "$objdump $basename|")) { + printf STDERR "$objdump $fullname failed $!\n"; + return; + } + my $comment; + while () { + chomp(); + if (/^In archive/) { + # Archives are always conglomerate + $comment = "GCC:GCC:"; + last; + } + next if (! /^[ 0-9a-f]{5,} /); + $comment .= substr($_, 43); + } + close(OBJDUMPDATA); + if (!defined($comment) || $comment !~ /GCC\:.*GCC\:/m) { + printf STDERR "No source file found for $fullname\n"; + } + return; + } + if (! open(NMDATA, "$nm $basename|")) { + printf STDERR "$nm $fullname failed $!\n"; + return; + } + my @nmdata; + while () { + chop; + ($type, $name) = (split(/ +/, $_, 3))[1..2]; + # Expected types + # A absolute symbol + # B weak external reference to data that has been resolved + # C global variable, uninitialised + # D global variable, initialised + # G global variable, initialised, small data section + # R global array, initialised + # S global variable, uninitialised, small bss + # T global label/procedure + # U external reference + # W weak external reference to text that has been resolved + # a assembler equate + # b static variable, uninitialised + # d static variable, initialised + # g static variable, initialised, small data section + # r static array, initialised + # s static variable, uninitialised, small bss + # t static label/procedures + # w weak external reference to text that has not been resolved + # ? undefined type, used a lot by modules + if ($type !~ /^[ABCDGRSTUWabdgrstw?]$/) { + printf STDERR "nm output for $fullname contains unknown type '$_'\n"; + } + elsif ($name =~ /\./) { + # name with '.' is local static + } + else { + $type = 'R' if ($type eq '?'); # binutils replaced ? with R at one point + # binutils keeps changing the type for exported symbols, force it to R + $type = 'R' if ($name =~ /^__ksymtab/ || $name =~ /^__kstrtab/); + $name =~ s/_R[a-f0-9]{8}$//; # module versions adds this + if ($type =~ /[ABCDGRSTW]/ && + $name ne 'init_module' && + $name ne 'cleanup_module' && + $name ne 'Using_Versions' && + $name !~ /^Version_[0-9]+$/ && + $name !~ /^__parm_/ && + $name !~ /^__kstrtab/ && + $name !~ /^__ksymtab/ && + $name !~ /^__kcrctab_/ && + $name !~ /^__exitcall_/ && + $name !~ /^__initcall_/ && + $name !~ /^__kdb_initcall_/ && + $name !~ /^__kdb_exitcall_/ && + $name !~ /^__module_/ && + $name !~ /^__mod_/ && + $name !~ /^__crc_/ && + $name ne '__this_module' && + $name ne 'kernel_version') { + if (!exists($def{$name})) { + $def{$name} = []; + } + push(@{$def{$name}}, $fullname); + } + push(@nmdata, "$type $name"); + if ($name =~ /^__ksymtab_/) { + $name = substr($name, 10); + if (!exists($ksymtab{$name})) { + $ksymtab{$name} = []; + } + push(@{$ksymtab{$name}}, $fullname); + } + } + } + close(NMDATA); + if ($#nmdata < 0) { + if ( + $fullname ne "lib/brlock.o" + && $fullname ne "lib/dec_and_lock.o" + && $fullname ne "fs/xfs/xfs_macros.o" + && $fullname ne "drivers/ide/ide-probe-mini.o" + && $fullname ne "usr/initramfs_data.o" + && $fullname ne "drivers/acpi/executer/exdump.o" + && $fullname ne "drivers/acpi/resources/rsdump.o" + && $fullname ne "drivers/acpi/namespace/nsdumpdv.o" + && $fullname ne "drivers/acpi/namespace/nsdump.o" + && $fullname ne "arch/ia64/sn/kernel/sn2/io.o" + && $fullname ne "arch/ia64/kernel/gate-data.o" + && $fullname ne "drivers/ieee1394/oui.o" + && $fullname ne "security/capability.o" + && $fullname ne "sound/core/wrappers.o" + && $fullname ne "fs/ntfs/sysctl.o" + && $fullname ne "fs/jfs/jfs_debug.o" + ) { + printf "No nm data for $fullname\n"; + } + return; + } + $nmdata{$fullname} = \@nmdata; +} + +sub drop_def +{ + my ($object, $name) = @_; + my $nmdata = $nmdata{$object}; + my ($i, $j); + for ($i = 0; $i <= $#{$nmdata}; ++$i) { + if ($name eq (split(' ', $nmdata->[$i], 2))[1]) { + splice(@{$nmdata{$object}}, $i, 1); + my $def = $def{$name}; + for ($j = 0; $j < $#{$def{$name}}; ++$j) { + if ($def{$name}[$j] eq $object) { + splice(@{$def{$name}}, $j, 1); + } + } + last; + } + } +} + +sub list_multiply_defined +{ + my ($name, $module); + foreach $name (keys(%def)) { + if ($#{$def{$name}} > 0) { + # Special case for cond_syscall + if ($#{$def{$name}} == 1 && $name =~ /^sys_/ && + ($def{$name}[0] eq "kernel/sys.o" || + $def{$name}[1] eq "kernel/sys.o")) { + &drop_def("kernel/sys.o", $name); + next; + } + # Special case for i386 entry code + if ($#{$def{$name}} == 1 && $name =~ /^__kernel_/ && + $def{$name}[0] eq "arch/i386/kernel/vsyscall-int80.o" && + $def{$name}[1] eq "arch/i386/kernel/vsyscall-sysenter.o") { + &drop_def("arch/i386/kernel/vsyscall-sysenter.o", $name); + next; + } + printf "$name is multiply defined in :-\n"; + foreach $module (@{$def{$name}}) { + printf "\t$module\n"; + } + } + } +} + +sub resolve_external_references +{ + my ($object, $type, $name, $i, $j, $kstrtab, $ksymtab, $export); + printf "\n"; + foreach $object (keys(%nmdata)) { + my $nmdata = $nmdata{$object}; + for ($i = 0; $i <= $#{$nmdata}; ++$i) { + ($type, $name) = split(' ', $nmdata->[$i], 2); + if ($type eq "U" || $type eq "w") { + if (exists($def{$name}) || exists($ksymtab{$name})) { + # add the owning object to the nmdata + $nmdata->[$i] = "$type $name $object"; + # only count as a reference if it is not EXPORT_... + $kstrtab = "R __kstrtab_$name"; + $ksymtab = "R __ksymtab_$name"; + $export = 0; + for ($j = 0; $j <= $#{$nmdata}; ++$j) { + if ($nmdata->[$j] eq $kstrtab || + $nmdata->[$j] eq $ksymtab) { + $export = 1; + last; + } + } + if ($export) { + $export{$name} = ""; + } + else { + $ref{$name} = "" + } + } + elsif ( $name ne "mod_use_count_" + && $name ne "__initramfs_end" + && $name ne "__initramfs_start" + && $name ne "_einittext" + && $name ne "_sinittext" + && $name ne "kallsyms_names" + && $name ne "kallsyms_num_syms" + && $name ne "kallsyms_addresses" + && $name ne "__this_module" + && $name ne "_etext" + && $name ne "_edata" + && $name ne "_end" + && $name ne "__bss_start" + && $name ne "_text" + && $name ne "_stext" + && $name ne "__gp" + && $name ne "ia64_unw_start" + && $name ne "ia64_unw_end" + && $name ne "__init_begin" + && $name ne "__init_end" + && $name ne "__bss_stop" + && $name ne "__nosave_begin" + && $name ne "__nosave_end" + && $name ne "pg0" + && $name ne "__module_text_address" + && $name !~ /^__sched_text_/ + && $name !~ /^__start_/ + && $name !~ /^__end_/ + && $name !~ /^__stop_/ + && $name !~ /^__scheduling_functions_.*_here/ + && $name !~ /^__.*initcall_/ + && $name !~ /^__.*per_cpu_start/ + && $name !~ /^__.*per_cpu_end/ + && $name !~ /^__alt_instructions/ + && $name !~ /^__setup_/ + ) { + printf "Cannot resolve "; + printf "weak " if ($type eq "w"); + printf "reference to $name from $object\n"; + } + } + } + } +} + +sub list_extra_externals +{ + my %noref = (); + my ($name, @module, $module, $export); + foreach $name (keys(%def)) { + if (! exists($ref{$name})) { + @module = @{$def{$name}}; + foreach $module (@module) { + if (! exists($noref{$module})) { + $noref{$module} = []; + } + push(@{$noref{$module}}, $name); + } + } + } + if (%noref) { + printf "\nExternally defined symbols with no external references\n"; + foreach $module (sort(keys(%noref))) { + printf " $module\n"; + foreach (sort(@{$noref{$module}})) { + if (exists($export{$_})) { + $export = " (export only)"; + } + else { + $export = ""; + } + printf " $_$export\n"; + } + } + } +} diff -Nru a/scripts/package/builddeb b/scripts/package/builddeb --- a/scripts/package/builddeb 2004-09-06 17:50:45 -07:00 +++ b/scripts/package/builddeb 2004-09-06 17:50:45 -07:00 @@ -12,7 +12,7 @@ set -e # Some variables and settings used throughout the script -version="$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" +version=$KERNELRELEASE tmpdir="$objtree/debian/tmp" # Setup the directory structure diff -Nru a/scripts/package/mkspec b/scripts/package/mkspec --- a/scripts/package/mkspec 2004-09-06 17:50:45 -07:00 +++ b/scripts/package/mkspec 2004-09-06 17:50:45 -07:00 @@ -21,11 +21,12 @@ PROVIDES=kernel-drm fi -PROVIDES="$PROVIDES kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" +PROVIDES="$PROVIDES kernel-$KERNELRELEASE" +__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-//g"` echo "Name: kernel" echo "Summary: The Linux Kernel" -echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g" +echo "Version: $__KERNELRELEASE" # we need to determine the NEXT version number so that uname and # rpm -q will agree echo "Release: `. $srctree/scripts/mkversion`" @@ -35,8 +36,7 @@ echo "URL: http://www.kernel.org" if ! $PREBUILT; then -echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL" -echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g" +echo "Source: kernel-$__KERNELRELEASE.tar.gz" fi echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root" @@ -65,11 +65,11 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install' -echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" +echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" -echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" +echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" -echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" +echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" echo "" echo "%clean" echo '#echo -rf $RPM_BUILD_ROOT' @@ -77,6 +77,6 @@ echo "%files" echo '%defattr (-, root, root)' echo "%dir /lib/modules" -echo "/lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" +echo "/lib/modules/$KERNELRELEASE" echo "/boot/*" echo "" diff -Nru a/scripts/ver_linux b/scripts/ver_linux --- a/scripts/ver_linux 2004-09-06 17:50:45 -07:00 +++ b/scripts/ver_linux 2004-09-06 17:50:45 -07:00 @@ -37,8 +37,11 @@ fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \ 'NR==1 {print "jfsutils ", $3}' -reiserfsck -V 2>&1 | grep reiserfsprogs | awk \ -'NR==1{print "reiserfsprogs ", $NF}' +reiserfsck -V 2>&1 | grep reiserfsck | awk \ +'NR==1{print "reiserfsprogs ", $2}' + +fsck.reiser4 -V 2>&1 | grep fsck.reiser4 | awk \ +'NR==1{print "reiser4progs ", $2}' xfs_db -V 2>&1 | grep version | awk \ 'NR==1{print "xfsprogs ", $3}'