Commit 6e936d3e authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (28 commits)
  kbuild: add distclean info to 'make help' and more details for 'clean'
  dontdiff: add utsrelease.h
  kbuild: fix "mkdir -p" usage in scripts/package/mkspec
  kbuild: correct and clarify versioning info in Makefile
  kbuild: fixup Documentation/kbuild/modules.txt
  kbuild: Extend kbuild/defconfig tags support to exuberant ctags
  kbuild: fix for some typos in Documentation/makefiles.txt
  kbuild: clarify "make C=" build option
  Documentaion: update Documentation/Changes with minimum versions
  kbuild: update help in top level Makefile
  kbuild: fail kernel compilation in case of unresolved module symbols
  kbuild: remove debug left-over from Makefile.host
  kbuild: create output directory for hostprogs with O=.. build
  kbuild: add missing return statement in modpost.c:secref_whitelist()
  kbuild: preperly align SYSMAP output
  kbuild: make -rR is now default
  kbuild: make V=2 tell why a target is rebuild
  kbuild: modpost on vmlinux regardless of CONFIG_MODULES
  kbuild: ignore references from ".pci_fixup" to ".init.text"
  kbuild: linguistic fixes for Documentation/kbuild/makefiles.txt
  ...
parents a68aa1cc 5cc8d246
...@@ -37,15 +37,14 @@ o e2fsprogs 1.29 # tune2fs ...@@ -37,15 +37,14 @@ o e2fsprogs 1.29 # tune2fs
o jfsutils 1.1.3 # fsck.jfs -V o jfsutils 1.1.3 # fsck.jfs -V
o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs
o xfsprogs 2.6.0 # xfs_db -V o xfsprogs 2.6.0 # xfs_db -V
o pcmciautils 004 o pcmciautils 004 # pccardctl -V
o pcmcia-cs 3.1.21 # cardmgr -V
o quota-tools 3.09 # quota -V o quota-tools 3.09 # quota -V
o PPP 2.4.0 # pppd --version o PPP 2.4.0 # pppd --version
o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version
o nfs-utils 1.0.5 # showmount --version o nfs-utils 1.0.5 # showmount --version
o procps 3.2.0 # ps --version o procps 3.2.0 # ps --version
o oprofile 0.9 # oprofiled --version o oprofile 0.9 # oprofiled --version
o udev 071 # udevinfo -V o udev 081 # udevinfo -V
Kernel compilation Kernel compilation
================== ==================
...@@ -268,7 +267,7 @@ active clients. ...@@ -268,7 +267,7 @@ active clients.
To enable this new functionality, you need to: To enable this new functionality, you need to:
mount -t nfsd nfsd /proc/fs/nfs mount -t nfsd nfsd /proc/fs/nfsd
before running exportfs or mountd. It is recommended that all NFS before running exportfs or mountd. It is recommended that all NFS
services be protected from the internet-at-large by a firewall where services be protected from the internet-at-large by a firewall where
......
...@@ -135,6 +135,7 @@ tags ...@@ -135,6 +135,7 @@ tags
times.h* times.h*
tkparse tkparse
trix_boot.h trix_boot.h
utsrelease.h*
version.h* version.h*
vmlinux vmlinux
vmlinux-* vmlinux-*
......
...@@ -67,19 +67,19 @@ applicable everywhere (see syntax). ...@@ -67,19 +67,19 @@ applicable everywhere (see syntax).
- default value: "default" <expr> ["if" <expr>] - default value: "default" <expr> ["if" <expr>]
A config option can have any number of default values. If multiple A config option can have any number of default values. If multiple
default values are visible, only the first defined one is active. default values are visible, only the first defined one is active.
Default values are not limited to the menu entry, where they are Default values are not limited to the menu entry where they are
defined, this means the default can be defined somewhere else or be defined. This means the default can be defined somewhere else or be
overridden by an earlier definition. overridden by an earlier definition.
The default value is only assigned to the config symbol if no other The default value is only assigned to the config symbol if no other
value was set by the user (via the input prompt above). If an input value was set by the user (via the input prompt above). If an input
prompt is visible the default value is presented to the user and can prompt is visible the default value is presented to the user and can
be overridden by him. be overridden by him.
Optionally dependencies only for this default value can be added with Optionally, dependencies only for this default value can be added with
"if". "if".
- dependencies: "depends on"/"requires" <expr> - dependencies: "depends on"/"requires" <expr>
This defines a dependency for this menu entry. If multiple This defines a dependency for this menu entry. If multiple
dependencies are defined they are connected with '&&'. Dependencies dependencies are defined, they are connected with '&&'. Dependencies
are applied to all other options within this menu entry (which also are applied to all other options within this menu entry (which also
accept an "if" expression), so these two examples are equivalent: accept an "if" expression), so these two examples are equivalent:
...@@ -153,7 +153,7 @@ Nonconstant symbols are the most common ones and are defined with the ...@@ -153,7 +153,7 @@ Nonconstant symbols are the most common ones and are defined with the
'config' statement. Nonconstant symbols consist entirely of alphanumeric 'config' statement. Nonconstant symbols consist entirely of alphanumeric
characters or underscores. characters or underscores.
Constant symbols are only part of expressions. Constant symbols are Constant symbols are only part of expressions. Constant symbols are
always surrounded by single or double quotes. Within the quote any always surrounded by single or double quotes. Within the quote, any
other character is allowed and the quotes can be escaped using '\'. other character is allowed and the quotes can be escaped using '\'.
Menu structure Menu structure
...@@ -237,7 +237,7 @@ choices: ...@@ -237,7 +237,7 @@ choices:
<choice block> <choice block>
"endchoice" "endchoice"
This defines a choice group and accepts any of above attributes as This defines a choice group and accepts any of the above attributes as
options. A choice can only be of type bool or tristate, while a boolean options. A choice can only be of type bool or tristate, while a boolean
choice only allows a single config entry to be selected, a tristate choice only allows a single config entry to be selected, a tristate
choice also allows any number of config entries to be set to 'm'. This choice also allows any number of config entries to be set to 'm'. This
......
This diff is collapsed.
This diff is collapsed.
...@@ -69,10 +69,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to ...@@ -69,10 +69,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to
be recompiled or not. The latter is a fast way to check the whole tree if you be recompiled or not. The latter is a fast way to check the whole tree if you
have already built it. have already built it.
The optional make variable CF can be used to pass arguments to sparse. The The optional make variable CHECKFLAGS can be used to pass arguments to sparse.
build system passes -Wbitwise to sparse automatically. To perform endianness The build system passes -Wbitwise to sparse automatically. To perform
checks, you may define __CHECK_ENDIAN__: endianness checks, you may define __CHECK_ENDIAN__:
make C=2 CF="-D__CHECK_ENDIAN__" make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__"
These checks are disabled by default as they generate a host of warnings. These checks are disabled by default as they generate a host of warnings.
...@@ -28,7 +28,7 @@ define cmd_offsets ...@@ -28,7 +28,7 @@ define cmd_offsets
echo "/*"; \ echo "/*"; \
echo " * DO NOT MODIFY."; \ echo " * DO NOT MODIFY."; \
echo " *"; \ echo " *"; \
echo " * This file was generated by $(srctree)/Kbuild"; \ echo " * This file was generated by Kbuild"; \
echo " *"; \ echo " *"; \
echo " */"; \ echo " */"; \
echo ""; \ echo ""; \
......
...@@ -41,9 +41,15 @@ ifndef KBUILD_VERBOSE ...@@ -41,9 +41,15 @@ ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0 KBUILD_VERBOSE = 0
endif endif
# Call checker as part of compilation of C files # Call a source code checker (by default, "sparse") as part of the
# Use 'make C=1' to enable checking (sparse, by default) # C compilation.
# Override with 'make C=1 CHECK=checker_executable CHECKFLAGS=....' #
# Use 'make C=1' to enable checking of only re-compiled files.
# Use 'make C=2' to enable checking of *all* source files, regardless
# of whether they are re-compiled or not.
#
# See the file "Documentation/sparse.txt" for more details, including
# where to get the "sparse" utility.
ifdef C ifdef C
ifeq ("$(origin C)", "command line") ifeq ("$(origin C)", "command line")
...@@ -736,6 +742,7 @@ endif # ifdef CONFIG_KALLSYMS ...@@ -736,6 +742,7 @@ endif # ifdef CONFIG_KALLSYMS
# vmlinux image - including updated kernel symbols # vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
$(call if_changed_rule,vmlinux__) $(call if_changed_rule,vmlinux__)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
$(Q)rm -f .old_version $(Q)rm -f .old_version
# The actual objects are generated when descending, # The actual objects are generated when descending,
...@@ -753,12 +760,34 @@ $(vmlinux-dirs): prepare scripts ...@@ -753,12 +760,34 @@ $(vmlinux-dirs): prepare scripts
$(Q)$(MAKE) $(build)=$@ $(Q)$(MAKE) $(build)=$@
# Build the kernel release string # Build the kernel release string
# The KERNELRELEASE is stored in a file named include/config/kernel.release
# to be used when executing for example make install or make modules_install
# #
# Take the contents of any files called localversion* and the config # The KERNELRELEASE value built here is stored in the file
# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. # include/config/kernel.release, and is used when executing several
# LOCALVERSION from the command line override all of this # make targets, such as "make install" or "make modules_install."
#
# The eventual kernel release string consists of the following fields,
# shown in a hierarchical format to show how smaller parts are concatenated
# to form the larger and final value, with values coming from places like
# the Makefile, kernel config options, make command line options and/or
# SCM tag information.
#
# $(KERNELVERSION)
# $(VERSION) eg, 2
# $(PATCHLEVEL) eg, 6
# $(SUBLEVEL) eg, 18
# $(EXTRAVERSION) eg, -rc6
# $(localver-full)
# $(localver)
# localversion* (all localversion* files)
# $(CONFIG_LOCALVERSION) (from kernel config setting)
# $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set)
# ./scripts/setlocalversion (SCM tag, if one exists)
# $(LOCALVERSION) (from make command line if provided)
#
# Note how the final $(localver-auto) string is included *only* if the
# kernel config option CONFIG_LOCALVERSION_AUTO is selected. Also, at the
# moment, only git is supported but other SCMs can edit the script
# scripts/setlocalversion and add the appropriate checks as needed.
nullstring := nullstring :=
space := $(nullstring) # end of line space := $(nullstring) # end of line
...@@ -893,14 +922,14 @@ INSTALL_HDR_PATH=$(objtree)/usr ...@@ -893,14 +922,14 @@ INSTALL_HDR_PATH=$(objtree)/usr
export INSTALL_HDR_PATH export INSTALL_HDR_PATH
PHONY += headers_install PHONY += headers_install
headers_install: include/linux/version.h headers_install: include/linux/version.h scripts_basic FORCE
$(Q)unifdef -Ux /dev/null $(Q)$(MAKE) $(build)=scripts scripts/unifdef
$(Q)rm -rf $(INSTALL_HDR_PATH)/include $(Q)rm -rf $(INSTALL_HDR_PATH)/include
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include
PHONY += headers_check PHONY += headers_check
headers_check: headers_install headers_check: headers_install
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Modules # Modules
...@@ -916,7 +945,7 @@ all: modules ...@@ -916,7 +945,7 @@ all: modules
PHONY += modules PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
@echo ' Building modules, stage 2.'; @echo ' Building modules, stage 2.';
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
# Target to prepare building external modules # Target to prepare building external modules
...@@ -942,7 +971,7 @@ _modinst_: ...@@ -942,7 +971,7 @@ _modinst_:
rm -f $(MODLIB)/build ; \ rm -f $(MODLIB)/build ; \
ln -s $(objtree) $(MODLIB)/build ; \ ln -s $(objtree) $(MODLIB)/build ; \
fi fi
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a # If System.map exists, run depmod. This deliberately does not have a
# dependency on System.map since that would run the dependency tree on # dependency on System.map since that would run the dependency tree on
...@@ -1057,8 +1086,10 @@ boards := $(notdir $(boards)) ...@@ -1057,8 +1086,10 @@ boards := $(notdir $(boards))
help: help:
@echo 'Cleaning targets:' @echo 'Cleaning targets:'
@echo ' clean - remove most generated files but keep the config' @echo ' clean - remove most generated files but keep the config and'
@echo ' enough build support to build external modules'
@echo ' mrproper - remove all generated files + config + various backup files' @echo ' mrproper - remove all generated files + config + various backup files'
@echo ' distclean - mrproper + remove editor backup and patch files'
@echo '' @echo ''
@echo 'Configuration targets:' @echo 'Configuration targets:'
@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
...@@ -1100,6 +1131,7 @@ help: ...@@ -1100,6 +1131,7 @@ help:
echo '') echo '')
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
@echo ' make V=2 [targets] 2 => give reason for rebuild of target'
@echo ' make O=dir [targets] Locate all output files in "dir", including .config' @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
@echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
@echo ' make C=2 [targets] Force check of all c source with $$CHECK' @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
...@@ -1154,7 +1186,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers ...@@ -1154,7 +1186,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers
modules: $(module-dirs) modules: $(module-dirs)
@echo ' Building modules, stage 2.'; @echo ' Building modules, stage 2.';
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
PHONY += modules_install PHONY += modules_install
modules_install: _emodinst_ _emodinst_post modules_install: _emodinst_ _emodinst_post
...@@ -1163,7 +1195,7 @@ install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) ...@@ -1163,7 +1195,7 @@ install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
PHONY += _emodinst_ PHONY += _emodinst_
_emodinst_: _emodinst_:
$(Q)mkdir -p $(MODLIB)/$(install-dir) $(Q)mkdir -p $(MODLIB)/$(install-dir)
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# Run depmod only is we have System.map and depmod is executable # Run depmod only is we have System.map and depmod is executable
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
...@@ -1264,6 +1296,31 @@ define all-defconfigs ...@@ -1264,6 +1296,31 @@ define all-defconfigs
$(call find-sources,'defconfig') $(call find-sources,'defconfig')
endef endef
define xtags
if $1 --version 2>&1 | grep -iq exuberant; then \
$(all-sources) | xargs $1 -a \
-I __initdata,__exitdata,__acquires,__releases \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px; \
$(all-kconfigs) | xargs $1 -a \
--langdef=kconfig \
--language-force=kconfig \
--regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \
$(all-defconfigs) | xargs $1 -a \
--langdef=dotconfig \
--language-force=dotconfig \
--regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
elif $1 --version 2>&1 | grep -iq emacs; then \
$(all-sources) | xargs $1 -a; \
$(all-kconfigs) | xargs $1 -a \
--regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
$(all-defconfigs) | xargs $1 -a \
--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
else \
$(all-sources) | xargs $1 -a; \
fi
endef
quiet_cmd_cscope-file = FILELST cscope.files quiet_cmd_cscope-file = FILELST cscope.files
cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
...@@ -1277,31 +1334,16 @@ cscope: FORCE ...@@ -1277,31 +1334,16 @@ cscope: FORCE
quiet_cmd_TAGS = MAKE $@ quiet_cmd_TAGS = MAKE $@
define cmd_TAGS define cmd_TAGS
rm -f $@; \ rm -f $@; \
ETAGSF=`etags --version | grep -i exuberant >/dev/null && \ $(call xtags,etags)
echo "-I __initdata,__exitdata,__acquires,__releases \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px"`; \
$(all-sources) | xargs etags $$ETAGSF -a; \
if test "x$$ETAGSF" = x; then \
$(all-kconfigs) | xargs etags -a \
--regex='/^config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
$(all-defconfigs) | xargs etags -a \
--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
fi
endef endef
TAGS: FORCE TAGS: FORCE
$(call cmd,TAGS) $(call cmd,TAGS)
quiet_cmd_tags = MAKE $@ quiet_cmd_tags = MAKE $@
define cmd_tags define cmd_tags
rm -f $@; \ rm -f $@; \
CTAGSF=`ctags --version | grep -i exuberant >/dev/null && \ $(call xtags,ctags)
echo "-I __initdata,__exitdata,__acquires,__releases \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px"`; \
$(all-sources) | xargs ctags $$CTAGSF -a
endef endef
tags: FORCE tags: FORCE
...@@ -1379,7 +1421,7 @@ endif ...@@ -1379,7 +1421,7 @@ endif
%.ko: prepare scripts FORCE %.ko: prepare scripts FORCE
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir) $(@:.ko=.o) $(build)=$(build-dir) $(@:.ko=.o)
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
# FIXME Should go into a make.lib or something # FIXME Should go into a make.lib or something
# =========================================================================== # ===========================================================================
......
...@@ -7,10 +7,14 @@ squote := ' ...@@ -7,10 +7,14 @@ squote := '
empty := empty :=
space := $(empty) $(empty) space := $(empty) $(empty)
###
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
dot-target = $(dir $@).$(notdir $@)
### ###
# The temporary file to save gcc -MD generated dependencies must not # The temporary file to save gcc -MD generated dependencies must not
# contain a comma # contain a comma
depfile = $(subst $(comma),_,$(@D)/.$(@F).d) depfile = $(subst $(comma),_,$(dot-target).d)
### ###
# filename of target with directory and extension stripped # filename of target with directory and extension stripped
...@@ -119,40 +123,83 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) ...@@ -119,40 +123,83 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
ifneq ($(KBUILD_NOCMDDEP),1) ifneq ($(KBUILD_NOCMDDEP),1)
# Check if both arguments has same arguments. Result in empty string if equal # Check if both arguments has same arguments. Result in empty string if equal
# User may override this check using make KBUILD_NOCMDDEP=1 # User may override this check using make KBUILD_NOCMDDEP=1
arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) ) arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
$(filter-out $(cmd_$@), $(cmd_$(1))) )
endif endif
# echo command. Short version is $(quiet) equals quiet, otherwise full command # echo command. Short version is $(quiet) equals quiet, otherwise full command
echo-cmd = $(if $($(quiet)cmd_$(1)), \ echo-cmd = $(if $($(quiet)cmd_$(1)), \
echo ' $(call escsq,$($(quiet)cmd_$(1)))';) echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
# >'< 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
make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))
# function to only execute the passed command if necessary # Find any prerequisites that is newer than target or that does not exist.
# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file # PHONY targets skipped in both cases.
# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
# Execute command if command has changed or prerequisitei(s) are updated
# #
if_changed = $(if $(strip $(filter-out $(PHONY),$?) \ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
@set -e; \ @set -e; \
$(echo-cmd) $(cmd_$(1)); \ $(echo-cmd) $(cmd_$(1)); \
echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd) echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
# execute the command and also postprocess generated .d dependencies # execute the command and also postprocess generated .d dependencies
# file # file
if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
$(filter-out FORCE $(wildcard $^),$^) \
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
@set -e; \ @set -e; \
$(echo-cmd) $(cmd_$(1)); \ $(echo-cmd) $(cmd_$(1)); \
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\
rm -f $(depfile); \ rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) mv -f $(dot-target).tmp $(dot-target).cmd)
# Usage: $(call if_changed_rule,foo) # Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed, # will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo) # and if so will execute $(rule_foo)
if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \ if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
@set -e; \ @set -e; \
$(rule_$(1))) $(rule_$(1)))
###
# why - tell why a a target got build
# enabled by make V=2
# Output (listed in the order they are checked):
# (1) - due to target is PHONY
# (2) - due to target missing
# (3) - due to: file1.h file2.h
# (4) - due to command line change
# (5) - due to missing .cmd file
# (6) - due to target not in $(targets)
# (1) PHONY targets are always build
# (2) No target, so we better build it
# (3) Prerequisite is newer than target
# (4) The command line stored in the file named dir/.target.cmd
# differed from actual command line. This happens when compiler
# options changes
# (5) No dir/.target.cmd file (used to store command line)
# (6) No dir/.target.cmd file and target not listed in $(targets)
# This is a good hint that there is a bug in the kbuild file
ifeq ($(KBUILD_VERBOSE),2)
why = \
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \
$(if $(wildcard $@), \
$(if $(strip $(any-prereq)),- due to: $(any-prereq), \
$(if $(arg-check), \
$(if $(cmd_$@),- due to command line change, \
$(if $(filter $@, $(targets)), \
- due to missing .cmd file, \
- due to $(notdir $@) not in $$(targets) \
) \
) \
) \
), \
- due to target missing \
) \
)
echo-why = $(call escsq, $(strip $(why)))
endif
...@@ -15,8 +15,11 @@ hostprogs-$(CONFIG_IKCONFIG) += bin2c ...@@ -15,8 +15,11 @@ hostprogs-$(CONFIG_IKCONFIG) += bin2c
always := $(hostprogs-y) always := $(hostprogs-y)
# The following hostprogs-y programs are only build on demand
hostprogs-y += unifdef
subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-$(CONFIG_MODULES) += mod subdir-y += mod
# Let clean descend into subdirs # Let clean descend into subdirs
subdir- += basic kconfig package subdir- += basic kconfig package
...@@ -191,9 +191,10 @@ define rule_cc_o_c ...@@ -191,9 +191,10 @@ define rule_cc_o_c
$(call echo-cmd,checksrc) $(cmd_checksrc) \ $(call echo-cmd,checksrc) $(cmd_checksrc) \
$(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
$(cmd_modversions) \ $(cmd_modversions) \
scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > $(@D)/.$(@F).tmp; \ scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
$(dot-target).tmp; \
rm -f $(depfile); \ rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd mv -f $(dot-target).tmp $(dot-target).cmd
endef endef
# Built-in and composite module parts # Built-in and composite module parts
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# ========================================================================== # ==========================================================================
UNIFDEF := unifdef -U__KERNEL__ UNIFDEF := scripts/unifdef -U__KERNEL__
# Eliminate the contents of (and inclusions of) compiler.h # Eliminate the contents of (and inclusions of) compiler.h
HDRSED := sed -e "s/ inline / __inline__ /g" \ HDRSED := sed -e "s/ inline / __inline__ /g" \
......
...@@ -32,11 +32,6 @@ ...@@ -32,11 +32,6 @@
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
# hostprogs-y := tools/build may have been specified. Retreive directory
host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))
# C code # C code
# Executables compiled from a single .c file # Executables compiled from a single .c file
host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
...@@ -65,6 +60,21 @@ host-cobjs := $(filter-out %.so,$(host-cobjs)) ...@@ -65,6 +60,21 @@ host-cobjs := $(filter-out %.so,$(host-cobjs))
#Object (.o) files used by the shared libaries #Object (.o) files used by the shared libaries
host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
# output directory for programs/.o files
# hostprogs-y := tools/build may have been specified. Retreive directory
host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
# directory of .o files from prog-objs notation
host-objdirs += $(foreach f,$(host-cmulti), \
$(foreach m,$($(f)-objs), \
$(if $(dir $(m)),$(dir $(m)))))
# directory of .o files from prog-cxxobjs notation
host-objdirs += $(foreach f,$(host-cxxmulti), \
$(foreach m,$($(f)-cxxobjs), \
$(if $(dir $(m)),$(dir $(m)))))
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))
__hostprogs := $(addprefix $(obj)/,$(__hostprogs)) __hostprogs := $(addprefix $(obj)/,$(__hostprogs))
host-csingle := $(addprefix $(obj)/,$(host-csingle)) host-csingle := $(addprefix $(obj)/,$(host-csingle))
host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
......
...@@ -51,19 +51,26 @@ _modpost: $(modules) ...@@ -51,19 +51,26 @@ _modpost: $(modules)
# Step 2), invoke modpost # Step 2), invoke modpost
# Includes step 3,4 # Includes step 3,4
quiet_cmd_modpost = MODPOST quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
cmd_modpost = scripts/mod/modpost \ cmd_modpost = scripts/mod/modpost \
$(if $(CONFIG_MODVERSIONS),-m) \ $(if $(CONFIG_MODVERSIONS),-m) \
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(filter-out FORCE,$^) $(if $(KBUILD_EXTMOD),-w) \
$(wildcard vmlinux) $(filter-out FORCE,$^)
PHONY += __modpost PHONY += __modpost
__modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE __modpost: $(modules:.ko=.o) FORCE
$(call cmd,modpost) $(call cmd,modpost)
quiet_cmd_kernel-mod = MODPOST $@
cmd_kernel-mod = $(cmd_modpost)
vmlinux: FORCE
$(call cmd,kernel-mod)
# Declare generated files as targets for modpost # Declare generated files as targets for modpost
$(symverfile): __modpost ; $(symverfile): __modpost ;
$(modules:.ko=.mod.c): __modpost ; $(modules:.ko=.mod.c): __modpost ;
......
...@@ -74,6 +74,7 @@ help: ...@@ -74,6 +74,7 @@ help:
@echo ' xconfig - Update current config utilising a QT based front-end' @echo ' xconfig - Update current config utilising a QT based front-end'
@echo ' gconfig - Update current config utilising a GTK based front-end' @echo ' gconfig - Update current config utilising a GTK based front-end'
@echo ' oldconfig - Update current config utilising a provided .config as base' @echo ' oldconfig - Update current config utilising a provided .config as base'
@echo ' silentoldconfig - Same as oldconfig, but quietly'
@echo ' randconfig - New config with random answer to all options' @echo ' randconfig - New config with random answer to all options'
@echo ' defconfig - New config with default answer to all options' @echo ' defconfig - New config with default answer to all options'
@echo ' allmodconfig - New config selecting modules when possible' @echo ' allmodconfig - New config selecting modules when possible'
......
...@@ -193,8 +193,11 @@ int conf_read_simple(const char *name, int def) ...@@ -193,8 +193,11 @@ int conf_read_simple(const char *name, int def)
continue; continue;
*p++ = 0; *p++ = 0;
p2 = strchr(p, '\n'); p2 = strchr(p, '\n');
if (p2) if (p2) {
*p2-- = 0;
if (*p2 == '\r')
*p2 = 0; *p2 = 0;
}
if (def == S_DEF_USER) { if (def == S_DEF_USER) {
sym = sym_find(line + 7); sym = sym_find(line + 7);
if (!sym) { if (!sym) {
...@@ -266,6 +269,7 @@ int conf_read_simple(const char *name, int def) ...@@ -266,6 +269,7 @@ int conf_read_simple(const char *name, int def)
; ;
} }
break; break;
case '\r':
case '\n': case '\n':
break; break;
default: default:
......
...@@ -23,6 +23,8 @@ int have_vmlinux = 0; ...@@ -23,6 +23,8 @@ int have_vmlinux = 0;
static int all_versions = 0; static int all_versions = 0;
/* If we are modposting external module set to 1 */ /* If we are modposting external module set to 1 */
static int external_module = 0; static int external_module = 0;
/* Only warn about unresolved symbols */
static int warn_unresolved = 0;
/* How a symbol is exported */ /* How a symbol is exported */
enum export { enum export {
export_plain, export_unused, export_gpl, export_plain, export_unused, export_gpl,
...@@ -581,8 +583,8 @@ static int strrcmp(const char *s, const char *sub) ...@@ -581,8 +583,8 @@ static int strrcmp(const char *s, const char *sub)
* fromsec = .data * fromsec = .data
* atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one
**/ **/
static int secref_whitelist(const char *tosec, const char *fromsec, static int secref_whitelist(const char *modname, const char *tosec,
const char *atsym) const char *fromsec, const char *atsym)
{ {
int f1 = 1, f2 = 1; int f1 = 1, f2 = 1;
const char **s; const char **s;
...@@ -618,8 +620,16 @@ static int secref_whitelist(const char *tosec, const char *fromsec, ...@@ -618,8 +620,16 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
for (s = pat2sym; *s; s++) for (s = pat2sym; *s; s++)
if (strrcmp(atsym, *s) == 0) if (strrcmp(atsym, *s) == 0)
f1 = 1; f1 = 1;
if (f1 && f2)
return 1;
return f1 && f2; /* Whitelist all references from .pci_fixup section if vmlinux */
if (is_vmlinux(modname)) {
if ((strcmp(fromsec, ".pci_fixup") == 0) &&
(strcmp(tosec, ".init.text") == 0))
return 1;
}
return 0;
} }
/** /**
...@@ -726,7 +736,8 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, ...@@ -726,7 +736,8 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
/* check whitelist - we may ignore it */ /* check whitelist - we may ignore it */
if (before && if (before &&
secref_whitelist(secname, fromsec, elf->strtab + before->st_name)) secref_whitelist(modname, secname, fromsec,
elf->strtab + before->st_name))
return; return;
if (before && after) { if (before && after) {
...@@ -1187,16 +1198,19 @@ static void add_header(struct buffer *b, struct module *mod) ...@@ -1187,16 +1198,19 @@ static void add_header(struct buffer *b, struct module *mod)
/** /**
* Record CRCs for unresolved symbols * Record CRCs for unresolved symbols
**/ **/
static void add_versions(struct buffer *b, struct module *mod) static int add_versions(struct buffer *b, struct module *mod)
{ {
struct symbol *s, *exp; struct symbol *s, *exp;
int err = 0;
for (s = mod->unres; s; s = s->next) { for (s = mod->unres; s; s = s->next) {
exp = find_symbol(s->name); exp = find_symbol(s->name);
if (!exp || exp->module == mod) { if (!exp || exp->module == mod) {
if (have_vmlinux && !s->weak) if (have_vmlinux && !s->weak) {
warn("\"%s\" [%s.ko] undefined!\n", warn("\"%s\" [%s.ko] undefined!\n",
s->name, mod->name); s->name, mod->name);
err = warn_unresolved ? 0 : 1;
}
continue; continue;
} }
s->module = exp->module; s->module = exp->module;
...@@ -1205,7 +1219,7 @@ static void add_versions(struct buffer *b, struct module *mod) ...@@ -1205,7 +1219,7 @@ static void add_versions(struct buffer *b, struct module *mod)
} }
if (!modversions) if (!modversions)
return; return err;
buf_printf(b, "\n"); buf_printf(b, "\n");
buf_printf(b, "static const struct modversion_info ____versions[]\n"); buf_printf(b, "static const struct modversion_info ____versions[]\n");
...@@ -1225,6 +1239,8 @@ static void add_versions(struct buffer *b, struct module *mod) ...@@ -1225,6 +1239,8 @@ static void add_versions(struct buffer *b, struct module *mod)
} }
buf_printf(b, "};\n"); buf_printf(b, "};\n");
return err;
} }
static void add_depends(struct buffer *b, struct module *mod, static void add_depends(struct buffer *b, struct module *mod,
...@@ -1402,8 +1418,9 @@ int main(int argc, char **argv) ...@@ -1402,8 +1418,9 @@ int main(int argc, char **argv)
char *kernel_read = NULL, *module_read = NULL; char *kernel_read = NULL, *module_read = NULL;
char *dump_write = NULL; char *dump_write = NULL;
int opt; int opt;
int err;
while ((opt = getopt(argc, argv, "i:I:mo:a")) != -1) { while ((opt = getopt(argc, argv, "i:I:mo:aw")) != -1) {
switch(opt) { switch(opt) {
case 'i': case 'i':
kernel_read = optarg; kernel_read = optarg;
...@@ -1421,6 +1438,9 @@ int main(int argc, char **argv) ...@@ -1421,6 +1438,9 @@ int main(int argc, char **argv)
case 'a': case 'a':
all_versions = 1; all_versions = 1;
break; break;
case 'w':
warn_unresolved = 1;
break;
default: default:
exit(1); exit(1);
} }
...@@ -1441,6 +1461,8 @@ int main(int argc, char **argv) ...@@ -1441,6 +1461,8 @@ int main(int argc, char **argv)
check_exports(mod); check_exports(mod);
} }
err = 0;
for (mod = modules; mod; mod = mod->next) { for (mod = modules; mod; mod = mod->next) {
if (mod->skip) if (mod->skip)
continue; continue;
...@@ -1448,7 +1470,7 @@ int main(int argc, char **argv) ...@@ -1448,7 +1470,7 @@ int main(int argc, char **argv)
buf.pos = 0; buf.pos = 0;
add_header(&buf, mod); add_header(&buf, mod);
add_versions(&buf, mod); err |= add_versions(&buf, mod);
add_depends(&buf, mod, modules); add_depends(&buf, mod, modules);
add_moddevtable(&buf, mod); add_moddevtable(&buf, mod);
add_srcversion(&buf, mod); add_srcversion(&buf, mod);
...@@ -1460,5 +1482,5 @@ int main(int argc, char **argv) ...@@ -1460,5 +1482,5 @@ int main(int argc, char **argv)
if (dump_write) if (dump_write)
write_dump(dump_write); write_dump(dump_write);
return 0; return err;
} }
...@@ -63,9 +63,9 @@ fi ...@@ -63,9 +63,9 @@ fi
echo "%install" echo "%install"
echo "%ifarch ia64" echo "%ifarch ia64"
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
echo "%else" echo "%else"
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
echo "%endif" echo "%endif"
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
......
This diff is collapsed.
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# #
klibcdirs:; klibcdirs:;
PHONY += klibcdirs
# Generate builtin.o based on initramfs_data.o # Generate builtin.o based on initramfs_data.o
obj-y := initramfs_data.o obj-y := initramfs_data.o
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment