kbuild: sync with Linux 4.1

Update some build scripts to match Linux 4.1.  Commit-based syncing
was done so as not to break U-Boot specific changes.
The previous big sync was from Linux 3.18-rc1 by commit 176d098277
(kbuild: sync misc scripts with Linux 3.18-rc1).

The commits imported from Linux (some with adjustments) are:

[1] commit 9fb5e5372208973984a23ee6f5f025c05d364633
    Author: Robert Richter <rrichter@cavium.com>
    dts, kbuild: Factor out dtbs install rules to Makefile.dtbinst

[2] commit 371fdc77af44f4cb32475fd499e1d912ccc30890
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: collect shorthands into scripts/Kbuild.include

[3] commit a29b82326ed4eb5567b03c85b52c6891578d5a03
    Author: Michal Marek <mmarek@suse.cz>
    kbuild: Remove duplicate $(cmd) definition in Makefile.clean

[4] commit 1846dfbde3e8a53f3673dcb1c1b79fd9b3f8d40d
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: remove redundant -rR flag of hdr-inst

[5] commit 34948e0bbf98640fc1821751b01d2f0cd17d84d5
    Author: Michal Marek <mmarek@suse.cz>
    kbuild: Drop support for clean-rule

[6] commit a16c5f99a28c9945165c46da27fff8e6f26f8736
    Author: Michal Marek <mmarek@suse.cz>
    kbuild: Fix removal of the debian/ directory

[7] commit d0d38cd9e853db11e0242b3df4c9c3c4a663fbb4
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: use mixed-targets when two or more config targets are given

[8] commit dd33c03b18b3f2db791eb6a17c37d2de66e4de18
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: fix cc-ifversion macro

[9] commit 665d92e38f65d70796aad2b8e49e42e80815d4a4
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: do not add $(call ...) to invoke cc-version or cc-fullversion

[10] commit 6dcb4e5edf39e3b65a75ca76f087b2fdbee8a808
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: allow cc-ifversion to have the argument for false condition

[11] commit c0a80c0c27e5e65b180a25e6c4c2f7ef9e386cd3
    Author: Heiko Carstens <heiko.carstens@de.ibm.com>
    ftrace: allow architectures to specify ftrace compile options

[12] commit 0b24becc810dc3be6e3f94103a866f214c282394
    Author: Andrey Ryabinin <a.ryabinin@samsung.com>
    kasan: add kernel address sanitizer infrastructure

[13] commit 4218affdf57f938c04e3a916a9685ee27079f377
    Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
    kbuild: remove warning about "make depend"

[14] commit 77479b38e2f58890eb221a0418357502a5b41cd6
    Author: Nathan Rossi <nathan.rossi@xilinx.com>
    kbuild: Create directory for target DTB

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2015-07-05 01:56:55 +09:00 committed by Tom Rini
parent 9b5f0b1da9
commit 98bd0e0d9b
5 changed files with 45 additions and 52 deletions

View file

@ -437,7 +437,7 @@ endif
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
ifneq ($(filter config %config,$(MAKECMDGOALS)),) ifneq ($(filter config %config,$(MAKECMDGOALS)),)
config-targets := 1 config-targets := 1
ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) ifneq ($(words $(MAKECMDGOALS)),1)
mixed-targets := 1 mixed-targets := 1
endif endif
endif endif
@ -1243,12 +1243,6 @@ $(version_h): include/config/uboot.release FORCE
$(timestamp_h): $(srctree)/Makefile FORCE $(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h) $(call filechk,timestamp.h)
# ---------------------------------------------------------------------------
PHONY += depend dep
depend dep:
@echo '*** Warning: make $@ is unnecessary now.'
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
quiet_cmd_cpp_lds = LDS $@ quiet_cmd_cpp_lds = LDS $@
cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
@ -1549,11 +1543,6 @@ ifneq ($(cmd_files),)
include $(cmd_files) include $(cmd_files)
endif endif
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
# Usage:
# $(Q)$(MAKE) $(clean)=dir
clean := -f $(srctree)/scripts/Makefile.clean obj
endif # skip-makefile endif # skip-makefile
PHONY += FORCE PHONY += FORCE

View file

@ -131,17 +131,15 @@ cc-disable-warning = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-version # cc-version
# Usage gcc-ver := $(call cc-version)
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
# cc-fullversion # cc-fullversion
# Usage gcc-ver := $(call cc-fullversion)
cc-fullversion = $(shell $(CONFIG_SHELL) \ cc-fullversion = $(shell $(CONFIG_SHELL) \
$(srctree)/scripts/gcc-version.sh -p $(CC)) $(srctree)/scripts/gcc-version.sh -p $(CC))
# cc-ifversion # cc-ifversion
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4))
# added for U-Boot # added for U-Boot
binutils-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/binutils-version.sh $(AS)) binutils-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/binutils-version.sh $(AS))
@ -163,13 +161,12 @@ ld-option = $(call try-run,\
ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
# ld-version # ld-version
# Usage: $(call ld-version)
# Note this is mainly for HJ Lu's 3 number binutil versions # Note this is mainly for HJ Lu's 3 number binutil versions
ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh) ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
# ld-ifversion # ld-ifversion
# Usage: $(call ld-ifversion, -ge, 22252, y) # Usage: $(call ld-ifversion, -ge, 22252, y)
ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3)) ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
###### ######
@ -185,6 +182,24 @@ build := -f $(srctree)/scripts/Makefile.build obj
# $(Q)$(MAKE) $(modbuiltin)=dir # $(Q)$(MAKE) $(modbuiltin)=dir
modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj
###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
# Usage:
# $(Q)$(MAKE) $(dtbinst)=dir
dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj
###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
# Usage:
# $(Q)$(MAKE) $(clean)=dir
clean := -f $(srctree)/scripts/Makefile.clean obj
###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj=
# Usage:
# $(Q)$(MAKE) $(hdr-inst)=dir
hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
# Prefix -I with $(srctree) if it is not an absolute path. # Prefix -I with $(srctree) if it is not an absolute path.
# skip if -I has no parameter # skip if -I has no parameter
addtree = $(if $(patsubst -I%,%,$(1)), \ addtree = $(if $(patsubst -I%,%,$(1)), \

View file

@ -254,7 +254,8 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
recordmcount_source := $(srctree)/scripts/recordmcount.pl recordmcount_source := $(srctree)/scripts/recordmcount.pl
endif endif
cmd_record_mcount = \ cmd_record_mcount = \
if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \ if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \
"$(CC_FLAGS_FTRACE)" ]; then \
$(sub_cmd_record_mcount) \ $(sub_cmd_record_mcount) \
fi; fi;
endif endif

View file

@ -7,10 +7,7 @@ src := $(obj)
PHONY := __clean PHONY := __clean
__clean: __clean:
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir include scripts/Kbuild.include
# Usage:
# $(Q)$(MAKE) $(clean)=dir
clean := -f $(srctree)/scripts/Makefile.clean obj
# The filename Kbuild has precedence over Makefile # The filename Kbuild has precedence over Makefile
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
@ -50,19 +47,19 @@ __clean-files := $(extra-y) $(extra-m) $(extra-) \
__clean-files := $(filter-out $(no-clean-files), $(__clean-files)) __clean-files := $(filter-out $(no-clean-files), $(__clean-files))
# as clean-files is given relative to the current directory, this adds # clean-files is given relative to the current directory, unless it
# a $(obj) prefix, except for absolute paths # starts with $(objtree)/ (which means "./", so do not add "./" unless
# you want to delete a file from the toplevel object directory).
__clean-files := $(wildcard \ __clean-files := $(wildcard \
$(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \ $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
$(filter /%, $(__clean-files))) $(filter $(objtree)/%, $(__clean-files)))
# as clean-dirs is given relative to the current directory, this adds # same as clean-files
# a $(obj) prefix, except for absolute paths
__clean-dirs := $(wildcard \ __clean-dirs := $(wildcard \
$(addprefix $(obj)/, $(filter-out /%, $(clean-dirs))) \ $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(clean-dirs))) \
$(filter /%, $(clean-dirs))) $(filter $(objtree)/%, $(clean-dirs)))
# ========================================================================== # ==========================================================================
@ -78,9 +75,6 @@ ifneq ($(strip $(__clean-files)),)
endif endif
ifneq ($(strip $(__clean-dirs)),) ifneq ($(strip $(__clean-dirs)),)
+$(call cmd,cleandir) +$(call cmd,cleandir)
endif
ifneq ($(strip $(clean-rule)),)
+$(clean-rule)
endif endif
@: @:
@ -96,11 +90,6 @@ PHONY += $(subdir-ymn)
$(subdir-ymn): $(subdir-ymn):
$(Q)$(MAKE) $(clean)=$@ $(Q)$(MAKE) $(clean)=$@
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
# Declare the contents of the .PHONY variable as phony. We keep that # Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable se we can use it in if_changed and friends. # information in a variable se we can use it in if_changed and friends.

View file

@ -119,6 +119,16 @@ _c_flags += $(if $(patsubst n%,, \
$(CFLAGS_GCOV)) $(CFLAGS_GCOV))
endif endif
#
# Enable address sanitizer flags for kernel except some files or directories
# we don't want to check (depends on variables KASAN_SANITIZE_obj.o, KASAN_SANITIZE)
#
ifeq ($(CONFIG_KASAN),y)
_c_flags += $(if $(patsubst n%,, \
$(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \
$(CFLAGS_KASAN))
endif
# If building the kernel in a separate objtree expand all occurrences # If building the kernel in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
@ -274,7 +284,8 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
quiet_cmd_dtc = DTC $@ quiet_cmd_dtc = DTC $@
# Modified for U-Boot # Modified for U-Boot
cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
$(DTC) -O dtb -o $@ -b 0 \ $(DTC) -O dtb -o $@ -b 0 \
-i $(dir $<) $(DTC_FLAGS) \ -i $(dir $<) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \
@ -285,18 +296,6 @@ $(obj)/%.dtb: $(src)/%.dts FORCE
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
# Helper targets for Installing DTBs into the boot directory
quiet_cmd_dtb_install = INSTALL $<
cmd_dtb_install = cp $< $(2)
_dtbinst_pre_:
$(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
$(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
$(Q)mkdir -p $(INSTALL_DTBS_PATH)
%.dtb_dtbinst_: $(obj)/%.dtb _dtbinst_pre_
$(call cmd,dtb_install,$(INSTALL_DTBS_PATH))
# Bzip2 # Bzip2
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------