History

Merge tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada: - do not generate unneeded top-level built-in.a - let git ignore O= directory entirely - optimize scripts/kallsyms slightly - exclude DWARF info from *.s regardless of config options - fix GCC toolchain search path for Clang to prepare ld.lld support - do not generate modules.order when CONFIG_MODULES is disabled - simplify single target rules and remove VPATH for external module build - allow to add optional flags to dpkg-buildpackage when building deb-pkg - move some compiler option tests from Makefile to Kconfig - various Makefile cleanups * tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits) kbuild: remove scripts/basic/% build target kbuild: use -Werror=implicit-... instead of -Werror-implicit-... kbuild: clean up scripts/gcc-version.sh kbuild: remove cc-version macro kbuild: update comment block of scripts/clang-version.sh kbuild: remove commented-out INITRD_COMPRESS kbuild: move -gsplit-dwarf, -gdwarf-4 option tests to Kconfig kbuild: [bin]deb-pkg: add DPKG_FLAGS variable kbuild: move ".config not found!" message from Kconfig to Makefile kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing kbuild: simplify single target rules kbuild: remove empty rules for makefiles kbuild: make -r/-R effective in top Makefile for old Make versions kbuild: move tools_silent to a more relevant place kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig kbuild: refactor cc-cross-prefix implementation kbuild: hardcode genksyms path and remove GENKSYMS variable scripts/gdb: refactor rules for symlink creation kbuild: create symlink to vmlinux-gdb.py in scripts_gdb target scripts/gdb: do not descend into scripts/gdb from scripts ...

Linus Torvalds committed 7 years ago

Commit ffd602e2 parents 5af7f11 9250d2033 files · +263 −363Browse files

Unified · Split

33 files
  1. Documentation/devicetree/bindings/Makefile +1 −1
  2. Documentation/kbuild/kbuild.txt +5 −10
  3. Documentation/kbuild/makefiles.txt +2 −24
  4. Documentation/kbuild/modules.txt +1 −1
  5. Kbuild +5 −24
  6. Makefile +105 −114
  7. arch/mips/boot/Makefile +1 −1
  8. arch/powerpc/boot/Makefile +1 −1
  9. arch/s390/boot/Makefile +3 −3
  10. arch/s390/boot/compressed/Makefile +2 −2
  11. arch/s390/scripts/Makefile.chkbss +11 −14
  12. arch/x86/realmode/rm/Makefile +1 −2
  13. init/Kconfig +18 −1
  14. kernel/trace/Kconfig +1 −0
  15. lib/Kconfig.debug +2 −0
  16. scripts/Kbuild.include +9 −12
  17. scripts/Kconfig.include +1 −1
  18. scripts/Makefile +1 −2
  19. scripts/Makefile.build +15 −14
  20. scripts/Makefile.host +4 −2
  21. scripts/Makefile.lib +19 −23
  22. scripts/Makefile.modpost +1 −1
  23. scripts/clang-version.sh +3 −7
  24. scripts/gcc-version.sh +7 −20
  25. scripts/gdb/linux/Makefile +13 −12
  26. scripts/kallsyms.c +5 −8
  27. scripts/kconfig/conf.c +0 −13
  28. scripts/link-vmlinux.sh +10 −36
  29. scripts/mkcompile_h +2 −2
  30. scripts/package/Makefile +4 −4
  31. scripts/package/builddeb +5 −5
  32. scripts/package/buildtar +1 −1
  33. scripts/package/mkdebian +4 −2
Documentation/devicetree/bindings/Makefile+1−1
@@ -15,7 +15,7 @@ DT_TMP_SCHEMA := processed-schema.yaml · 14 unmodified lines
1515 extra-y += $(DT_TMP_SCHEMA)
1616
1717 quiet_cmd_mk_schema = SCHEMA $@
18− cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(filter-out FORCE, $^)
18+ cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
1919
2020 DT_DOCS = $(shell \
2121 cd $(srctree)/$(src) && \
Documentation/kbuild/kbuild.txt+5−10
@@ -232,17 +232,12 @@ KBUILD_LDS · 231 unmodified lines
232232 --------------------------------------------------
233233 The linker script with full path. Assigned by the top-level Makefile.
234234
235−KBUILD_VMLINUX_INIT
235+KBUILD_VMLINUX_OBJS
236236 --------------------------------------------------
237−All object files for the init (first) part of vmlinux.
238−Files specified with KBUILD_VMLINUX_INIT are linked first.
239−
240−KBUILD_VMLINUX_MAIN
241−--------------------------------------------------
242−All object files for the main part of vmlinux.
237+All object files for vmlinux. They are linked to vmlinux in the same
238+order as listed in KBUILD_VMLINUX_OBJS.
243239
244240 KBUILD_VMLINUX_LIBS
245241 --------------------------------------------------
246−All .a "lib" files for vmlinux.
247−KBUILD_VMLINUX_INIT, KBUILD_VMLINUX_MAIN, and KBUILD_VMLINUX_LIBS together
248−specify all the object files used to link vmlinux.
242+All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
243+together specify all the object files used to link vmlinux.
Documentation/kbuild/makefiles.txt+2−24
@@ -154,13 +154,8 @@ more details, with real examples. · 153 unmodified lines
154154
155155 Kbuild compiles all the $(obj-y) files. It then calls
156156 "$(AR) rcSTP" to merge these files into one built-in.a file.
157− This is a thin archive without a symbol table, which makes it
158− unsuitable as a linker input.
159−
160− The scripts/link-vmlinux.sh script later makes an aggregate
161− built-in.a with "${AR} rcsTP", which creates the thin archive
162− with a symbol table and an index, making it a valid input for
163− the final vmlinux link passes.
157+ This is a thin archive without a symbol table. It will be later
158+ linked into vmlinux by scripts/link-vmlinux.sh
164159
165160 The order of files in $(obj-y) is significant. Duplicates in
166161 the lists are allowed: the first instance will be linked into
@@ -504,23 +499,6 @@ more details, with real examples. · 337 unmodified lines
504499 In the above example, -Wno-unused-but-set-variable will be added to
505500 KBUILD_CFLAGS only if gcc really accepts it.
506501
507− cc-version
508− cc-version returns a numerical version of the $(CC) compiler version.
509− The format is <major><minor> where both are two digits. So for example
510− gcc 3.41 would return 0341.
511− cc-version is useful when a specific $(CC) version is faulty in one
512− area, for example -mregparm=3 was broken in some gcc versions
513− even though the option was accepted by gcc.
514−
515− Example:
516− #arch/x86/Makefile
517− cflags-y += $(shell \
518− if [ $(cc-version) -ge 0300 ] ; then \
519− echo "-mregparm=3"; fi ;)
520−
521− In the above example, -mregparm=3 is only used for gcc version greater
522− than or equal to gcc 3.0.
523−
524502 cc-ifversion
525503 cc-ifversion tests the version of $(CC) and equals the fourth parameter
526504 if version expression is true, or the fifth (if given) if the version
Documentation/kbuild/modules.txt+1−1
@@ -140,7 +140,7 @@ executed to make module versioning work. · 139 unmodified lines
140140 make -C $KDIR M=$PWD bar.lst
141141 make -C $KDIR M=$PWD baz.o
142142 make -C $KDIR M=$PWD foo.ko
143− make -C $KDIR M=$PWD /
143+ make -C $KDIR M=$PWD ./
144144
145145
146146 === 3. Creating a Kbuild File for an External Module
Kbuild+5−24
@@ -1,16 +1,9 @@
11 # SPDX-License-Identifier: GPL-2.0
22 #
33 # Kbuild for top-level directory of the kernel
4−# This file takes care of the following:
5−# 1) Generate bounds.h
6−# 2) Generate timeconst.h
7−# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
8−# 4) Check for missing system calls
9−# 5) check atomics headers are up-to-date
10−# 6) Generate constants.py (may need bounds.h)
114
125 #####
13−# 1) Generate bounds.h
6+# Generate bounds.h
147
158 bounds-file := include/generated/bounds.h
169
@@ -21,7 +14,7 @@ $(bounds-file): kernel/bounds.s FORCE · 4 unmodified lines
2114 $(call filechk,offsets,__LINUX_BOUNDS_H__)
2215
2316 #####
24−# 2) Generate timeconst.h
17+# Generate timeconst.h
2518
2619 timeconst-file := include/generated/timeconst.h
2720
@@ -33,8 +26,7 @@ $(timeconst-file): kernel/time/timeconst.bc FORCE · 5 unmodified lines
3326 $(call filechk,gentimeconst)
3427
3528 #####
36−# 3) Generate asm-offsets.h
37−#
29+# Generate asm-offsets.h
3830
3931 offsets-file := include/generated/asm-offsets.h
4032
@@ -47,8 +39,7 @@ $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE · 6 unmodified lines
4739 $(call filechk,offsets,__ASM_OFFSETS_H__)
4840
4941 #####
50−# 4) Check for missing system calls
51−#
42+# Check for missing system calls
5243
5344 always += missing-syscalls
5445 targets += missing-syscalls
@@ -60,8 +51,7 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE · 5 unmodified lines
6051 $(call cmd,syscalls)
6152
6253 #####
63−# 5) Check atomic headers are up-to-date
64−#
54+# Check atomic headers are up-to-date
6555
6656 always += old-atomics
6757 targets += old-atomics
@@ -72,14 +62,5 @@ quiet_cmd_atomics = CALL $< · 4 unmodified lines
7262 old-atomics: scripts/atomic/check-atomics.sh FORCE
7363 $(call cmd,atomics)
7464
75−#####
76−# 6) Generate constants for Python GDB integration
77−#
78−
79−extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
80−
81−build_constants_py: $(timeconst-file) $(bounds-file)
82− @$(MAKE) $(build)=scripts/gdb/linux $@
83−
8465 # Keep these three files during make clean
8566 no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)
Makefile+105−114
@@ -15,19 +15,6 @@ NAME = Shy Crocodile · 14 unmodified lines
1515 PHONY := _all
1616 _all:
1717
18−# Do not use make's built-in rules and variables
19−# (this increases performance and avoids hard-to-debug behaviour)
20−MAKEFLAGS += -rR
21−
22−# Avoid funny character set dependencies
23−unexport LC_ALL
24−LC_COLLATE=C
25−LC_NUMERIC=C
26−export LC_COLLATE LC_NUMERIC
27−
28−# Avoid interference with shell env settings
29−unexport GREP_OPTIONS
30−
3118 # We are using a recursive build, so we need to do a little thinking
3219 # to get the ordering right.
3320 #
@@ -44,6 +31,25 @@ unexport GREP_OPTIONS · 10 unmodified lines
4431 # descending is started. They are now explicitly listed as the
4532 # prepare rule.
4633
34+ifneq ($(sub-make-done),1)
35+
36+# Do not use make's built-in rules and variables
37+# (this increases performance and avoids hard-to-debug behaviour)
38+MAKEFLAGS += -rR
39+
40+# 'MAKEFLAGS += -rR' does not become immediately effective for old
41+# GNU Make versions. Cancel implicit rules for this Makefile.
42+$(lastword $(MAKEFILE_LIST)): ;
43+
44+# Avoid funny character set dependencies
45+unexport LC_ALL
46+LC_COLLATE=C
47+LC_NUMERIC=C
48+export LC_COLLATE LC_NUMERIC
49+
50+# Avoid interference with shell env settings
51+unexport GREP_OPTIONS
52+
4753 # Beautify output
4854 # ---------------------------------------------------------------------------
4955 #
@@ -90,7 +96,6 @@ endif · 40 unmodified lines
9096
9197 ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
9298 quiet=silent_
93− tools_silent=s
9499 endif
95100
96101 export quiet Q KBUILD_VERBOSE
@@ -112,7 +117,6 @@ export quiet Q KBUILD_VERBOSE · 15 unmodified lines
112117
113118 # KBUILD_SRC is not intended to be used by the regular user (for now),
114119 # it is set on invocation of make with KBUILD_OUTPUT or O= specified.
115−ifeq ($(KBUILD_SRC),)
116120
117121 # OK, Make called in directory where kernel src resides
118122 # Do we want to locate output files in a separate directory?
@@ -120,9 +124,6 @@ ifeq ("$(origin O)", "command line") · 1 unmodified line
120124 KBUILD_OUTPUT := $(O)
121125 endif
122126
123−# Cancel implicit rules on top Makefile
124−$(CURDIR)/Makefile Makefile: ;
125−
126127 ifneq ($(words $(subst :, ,$(CURDIR))), 1)
127128 $(error main directory cannot contain spaces nor colons)
128129 endif
@@ -142,6 +143,13 @@ $(if $(KBUILD_OUTPUT),, \ · 13 unmodified lines
142143 # 'sub-make' below.
143144 MAKEFLAGS += --include-dir=$(CURDIR)
144145
146+else
147+
148+# Do not print "Entering directory ..." at all for in-tree build.
149+MAKEFLAGS += --no-print-directory
150+
151+endif # ifneq ($(KBUILD_OUTPUT),)
152+
145153 PHONY += $(MAKECMDGOALS) sub-make
146154
147155 $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
@@ -149,16 +157,12 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make · 1 unmodified line
149157
150158 # Invoke a second make in the output directory, passing relevant variables
151159 sub-make:
152− $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
160+ $(Q)$(MAKE) sub-make-done=1 \
161+ $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \
153162 -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
154163
155−# Leave processing to above invocation of make
156−skip-makefile := 1
157−endif # ifneq ($(KBUILD_OUTPUT),)
158−endif # ifeq ($(KBUILD_SRC),)
159−
164+else # sub-make-done
160165 # We process the rest of the Makefile if this is the final invocation of make
161−ifeq ($(skip-makefile),)
162166
163167 # Do not print "Entering directory ...",
164168 # but we want to display it when entering to the output directory
@@ -215,7 +219,7 @@ objtree := . · 50 unmodified lines
215219 src := $(srctree)
216220 obj := $(objtree)
217221
218−VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
222+VPATH := $(srctree)
219223
220224 export srctree objtree VPATH
221225
@@ -300,8 +304,6 @@ __build_one_by_one: · 78 unmodified lines
300304
301305 else
302306
303−# We need some generic definitions (do not try to remake the file).
304−scripts/Kbuild.include: ;
305307 include scripts/Kbuild.include
306308
307309 # Read KERNELRELEASE from include/config/kernel.release (if it exists)
@@ -390,7 +392,6 @@ OBJDUMP = $(CROSS_COMPILE)objdump · 82 unmodified lines
390392 LEX = flex
391393 YACC = bison
392394 AWK = awk
393−GENKSYMS = scripts/genksyms/genksyms
394395 INSTALLKERNEL := installkernel
395396 DEPMOD = /sbin/depmod
396397 PERL = perl
@@ -429,7 +430,7 @@ LINUXINCLUDE := \ · 32 unmodified lines
429430 KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
430431 KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
431432 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
432− -Werror-implicit-function-declaration -Werror=implicit-int \
433+ -Werror=implicit-function-declaration -Werror=implicit-int \
433434 -Wno-format-security \
434435 -std=gnu89
435436 KBUILD_CPPFLAGS := -D__KERNEL__
@@ -443,7 +444,7 @@ GCC_PLUGINS_CFLAGS := · 7 unmodified lines
443444
444445 export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
445446 export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
446−export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
447+export MAKE LEX YACC AWK INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
447448 export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
448449
449450 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
@@ -476,23 +477,23 @@ scripts_basic: · 26 unmodified lines
476477 $(Q)$(MAKE) $(build)=scripts/basic
477478 $(Q)rm -f .tmp_quiet_recordmcount
478479
479−# To avoid any implicit rule to kick in, define an empty command.
480−scripts/basic/%: scripts_basic ;
481−
482480 PHONY += outputmakefile
483481 # outputmakefile generates a Makefile in the output directory, if using a
484482 # separate output directory. This allows convenient use of make in the
485483 # output directory.
484+# At the same time when output Makefile generated, generate .gitignore to
485+# ignore whole output directory
486486 outputmakefile:
487487 ifneq ($(KBUILD_SRC),)
488488 $(Q)ln -fsn $(srctree) source
489489 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
490+ $(Q){ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
490491 endif
491492
492493 ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
493494 ifneq ($(CROSS_COMPILE),)
494495 CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
495−GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
496+GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
496497 CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
497498 GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
498499 endif
@@ -624,13 +625,22 @@ ifeq ($(may-sync-config),1) · 125 unmodified lines
624625 # because some architectures define CROSS_COMPILE there.
625626 -include include/config/auto.conf.cmd
626627
627−# To avoid any implicit rule to kick in, define an empty command
628−$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
628+$(KCONFIG_CONFIG):
629+ @echo >&2 '***'
630+ @echo >&2 '*** Configuration file "$@" not found!'
631+ @echo >&2 '***'
632+ @echo >&2 '*** Please run some configurator (e.g. "make oldconfig" or'
633+ @echo >&2 '*** "make menuconfig" or "make xconfig").'
634+ @echo >&2 '***'
635+ @/bin/false
629636
630637 # The actual configuration files used during the build are stored in
631638 # include/generated/ and include/config/. Update them if .config is newer than
632639 # include/config/auto.conf (which mirrors .config).
633−include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
640+#
641+# This exploits the 'multi-target pattern rule' trick.
642+# The syncconfig should be executed only once to make all the targets.
643+%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
634644 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
635645 else
636646 # External modules and some install targets need include/generated/autoconf.h
@@ -658,17 +668,13 @@ KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) · 21 unmodified lines
658668
659669 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
660670 KBUILD_CFLAGS += $(call cc-option,-Oz,-Os)
661−KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
662−else
663−ifdef CONFIG_PROFILE_ALL_BRANCHES
664−KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
665671 else
666672 KBUILD_CFLAGS += -O2
667673 endif
668−endif
669674
670−KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
671− $(call cc-disable-warning,maybe-uninitialized,))
675+ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED
676+KBUILD_CFLAGS += -Wno-maybe-uninitialized
677+endif
672678
673679 # Tell gcc to never replace conditional load with a non-conditional one
674680 KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
@@ -729,25 +735,28 @@ KBUILD_CFLAGS += -fomit-frame-pointer · 54 unmodified lines
729735 endif
730736 endif
731737
732−KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
738+DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments)
733739
734740 ifdef CONFIG_DEBUG_INFO
735741 ifdef CONFIG_DEBUG_INFO_SPLIT
736−KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g)
742+DEBUG_CFLAGS += -gsplit-dwarf
737743 else
738−KBUILD_CFLAGS += -g
744+DEBUG_CFLAGS += -g
739745 endif
740746 KBUILD_AFLAGS += -Wa,-gdwarf-2
741747 endif
742748 ifdef CONFIG_DEBUG_INFO_DWARF4
743−KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,)
749+DEBUG_CFLAGS += -gdwarf-4
744750 endif
745751
746752 ifdef CONFIG_DEBUG_INFO_REDUCED
747−KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
753+DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
748754 $(call cc-option,-fno-var-tracking)
749755 endif
750756
757+KBUILD_CFLAGS += $(DEBUG_CFLAGS)
758+export DEBUG_CFLAGS
759+
751760 ifdef CONFIG_FUNCTION_TRACER
752761 ifdef CONFIG_FTRACE_MCOUNT_RECORD
753762 # gcc 5 supports generating the mcount tables directly
@@ -922,19 +931,6 @@ ifdef CONFIG_MODULE_COMPRESS · 168 unmodified lines
922931 endif # CONFIG_MODULE_COMPRESS
923932 export mod_compress_cmd
924933
925−# Select initial ramdisk compression format, default is gzip(1).
926−# This shall be used by the dracut(8) tool while creating an initramfs image.
927−#
928−INITRD_COMPRESS-y := gzip
929−INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
930−INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma
931−INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz
932−INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo
933−INITRD_COMPRESS-$(CONFIG_RD_LZ4) := lz4
934−# do not export INITRD_COMPRESS, since we didn't actually
935−# choose a sane default compression above.
936−# export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
937−
938934 ifdef CONFIG_MODULE_SIG_ALL
939935 $(eval $(call config_filename,MODULE_SIG_KEY))
940936
@@ -976,15 +972,15 @@ libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y))) · 35 unmodified lines
976972 virt-y := $(patsubst %/, %/built-in.a, $(virt-y))
977973
978974 # Externally visible symbols (used by link-vmlinux.sh)
979−export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
980−export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y)
975+export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \
976+ $(drivers-y) $(net-y) $(virt-y)
981977 export KBUILD_VMLINUX_LIBS := $(libs-y1)
982978 export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
983979 export LDFLAGS_vmlinux
984980 # used by scripts/package/Makefile
985981 export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
986982
987−vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
983+vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
988984
989985 # Recurse until adjust_autoksyms.sh is satisfied
990986 PHONY += autoksyms_recursive
@@ -1015,9 +1011,6 @@ cmd_link-vmlinux = \ · 24 unmodified lines
10151011 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
10161012
10171013 vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
1018−ifdef CONFIG_GDB_SCRIPTS
1019− $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1020−endif
10211014 +$(call if_changed,link-vmlinux)
10221015
10231016 targets := vmlinux
@@ -1062,7 +1055,7 @@ scripts: scripts_basic scripts_dtc · 38 unmodified lines
10621055 # archprepare is used in arch Makefiles and when processed asm symlink,
10631056 # version.h and scripts_basic is processed / created.
10641057
1065−PHONY += prepare archprepare prepare1 prepare2 prepare3
1058+PHONY += prepare archprepare prepare1 prepare3
10661059
10671060 # prepare3 is used to check if we are building in a separate output directory,
10681061 # and if so do:
@@ -1077,12 +1070,8 @@ ifneq ($(KBUILD_SRC),) · 8 unmodified lines
10771070 fi;
10781071 endif
10791072
1080−# prepare2 creates a makefile if using a separate output directory.
1081−# From this point forward, .config has been reprocessed, so any rules
1082−# that need to depend on updated CONFIG_* values can be checked here.
1083−prepare2: prepare3 outputmakefile asm-generic
1084−
1085−prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
1073+prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \
1074+ include/generated/utsrelease.h
10861075 $(cmd_crmodverdir)
10871076
10881077 archprepare: archheaders archscripts prepare1 scripts
@@ -1517,6 +1506,18 @@ PHONY += $(DOC_TARGETS) · 428 unmodified lines
15171506 $(DOC_TARGETS): scripts_basic FORCE
15181507 $(Q)$(MAKE) $(build)=Documentation $@
15191508
1509+# Misc
1510+# ---------------------------------------------------------------------------
1511+
1512+PHONY += scripts_gdb
1513+scripts_gdb: prepare
1514+ $(Q)$(MAKE) $(build)=scripts/gdb
1515+ $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1516+
1517+ifdef CONFIG_GDB_SCRIPTS
1518+all: scripts_gdb
1519+endif
1520+
15201521 else # KBUILD_EXTMOD
15211522
15221523 ###
@@ -1668,6 +1669,11 @@ image_name: · 145 unmodified lines
16681669 @echo $(KBUILD_IMAGE)
16691670
16701671 # Clear a bunch of variables before executing the submake
1672+
1673+ifeq ($(quiet),silent_)
1674+tools_silent=s
1675+endif
1676+
16711677 tools/: FORCE
16721678 $(Q)mkdir -p $(objtree)/tools
16731679 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/
@@ -1686,45 +1692,32 @@ tools/%: FORCE · 12 unmodified lines
16861692 # target-dir => where to store outputfile
16871693 # build-dir => directory in kernel source tree to use
16881694
1689−ifeq ($(KBUILD_EXTMOD),)
1690− build-dir = $(patsubst %/,%,$(dir $@))
1691− target-dir = $(dir $@)
1692−else
1693− zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
1694− build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
1695− target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
1696−endif
1697−
1698−%.s: %.c prepare FORCE
1699− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1700−%.i: %.c prepare FORCE
1701− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1702−%.o: %.c prepare FORCE
1703− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1704−%.lst: %.c prepare FORCE
1705− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1706−%.s: %.S prepare FORCE
1707− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1708−%.o: %.S prepare FORCE
1709− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1710−%.symtypes: %.c prepare FORCE
1711− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1712−%.ll: %.c prepare FORCE
1713− $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1695+build-target = $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD)/)$@
1696+build-dir = $(patsubst %/,%,$(dir $(build-target)))
1697+
1698+%.i: prepare FORCE
1699+ $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1700+%.ll: prepare FORCE
1701+ $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1702+%.lst: prepare FORCE
1703+ $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1704+%.o: prepare FORCE
1705+ $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1706+%.s: prepare FORCE
1707+ $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1708+%.symtypes: prepare FORCE
1709+ $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1710+%.ko: %.o
1711+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
17141712
17151713 # Modules
1716−/: prepare FORCE
1717− $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1718− $(build)=$(build-dir)
1714+PHONY += /
1715+/: ./
1716+
17191717 # Make sure the latest headers are built for Documentation
17201718 Documentation/ samples/: headers_install
17211719 %/: prepare FORCE
1722− $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1723− $(build)=$(build-dir)
1724−%.ko: prepare FORCE
1725− $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1726− $(build)=$(build-dir) $(@:.ko=.o)
1727− $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1720+ $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
17281721
17291722 # FIXME Should go into a make.lib or something
17301723 # ===========================================================================
@@ -1748,13 +1741,11 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ · 17 unmodified lines
17481741 # read saved command lines for existing targets
17491742 existing-targets := $(wildcard $(sort $(targets)))
17501743
1751−cmd_files := $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
1752−$(cmd_files): ; # Do not try to update included dependency files
1753−-include $(cmd_files)
1744+-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
17541745
17551746 endif # ifeq ($(config-targets),1)
17561747 endif # ifeq ($(mixed-targets),1)
1757−endif # skip-makefile
1748+endif # sub-make-done
17581749
17591750 PHONY += FORCE
17601751 FORCE:
arch/mips/boot/Makefile+1−1
@@ -115,7 +115,7 @@ endif · 114 unmodified lines
115115 targets += vmlinux.its.S
116116
117117 quiet_cmd_its_cat = CAT $@
118− cmd_its_cat = cat $(filter-out $(PHONY), $^) >$@
118+ cmd_its_cat = cat $(real-prereqs) >$@
119119
120120 $(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE
121121 $(call if_changed,its_cat)
arch/powerpc/boot/Makefile+1−1
@@ -218,7 +218,7 @@ quiet_cmd_bootas = BOOTAS $@ · 217 unmodified lines
218218 cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
219219
220220 quiet_cmd_bootar = BOOTAR $@
221− cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
221+ cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@
222222
223223 $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
224224 $(call if_changed_dep,bootcc)
arch/s390/boot/Makefile+3−3
@@ -58,7 +58,7 @@ $(obj)/compressed/vmlinux: $(obj)/startup.a FORCE · 57 unmodified lines
5858 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
5959
6060 quiet_cmd_ar = AR $@
61− cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(filter $(OBJECTS), $^)
61+ cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
6262
6363 $(obj)/startup.a: $(OBJECTS) FORCE
6464 $(call if_changed,ar)
@@ -67,6 +67,6 @@ install: $(CONFIGURE) $(obj)/bzImage · 2 unmodified lines
6767 sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
6868 System.map "$(INSTALL_PATH)"
6969
70−chkbss := $(OBJECTS)
71−chkbss-target := $(obj)/startup.a
70+chkbss := $(obj-y)
71+chkbss-target := startup.a
7272 include $(srctree)/arch/s390/scripts/Makefile.chkbss
arch/s390/boot/compressed/Makefile+2−2
@@ -63,6 +63,6 @@ OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section · 62 unmodified lines
6363 $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE
6464 $(call if_changed,objcopy)
6565
66−chkbss := $(filter-out $(obj)/piggy.o $(obj)/info.o,$(OBJECTS))
67−chkbss-target := $(obj)/vmlinux.bin
66+chkbss := $(filter-out piggy.o info.o, $(obj-y))
67+chkbss-target := vmlinux.bin
6868 include $(srctree)/arch/s390/scripts/Makefile.chkbss
arch/s390/scripts/Makefile.chkbss+11−14
@@ -1,23 +1,20 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3+chkbss-target ?= built-in.a
4+$(obj)/$(chkbss-target): chkbss
5+
6+chkbss-files := $(addsuffix .chkbss, $(chkbss))
7+clean-files += $(chkbss-files)
8+
9+PHONY += chkbss
10+chkbss: $(addprefix $(obj)/, $(chkbss-files))
11+
312 quiet_cmd_chkbss = CHKBSS $<
4−define cmd_chkbss
5− rm -f $@; \
13+ cmd_chkbss = \
614 if ! $(OBJDUMP) -j .bss -w -h $< | awk 'END { if ($$3) exit 1 }'; then \
715 echo "error: $< .bss section is not empty" >&2; exit 1; \
816 fi; \
917 touch $@;
10−endef
11−
12−chkbss-target ?= $(obj)/built-in.a
13−ifneq (,$(findstring /,$(chkbss)))
14−chkbss-files := $(patsubst %, %.chkbss, $(chkbss))
15−else
16−chkbss-files := $(patsubst %, $(obj)/%.chkbss, $(chkbss))
17−endif
18−
19−$(chkbss-target): $(chkbss-files)
20−targets += $(notdir $(chkbss-files))
2118
22−%.o.chkbss: %.o
19+$(obj)/%.o.chkbss: $(obj)/%.o
2320 $(call cmd,chkbss)
arch/x86/realmode/rm/Makefile+1−2
@@ -37,8 +37,7 @@ REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) · 36 unmodified lines
3737 sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
3838
3939 quiet_cmd_pasyms = PASYMS $@
40− cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \
41− sed $(sed-pasyms) | sort | uniq > $@
40+ cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
4241
4342 targets += pasyms.h
4443 $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
init/Kconfig+18−1
@@ -13,7 +13,7 @@ config CC_IS_GCC · 12 unmodified lines
1313
1414 config GCC_VERSION
1515 int
16− default $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') if CC_IS_GCC
16+ default $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC
1717 default 0
1818
1919 config CC_IS_CLANG
@@ -26,6 +26,22 @@ config CLANG_VERSION · 6 unmodified lines
2626 config CC_HAS_ASM_GOTO
2727 def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
2828
29+config CC_HAS_WARN_MAYBE_UNINITIALIZED
30+ def_bool $(cc-option,-Wmaybe-uninitialized)
31+ help
32+ GCC >= 4.7 supports this option.
33+
34+config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
35+ bool
36+ depends on CC_HAS_WARN_MAYBE_UNINITIALIZED
37+ default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9
38+ help
39+ GCC's -Wmaybe-uninitialized is not reliable by definition.
40+ Lots of false positive warnings are produced in some cases.
41+
42+ If this option is enabled, -Wno-maybe-uninitialzed is passed
43+ to the compiler to suppress maybe-uninitialized warnings.
44+
2945 config CONSTRUCTORS
3046 bool
3147 depends on !UML
@@ -1114,6 +1130,7 @@ config CC_OPTIMIZE_FOR_PERFORMANCE · 1082 unmodified lines
11141130
11151131 config CC_OPTIMIZE_FOR_SIZE
11161132 bool "Optimize for size"
1133+ imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
11171134 help
11181135 Enabling this option will pass "-Os" instead of "-O2" to
11191136 your compiler resulting in a smaller kernel.
kernel/trace/Kconfig+1−0
@@ -370,6 +370,7 @@ config PROFILE_ANNOTATED_BRANCHES · 369 unmodified lines
370370 config PROFILE_ALL_BRANCHES
371371 bool "Profile all if conditionals" if !FORTIFY_SOURCE
372372 select TRACE_BRANCH_PROFILING
373+ imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
373374 help
374375 This tracer profiles all branch conditions. Every if ()
375376 taken in the kernel is recorded whether it hit or miss.
lib/Kconfig.debug+2−0
@@ -196,6 +196,7 @@ config DEBUG_INFO_REDUCED · 195 unmodified lines
196196 config DEBUG_INFO_SPLIT
197197 bool "Produce split debuginfo in .dwo files"
198198 depends on DEBUG_INFO
199+ depends on $(cc-option,-gsplit-dwarf)
199200 help
200201 Generate debug info into separate .dwo files. This significantly
201202 reduces the build directory size for builds with DEBUG_INFO,
@@ -211,6 +212,7 @@ config DEBUG_INFO_SPLIT · 9 unmodified lines
211212 config DEBUG_INFO_DWARF4
212213 bool "Generate dwarf4 debuginfo"
213214 depends on DEBUG_INFO
215+ depends on $(cc-option,-gdwarf-4)
214216 help
215217 Generate dwarf4 debug info. This requires recent versions
216218 of gcc and gdb. It makes the debug information larger.
scripts/Kbuild.include+9−12
@@ -23,6 +23,10 @@ depfile = $(subst $(comma),_,$(dot-target).d) · 22 unmodified lines
2323 # filename of target with directory and extension stripped
2424 basetarget = $(basename $(notdir $@))
2525
26+###
27+# real prerequisites without phony targets
28+real-prereqs = $(filter-out $(PHONY), $^)
29+
2630 ###
2731 # Escape single quote for use in echo statements
2832 escsq = $(subst $(squote),'\$(squote)',$1)
@@ -67,14 +71,10 @@ endef · 38 unmodified lines
6771
6872 # cc-cross-prefix
6973 # Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
70−# Return first prefix where a prefix$(CC) is found in PATH.
71−# If no $(CC) found in PATH with listed prefixes return nothing
72−cc-cross-prefix = \
73− $(word 1, $(foreach c,$(1), \
74− $(shell set -e; \
75− if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
76− echo $(c); \
77− fi)))
74+# Return first <prefix> where a <prefix>gcc is found in PATH.
75+# If no gcc found in PATH with listed prefixes return nothing
76+cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \
77+ $(if $(shell which $(c)gcc), $(c))))
7878
7979 # output directory for tests below
8080 TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
@@ -134,12 +134,9 @@ cc-option-yn = $(call try-run,\ · 53 unmodified lines
134134 cc-disable-warning = $(call try-run,\
135135 $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
136136
137−# cc-version
138−cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
139−
140137 # cc-ifversion
141138 # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
142−cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4))
139+cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
143140
144141 # cc-ldoption
145142 # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
scripts/Kconfig.include+1−1
@@ -27,4 +27,4 @@ cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) · 26 unmodified lines
2727 ld-option = $(success,$(LD) -v $(1))
2828
2929 # gcc version including patch level
30−gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//')
30+gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
scripts/Makefile+1−2
@@ -39,7 +39,6 @@ build_unifdef: $(obj)/unifdef · 38 unmodified lines
3939 subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
4040 subdir-$(CONFIG_MODVERSIONS) += genksyms
4141 subdir-$(CONFIG_SECURITY_SELINUX) += selinux
42−subdir-$(CONFIG_GDB_SCRIPTS) += gdb
4342
4443 # Let clean descend into subdirs
45−subdir- += basic dtc kconfig mod package
44+subdir- += basic dtc gdb kconfig mod package
scripts/Makefile.build+15−14
@@ -63,7 +63,9 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),) · 62 unmodified lines
6363 builtin-target := $(obj)/built-in.a
6464 endif
6565
66+ifdef CONFIG_MODULES
6667 modorder-target := $(obj)/modules.order
68+endif
6769
6870 # We keep a list of all modules in $(MODVERDIR)
6971
@@ -104,7 +106,7 @@ modkern_cflags = \ · 34 unmodified lines
104106 quiet_modtag = $(if $(part-of-module),[M], )
105107
106108 quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
107−cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
109+ cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
108110
109111 $(obj)/%.s: $(src)/%.c FORCE
110112 $(call if_changed_dep,cc_s_c)
@@ -118,7 +120,7 @@ $(obj)/%.i: $(src)/%.c FORCE · 7 unmodified lines
118120 # These mirror gensymtypes_S and co below, keep them in synch.
119121 cmd_gensymtypes_c = \
120122 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
121− $(GENKSYMS) $(if $(1), -T $(2)) \
123+ scripts/genksyms/genksyms $(if $(1), -T $(2)) \
122124 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
123125 $(if $(KBUILD_PRESERVE),-p) \
124126 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
@@ -312,13 +314,13 @@ $(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) · 187 unmodified lines
312314 #
313315 # These mirror gensymtypes_c and co above, keep them in synch.
314316 cmd_gensymtypes_S = \
315− (echo "\#include <linux/kernel.h>" ; \
317+ { echo "\#include <linux/kernel.h>" ; \
316318 echo "\#include <asm/asm-prototypes.h>" ; \
317319 $(CPP) $(a_flags) $< | \
318320 grep "\<___EXPORT_SYMBOL\>" | \
319− sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ) | \
321+ sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
320322 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
321− $(GENKSYMS) $(if $(1), -T $(2)) \
323+ scripts/genksyms/genksyms $(if $(1), -T $(2)) \
322324 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
323325 $(if $(KBUILD_PRESERVE),-p) \
324326 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
@@ -394,17 +396,12 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler · 69 unmodified lines
394396 $(sort $(subdir-obj-y)): $(subdir-ym) ;
395397
396398 #
397−# Rule to compile a set of .o files into one .o file
399+# Rule to compile a set of .o files into one .a file (without symbol table)
398400 #
399401 ifdef builtin-target
400402
401−# built-in.a archives are made with no symbol table or index which
402−# makes them small and fast, but unable to be used by the linker.
403−# scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol
404−# table and index.
405403 quiet_cmd_ar_builtin = AR $@
406− cmd_ar_builtin = rm -f $@; \
407− $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^)
404+ cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
408405
409406 $(builtin-target): $(real-obj-y) FORCE
410407 $(call if_changed,ar_builtin)
@@ -426,13 +423,13 @@ $(modorder-target): $(subdir-ym) FORCE · 15 unmodified lines
426423 $(Q)(cat /dev/null; $(modorder-cmds)) > $@
427424
428425 #
429−# Rule to compile a set of .o files into one .a file
426+# Rule to compile a set of .o files into one .a file (with symbol table)
430427 #
431428 ifdef lib-target
432429 quiet_cmd_link_l_target = AR $@
433430
434431 # lib target archives do get a symbol table and index
435−cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
432+cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
436433
437434 $(lib-target): $(lib-y) FORCE
438435 $(call if_changed,link_l_target)
@@ -457,6 +454,10 @@ targets += $(obj)/lib-ksyms.o · 18 unmodified lines
457454
458455 endif
459456
457+# NOTE:
458+# Do not replace $(filter %.o,^) with $(real-prereqs). When a single object
459+# module is turned into a multi object module, $^ will contain header file
460+# dependencies recorded in the .*.cmd file.
460461 quiet_cmd_link_multi-m = LD [M] $@
461462 cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis)
462463
scripts/Makefile.host+4−2
@@ -67,13 +67,15 @@ _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ · 66 unmodified lines
6767 _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
6868 $(HOSTCXXFLAGS_$(basetarget).o)
6969
70−ifeq ($(KBUILD_SRC),)
7170 __hostc_flags = $(_hostc_flags)
7271 __hostcxx_flags = $(_hostcxx_flags)
73−else
72+
73+ifeq ($(KBUILD_EXTMOD),)
74+ifneq ($(KBUILD_SRC),)
7475 __hostc_flags = -I$(obj) $(call flags,_hostc_flags)
7576 __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
7677 endif
78+endif
7779
7880 hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
7981 hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
scripts/Makefile.lib+19−23
@@ -137,14 +137,14 @@ _c_flags += $(if $(patsubst n%,, \ · 136 unmodified lines
137137 $(CFLAGS_KCOV))
138138 endif
139139
140−# If building the kernel in a separate objtree expand all occurrences
141−# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
142−
143−ifeq ($(KBUILD_SRC),)
144140 __c_flags = $(_c_flags)
145141 __a_flags = $(_a_flags)
146142 __cpp_flags = $(_cpp_flags)
147−else
143+
144+# If building the kernel in a separate objtree expand all occurrences
145+# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
146+ifeq ($(KBUILD_EXTMOD),)
147+ifneq ($(KBUILD_SRC),)
148148
149149 # -I$(obj) locates generated .h files
150150 # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
@@ -155,6 +155,7 @@ __c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \ · 4 unmodified lines
155155 __a_flags = $(call flags,_a_flags)
156156 __cpp_flags = $(call flags,_cpp_flags)
157157 endif
158+endif
158159
159160 c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
160161 -include $(srctree)/include/linux/compiler_types.h \
@@ -230,7 +231,7 @@ $(obj)/%: $(src)/%_shipped · 69 unmodified lines
230231 # ---------------------------------------------------------------------------
231232
232233 quiet_cmd_ld = LD $@
233−cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@
234+ cmd_ld = $(LD) $(ld_flags) $(real-prereqs) -o $@
234235
235236 # Objcopy
236237 # ---------------------------------------------------------------------------
@@ -242,7 +243,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ · 5 unmodified lines
242243 # ---------------------------------------------------------------------------
243244
244245 quiet_cmd_gzip = GZIP $@
245− cmd_gzip = cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@
246+ cmd_gzip = cat $(real-prereqs) | gzip -n -f -9 > $@
246247
247248 # DTC
248249 # ---------------------------------------------------------------------------
@@ -270,7 +271,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) · 21 unmodified lines
270271 # Generate an assembly file to wrap the output of the device tree compiler
271272 quiet_cmd_dt_S_dtb= DTB $@
272273 cmd_dt_S_dtb= \
273−( \
274+{ \
274275 echo '\#include <asm-generic/vmlinux.lds.h>'; \
275276 echo '.section .dtb.init.rodata,"a"'; \
276277 echo '.balign STRUCT_ALIGNMENT'; \
@@ -280,7 +281,7 @@ cmd_dt_S_dtb= \ · 3 unmodified lines
280281 echo '__dtb_$(subst -,_,$(*F))_end:'; \
281282 echo '.global __dtb_$(subst -,_,$(*F))_end'; \
282283 echo '.balign STRUCT_ALIGNMENT'; \
283−) > $@
284+} > $@
284285
285286 $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
286287 $(call if_changed,dt_S_dtb)
@@ -320,7 +321,7 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) · 33 unmodified lines
320321 # append the size as a 32-bit littleendian number as gzip does.
321322 size_append = printf $(shell \
322323 dec_size=0; \
323−for F in $1; do \
324+for F in $(real-prereqs); do \
324325 fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \
325326 dec_size=$$(expr $$dec_size + $$fsize); \
326327 done; \
@@ -334,23 +335,20 @@ printf "%08x\n" $$dec_size | \ · 7 unmodified lines
334335 )
335336
336337 quiet_cmd_bzip2 = BZIP2 $@
337−cmd_bzip2 = (cat $(filter-out FORCE,$^) | \
338− bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@
338+ cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@
339339
340340 # Lzma
341341 # ---------------------------------------------------------------------------
342342
343343 quiet_cmd_lzma = LZMA $@
344−cmd_lzma = (cat $(filter-out FORCE,$^) | \
345− lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@
344+ cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@
346345
347346 quiet_cmd_lzo = LZO $@
348−cmd_lzo = (cat $(filter-out FORCE,$^) | \
349− lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@
347+ cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@
350348
351349 quiet_cmd_lz4 = LZ4 $@
352−cmd_lz4 = (cat $(filter-out FORCE,$^) | \
353− lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@
350+ cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \
351+ $(size_append); } > $@
354352
355353 # U-Boot mkimage
356354 # ---------------------------------------------------------------------------
@@ -392,13 +390,11 @@ quiet_cmd_uimage = UIMAGE $@ · 35 unmodified lines
392390 # big dictionary would increase the memory usage too much in the multi-call
393391 # decompression mode. A BCJ filter isn't used either.
394392 quiet_cmd_xzkern = XZKERN $@
395−cmd_xzkern = (cat $(filter-out FORCE,$^) | \
396− sh $(srctree)/scripts/xz_wrap.sh && \
397− $(call size_append, $(filter-out FORCE,$^))) > $@
393+ cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \
394+ $(size_append); } > $@
398395
399396 quiet_cmd_xzmisc = XZMISC $@
400−cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
401− xz --check=crc32 --lzma2=dict=1MiB) > $@
397+ cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@
402398
403399 # ASM offsets
404400 # ---------------------------------------------------------------------------
scripts/Makefile.modpost+1−1
@@ -122,7 +122,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ · 121 unmodified lines
122122 cmd_ld_ko_o = \
123123 $(LD) -r $(KBUILD_LDFLAGS) \
124124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
125− -o $@ $(filter-out FORCE,$^) ; \
125+ -o $@ $(real-prereqs) ; \
126126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
127127
128128 $(modules): %.ko :%.o %.mod.o FORCE
scripts/clang-version.sh+3−7
@@ -1,14 +1,10 @@
11 #!/bin/sh
22 # SPDX-License-Identifier: GPL-2.0
33 #
4−# clang-version [-p] clang-command
5−#
6−# Prints the compiler version of `clang-command' in a canonical 4-digit form
7−# such as `0500' for clang-5.0 etc.
8−#
9−# With the -p option, prints the patchlevel as well, for example `050001' for
10−# clang-5.0.1 etc.
4+# clang-version clang-command
115 #
6+# Print the compiler version of `clang-command' in a 5 or 6-digit form
7+# such as `50001' for clang-5.0.1 etc.
128
139 compiler="$*"
1410
scripts/gcc-version.sh+7−20
@@ -1,33 +1,20 @@
11 #!/bin/sh
22 # SPDX-License-Identifier: GPL-2.0
33 #
4−# gcc-version [-p] gcc-command
5−#
6−# Prints the gcc version of `gcc-command' in a canonical 4-digit form
7−# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
8−#
9−# With the -p option, prints the patchlevel as well, for example `029503' for
10−# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
4+# gcc-version gcc-command
115 #
12−
13−if [ "$1" = "-p" ] ; then
14− with_patchlevel=1;
15− shift;
16−fi
6+# Print the gcc version of `gcc-command' in a 5 or 6-digit form
7+# such as `29503' for gcc-2.95.3, `30301' for gcc-3.3.1, etc.
178
189 compiler="$*"
1910
2011 if [ ${#compiler} -eq 0 ]; then
21− echo "Error: No compiler specified."
22− printf "Usage:\n\t$0 <gcc-command>\n"
12+ echo "Error: No compiler specified." >&2
13+ printf "Usage:\n\t$0 <gcc-command>\n" >&2
2314 exit 1
2415 fi
2516
2617 MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1)
2718 MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1)
28−if [ "x$with_patchlevel" != "x" ] ; then
29− PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1)
30− printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
31−else
32− printf "%02d%02d\\n" $MAJOR $MINOR
33−fi
19+PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1)
20+printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
scripts/gdb/linux/Makefile+13−12
@@ -1,24 +1,25 @@
11 # SPDX-License-Identifier: GPL-2.0
2−always := gdb-scripts
32
4−SRCTREE := $(abspath $(srctree))
5−
6−$(obj)/gdb-scripts:
73 ifneq ($(KBUILD_SRC),)
8− $(Q)ln -fsn $(SRCTREE)/$(obj)/*.py $(objtree)/$(obj)
4+
5+symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
6+
7+quiet_cmd_symlink = SYMLINK $@
8+ cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@
9+
10+extra-y += $(symlinks)
11+$(addprefix $(obj)/, $(symlinks)): FORCE
12+ $(call if_changed,symlink)
13+
914 endif
10− @:
1115
1216 quiet_cmd_gen_constants_py = GEN $@
1317 cmd_gen_constants_py = \
1418 $(CPP) -E -x c -P $(c_flags) $< > $@ ;\
1519 sed -i '1,/<!-- end-c-headers -->/d;' $@
1620
17−targets += constants.py
18−$(obj)/constants.py: $(SRCTREE)/$(obj)/constants.py.in FORCE
21+extra-y += constants.py
22+$(obj)/constants.py: $(src)/constants.py.in FORCE
1923 $(call if_changed_dep,gen_constants_py)
2024
21−build_constants_py: $(obj)/constants.py
22− @:
23−
24−clean-files := *.pyc *.pyo $(if $(KBUILD_SRC),*.py) $(obj)/constants.py
25+clean-files := *.pyc *.pyo
scripts/kallsyms.c+5−8
@@ -62,11 +62,11 @@ static int all_symbols = 0; · 61 unmodified lines
6262 static int absolute_percpu = 0;
6363 static int base_relative = 0;
6464
65−int token_profit[0x10000];
65+static int token_profit[0x10000];
6666
6767 /* the table that holds the result of the compression */
68−unsigned char best_table[256][2];
69−unsigned char best_table_len[256];
68+static unsigned char best_table[256][2];
69+static unsigned char best_table_len[256];
7070
7171
7272 static void usage(void)
@@ -80,7 +80,7 @@ static void usage(void) · 7 unmodified lines
8080 * This ignores the intensely annoying "mapping symbols" found
8181 * in ARM ELF files: $a, $t and $d.
8282 */
83−static inline int is_arm_mapping_symbol(const char *str)
83+static int is_arm_mapping_symbol(const char *str)
8484 {
8585 return str[0] == '$' && strchr("axtd", str[1])
8686 && (str[2] == '\0' || str[2] == '.');
@@ -331,7 +331,7 @@ static void write_src(void) · 244 unmodified lines
331331 unsigned int *markers;
332332 char buf[KSYM_NAME_LEN];
333333
334− printf("#include <asm/types.h>\n");
334+ printf("#include <asm/bitsperlong.h>\n");
335335 printf("#if BITS_PER_LONG == 64\n");
336336 printf("#define PTR .quad\n");
337337 printf("#define ALGN .balign 8\n");
@@ -596,9 +596,6 @@ static void insert_real_symbols_in_table(void) · 258 unmodified lines
596596 {
597597 unsigned int i, j, c;
598598
599− memset(best_table, 0, sizeof(best_table));
600− memset(best_table_len, 0, sizeof(best_table_len));
601−
602599 for (i = 0; i < table_cnt; i++) {
603600 for (j = 0; j < table[i].len; j++) {
604601 c = table[i].sym[j];
scripts/kconfig/conf.c+0−13
@@ -488,7 +488,6 @@ int main(int ac, char **av) · 487 unmodified lines
488488 const char *progname = av[0];
489489 int opt;
490490 const char *name, *defconfig_file = NULL /* gcc uninit */;
491− struct stat tmpstat;
492491 int no_conf_write = 0;
493492
494493 tty_stdio = isatty(0) && isatty(1);
@@ -560,18 +559,6 @@ int main(int ac, char **av) · 65 unmodified lines
560559 name = av[optind];
561560 conf_parse(name);
562561 //zconfdump(stdout);
563− if (sync_kconfig) {
564− name = conf_get_configname();
565− if (stat(name, &tmpstat)) {
566− fprintf(stderr, "***\n"
567− "*** Configuration file \"%s\" not found!\n"
568− "***\n"
569− "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
570− "*** \"make menuconfig\" or \"make xconfig\").\n"
571− "***\n", name);
572− exit(1);
573− }
574− }
575562
576563 switch (input_mode) {
577564 case defconfig:
scripts/link-vmlinux.sh+10−36
@@ -3,22 +3,17 @@ · 2 unmodified lines
33 #
44 # link vmlinux
55 #
6−# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and
7−# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files
8−# from top-level directories in the kernel tree, others are specified in
9−# arch/$(ARCH)/Makefile. Ordering when linking is important, and
10−# $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives
11−# which are linked conditionally (not within --whole-archive), and do not
12−# require symbol indexes added.
6+# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_OBJS) and
7+# $(KBUILD_VMLINUX_LIBS). Most are built-in.a files from top-level directories
8+# in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
9+# $(KBUILD_VMLINUX_LIBS) are archives which are linked conditionally
10+# (not within --whole-archive), and do not require symbol indexes added.
1311 #
1412 # vmlinux
1513 # ^
1614 # |
17−# +-< $(KBUILD_VMLINUX_INIT)
18−# | +--< init/version.o + more
19−# |
20−# +--< $(KBUILD_VMLINUX_MAIN)
21−# | +--< drivers/built-in.a mm/built-in.a + more
15+# +--< $(KBUILD_VMLINUX_OBJS)
16+# | +--< init/built-in.a drivers/built-in.a mm/built-in.a + more
2217 # |
2318 # +--< $(KBUILD_VMLINUX_LIBS)
2419 # | +--< lib/lib.a + more
@@ -44,24 +39,6 @@ info() · 19 unmodified lines
4439 fi
4540 }
4641
47−# Thin archive build here makes a final archive with symbol table and indexes
48−# from vmlinux objects INIT and MAIN, which can be used as input to linker.
49−# KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes
50−# added.
51−#
52−# Traditional incremental style of link does not require this step
53−#
54−# built-in.a output file
55−#
56−archive_builtin()
57−{
58− info AR built-in.a
59− rm -f built-in.a;
60− ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \
61− ${KBUILD_VMLINUX_INIT} \
62− ${KBUILD_VMLINUX_MAIN}
63−}
64−
6542 # Link of vmlinux.o used for section mismatch analysis
6643 # ${1} output file
6744 modpost_link()
@@ -69,7 +46,7 @@ modpost_link() · 1 unmodified line
6946 local objects
7047
7148 objects="--whole-archive \
72− built-in.a \
49+ ${KBUILD_VMLINUX_OBJS} \
7350 --no-whole-archive \
7451 --start-group \
7552 ${KBUILD_VMLINUX_LIBS} \
@@ -88,7 +65,7 @@ vmlinux_link() · 12 unmodified lines
8865
8966 if [ "${SRCARCH}" != "um" ]; then
9067 objects="--whole-archive \
91− built-in.a \
68+ ${KBUILD_VMLINUX_OBJS} \
9269 --no-whole-archive \
9370 --start-group \
9471 ${KBUILD_VMLINUX_LIBS} \
@@ -99,7 +76,7 @@ vmlinux_link() · 4 unmodified lines
9976 -T ${lds} ${objects}
10077 else
10178 objects="-Wl,--whole-archive \
102− built-in.a \
79+ ${KBUILD_VMLINUX_OBJS} \
10380 -Wl,--no-whole-archive \
10481 -Wl,--start-group \
10582 ${KBUILD_VMLINUX_LIBS} \
@@ -160,7 +137,6 @@ cleanup() · 54 unmodified lines
160137 rm -f .tmp_System.map
161138 rm -f .tmp_kallsyms*
162139 rm -f .tmp_vmlinux*
163− rm -f built-in.a
164140 rm -f System.map
165141 rm -f vmlinux
166142 rm -f vmlinux.o
@@ -217,8 +193,6 @@ fi; · 50 unmodified lines
217193 # final build of init/
218194 ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
219195
220−archive_builtin
221−
222196 #link vmlinux.o
223197 info LD vmlinux.o
224198 modpost_link vmlinux.o
scripts/mkcompile_h+2−2
@@ -62,7 +62,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" · 61 unmodified lines
6262
6363 # Generate a temporary compile.h
6464
65−( echo /\* This file is auto generated, version $VERSION \*/
65+{ echo /\* This file is auto generated, version $VERSION \*/
6666 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
6767
6868 echo \#define UTS_MACHINE \"$ARCH\"
@@ -73,7 +73,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" · 4 unmodified lines
7373 echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
7474
7575 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\"
76−) > .tmpcompile
76+} > .tmpcompile
7777
7878 # Only replace the real compile.h if the new one is different,
7979 # in order to preserve the timestamp and avoid unnecessary
scripts/package/Makefile+4−4
@@ -59,7 +59,7 @@ rpm-pkg: FORCE · 58 unmodified lines
5959 # binrpm-pkg
6060 # ---------------------------------------------------------------------------
6161 binrpm-pkg: FORCE
62− $(MAKE) KBUILD_SRC=
62+ $(MAKE) -f $(srctree)/Makefile
6363 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
6464 +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
6565 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec
@@ -72,11 +72,11 @@ deb-pkg: FORCE · 6 unmodified lines
7272 $(call cmd,src_tar,$(KDEB_SOURCENAME))
7373 origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\
7474 mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz
75− +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -i.git -us -uc
75+ +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -i.git -us -uc
7676
7777 bindeb-pkg: FORCE
7878 $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
79− +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -b -nc -uc
79+ +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
8080
8181 intdeb-pkg: FORCE
8282 +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
@@ -102,7 +102,7 @@ clean-dirs += $(objtree)/snap/ · 19 unmodified lines
102102 # tarball targets
103103 # ---------------------------------------------------------------------------
104104 tar%pkg: FORCE
105− $(MAKE) KBUILD_SRC=
105+ $(MAKE) -f $(srctree)/Makefile
106106 $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
107107
108108 clean-dirs += $(objtree)/tar-install/
scripts/package/builddeb+5−5
@@ -86,12 +86,12 @@ cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path" · 85 unmodified lines
8686 if grep -q "^CONFIG_OF_EARLY_FLATTREE=y" $KCONFIG_CONFIG ; then
8787 # Only some architectures with OF support have this target
8888 if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
89− $MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
89+ $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
9090 fi
9191 fi
9292
9393 if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
94− INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
94+ INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
9595 rm -f "$tmpdir/lib/modules/$version/build"
9696 rm -f "$tmpdir/lib/modules/$version/source"
9797 if [ "$ARCH" = "um" ] ; then
@@ -113,14 +113,14 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then · 15 unmodified lines
113113 # resign stripped modules
114114 MODULE_SIG_ALL="$(grep -s '^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true)"
115115 if [ -n "$MODULE_SIG_ALL" ]; then
116− INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_sign
116+ INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
117117 fi
118118 fi
119119 fi
120120
121121 if [ "$ARCH" != "um" ]; then
122− $MAKE headers_check KBUILD_SRC=
123− $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
122+ $MAKE -f $srctree/Makefile headers_check
123+ $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
124124 fi
125125
126126 # Install the maintainer scripts
scripts/package/buildtar+1−1
@@ -57,7 +57,7 @@ dirs=boot · 56 unmodified lines
5757 # Try to install modules
5858 #
5959 if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then
60− make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install
60+ make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install
6161 dirs="$dirs lib"
6262 fi
6363
scripts/package/mkdebian+4−2
@@ -205,13 +205,15 @@ EOF · 204 unmodified lines
205205 cat <<EOF > debian/rules
206206 #!$(command -v $MAKE) -f
207207
208+srctree ?= .
209+
208210 build:
209211 \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
210− KBUILD_BUILD_VERSION=${revision} KBUILD_SRC=
212+ KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
211213
212214 binary-arch:
213215 \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
214− KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= intdeb-pkg
216+ KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
215217
216218 clean:
217219 rm -rf debian/*tmp debian/files