mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Remove potentially incomplete targets when Kbuid is interrupted by SIGINT etc in case GNU Make may miss to do that when stderr is piped to another program. - Rewrite the single target build so it works more correctly. - Fix rpm-pkg builds with V=1. - List top-level subdirectories in ./Kbuild. - Ignore auto-generated __kstrtab_* and __kstrtabns_* symbols in kallsyms. - Avoid two different modules in lib/zstd/ having shared code, which potentially causes building the common code as build-in and modular back-and-forth. - Unify two modpost invocations to optimize the build process. - Remove head-y syntax in favor of linker scripts for placing particular sections in the head of vmlinux. - Bump the minimal GNU Make version to 3.82. - Clean up misc Makefiles and scripts. * tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits) docs: bump minimal GNU Make version to 3.82 ia64: simplify esi object addition in Makefile Revert "kbuild: Check if linker supports the -X option" kbuild: rebuild .vmlinux.export.o when its prerequisite is updated kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o zstd: Fixing mixed module-builtin objects kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols kallsyms: take the input file instead of reading stdin kallsyms: drop duplicated ignore patterns from kallsyms.c kbuild: reuse mksysmap output for kallsyms mksysmap: update comment about __crc_* kbuild: remove head-y syntax kbuild: use obj-y instead extra-y for objects placed at the head kbuild: hide error checker logs for V=1 builds kbuild: re-run modpost when it is updated kbuild: unify two modpost invocations kbuild: move vmlinux.o rule to the top Makefile kbuild: move .vmlinux.objs rule to Makefile.modpost kbuild: list sub-directories in ./Kbuild Makefile.compiler: replace cc-ifversion with compiler-specific macros ...
This commit is contained in:
@@ -341,19 +341,7 @@ more details, with real examples.
|
||||
|
||||
Examples are:
|
||||
|
||||
1) head objects
|
||||
|
||||
Some objects must be placed at the head of vmlinux. They are
|
||||
directly linked to vmlinux without going through built-in.a
|
||||
A typical use-case is an object that contains the entry point.
|
||||
|
||||
arch/$(SRCARCH)/Makefile should specify such objects as head-y.
|
||||
|
||||
Discussion:
|
||||
Given that we can control the section order in the linker script,
|
||||
why do we need head-y?
|
||||
|
||||
2) vmlinux linker script
|
||||
1) vmlinux linker script
|
||||
|
||||
The linker script for vmlinux is located at
|
||||
arch/$(SRCARCH)/kernel/vmlinux.lds
|
||||
@@ -361,10 +349,6 @@ more details, with real examples.
|
||||
Example::
|
||||
|
||||
# arch/x86/kernel/Makefile
|
||||
extra-y := head_$(BITS).o
|
||||
extra-y += head$(BITS).o
|
||||
extra-y += ebda.o
|
||||
extra-y += platform-quirks.o
|
||||
extra-y += vmlinux.lds
|
||||
|
||||
$(extra-y) should only contain targets needed for vmlinux.
|
||||
@@ -683,22 +667,27 @@ more details, with real examples.
|
||||
In the above example, -Wno-unused-but-set-variable will be added to
|
||||
KBUILD_CFLAGS only if gcc really accepts it.
|
||||
|
||||
cc-ifversion
|
||||
cc-ifversion tests the version of $(CC) and equals the fourth parameter
|
||||
if version expression is true, or the fifth (if given) if the version
|
||||
expression is false.
|
||||
gcc-min-version
|
||||
gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than
|
||||
or equal to the provided value and evaluates to y if so.
|
||||
|
||||
Example::
|
||||
|
||||
#fs/reiserfs/Makefile
|
||||
ccflags-y := $(call cc-ifversion, -lt, 0402, -O1)
|
||||
cflags-$(call gcc-min-version, 70100) := -foo
|
||||
|
||||
In this example, ccflags-y will be assigned the value -O1 if the
|
||||
$(CC) version is less than 4.2.
|
||||
cc-ifversion takes all the shell operators:
|
||||
-eq, -ne, -lt, -le, -gt, and -ge
|
||||
The third parameter may be a text as in this example, but it may also
|
||||
be an expanded variable or a macro.
|
||||
In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and
|
||||
$(CONFIG_GCC_VERSION) is >= 7.1.
|
||||
|
||||
clang-min-version
|
||||
clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater
|
||||
than or equal to the provided value and evaluates to y if so.
|
||||
|
||||
Example::
|
||||
|
||||
cflags-$(call clang-min-version, 110000) := -foo
|
||||
|
||||
In this example, cflags-y will be assigned the value -foo if $(CC) is clang
|
||||
and $(CONFIG_CLANG_VERSION) is >= 11.0.0.
|
||||
|
||||
cc-cross-prefix
|
||||
cc-cross-prefix is used to check if there exists a $(CC) in path with
|
||||
@@ -1099,8 +1088,7 @@ When kbuild executes, the following steps are followed (roughly):
|
||||
- The values of the above variables are expanded in arch/$(SRCARCH)/Makefile.
|
||||
5) All object files are then linked and the resulting file vmlinux is
|
||||
located at the root of the obj tree.
|
||||
The very first objects linked are listed in head-y, assigned by
|
||||
arch/$(SRCARCH)/Makefile.
|
||||
The very first objects linked are listed in scripts/head-object-list.txt.
|
||||
6) Finally, the architecture-specific part does any required post processing
|
||||
and builds the final bootimage.
|
||||
- This includes building boot records
|
||||
@@ -1272,6 +1260,9 @@ When kbuild executes, the following steps are followed (roughly):
|
||||
All object files for vmlinux. They are linked to vmlinux in the same
|
||||
order as listed in KBUILD_VMLINUX_OBJS.
|
||||
|
||||
The objects listed in scripts/head-object-list.txt are exceptions;
|
||||
they are placed before the other objects.
|
||||
|
||||
KBUILD_VMLINUX_LIBS
|
||||
|
||||
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and
|
||||
@@ -1315,8 +1306,7 @@ When kbuild executes, the following steps are followed (roughly):
|
||||
machinery is all architecture-independent.
|
||||
|
||||
|
||||
head-y, core-y, libs-y, drivers-y
|
||||
$(head-y) lists objects to be linked first in vmlinux.
|
||||
core-y, libs-y, drivers-y
|
||||
|
||||
$(libs-y) lists directories where a lib.a archive can be located.
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ GNU C 5.1 gcc --version
|
||||
Clang/LLVM (optional) 11.0.0 clang --version
|
||||
Rust (optional) 1.62.0 rustc --version
|
||||
bindgen (optional) 0.56.0 bindgen --version
|
||||
GNU make 3.81 make --version
|
||||
GNU make 3.82 make --version
|
||||
bash 4.2 bash --version
|
||||
binutils 2.23 ld -v
|
||||
flex 2.5.35 flex --version
|
||||
@@ -108,7 +108,7 @@ It depends on ``libclang``.
|
||||
Make
|
||||
----
|
||||
|
||||
You will need GNU make 3.81 or later to build the kernel.
|
||||
You will need GNU make 3.82 or later to build the kernel.
|
||||
|
||||
Bash
|
||||
----
|
||||
|
||||
72
Kbuild
72
Kbuild
@@ -2,18 +2,18 @@
|
||||
#
|
||||
# Kbuild for top-level directory of the kernel
|
||||
|
||||
#####
|
||||
# Prepare global headers and check sanity before descending into sub-directories
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Generate bounds.h
|
||||
|
||||
bounds-file := include/generated/bounds.h
|
||||
|
||||
always-y := $(bounds-file)
|
||||
targets := kernel/bounds.s
|
||||
|
||||
$(bounds-file): kernel/bounds.s FORCE
|
||||
$(call filechk,offsets,__LINUX_BOUNDS_H__)
|
||||
|
||||
#####
|
||||
# Generate timeconst.h
|
||||
|
||||
timeconst-file := include/generated/timeconst.h
|
||||
@@ -23,12 +23,10 @@ filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
|
||||
$(timeconst-file): kernel/time/timeconst.bc FORCE
|
||||
$(call filechk,gentimeconst)
|
||||
|
||||
#####
|
||||
# Generate asm-offsets.h
|
||||
|
||||
offsets-file := include/generated/asm-offsets.h
|
||||
|
||||
always-y += $(offsets-file)
|
||||
targets += arch/$(SRCARCH)/kernel/asm-offsets.s
|
||||
|
||||
arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
|
||||
@@ -36,24 +34,66 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
|
||||
$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
|
||||
$(call filechk,offsets,__ASM_OFFSETS_H__)
|
||||
|
||||
#####
|
||||
# Check for missing system calls
|
||||
|
||||
always-y += missing-syscalls
|
||||
|
||||
quiet_cmd_syscalls = CALL $<
|
||||
cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
|
||||
|
||||
missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
|
||||
PHONY += missing-syscalls
|
||||
missing-syscalls: scripts/checksyscalls.sh $(offsets-file)
|
||||
$(call cmd,syscalls)
|
||||
|
||||
#####
|
||||
# Check atomic headers are up-to-date
|
||||
# Check the manual modification of atomic headers
|
||||
|
||||
always-y += old-atomics
|
||||
quiet_cmd_check_sha1 = CHKSHA1 $<
|
||||
cmd_check_sha1 = \
|
||||
if ! command -v sha1sum >/dev/null; then \
|
||||
echo "warning: cannot check the header due to sha1sum missing"; \
|
||||
exit 0; \
|
||||
fi; \
|
||||
if [ "$$(sed -n '$$s:// ::p' $<)" != \
|
||||
"$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
|
||||
echo "error: $< has been modified." >&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
touch $@
|
||||
|
||||
quiet_cmd_atomics = CALL $<
|
||||
cmd_atomics = $(CONFIG_SHELL) $<
|
||||
atomic-checks += $(addprefix $(obj)/.checked-, \
|
||||
atomic-arch-fallback.h \
|
||||
atomic-instrumented.h \
|
||||
atomic-long.h)
|
||||
|
||||
old-atomics: scripts/atomic/check-atomics.sh FORCE
|
||||
$(call cmd,atomics)
|
||||
targets += $(atomic-checks)
|
||||
$(atomic-checks): $(obj)/.checked-%: include/linux/atomic/% FORCE
|
||||
$(call if_changed,check_sha1)
|
||||
|
||||
# A phony target that depends on all the preparation targets
|
||||
|
||||
PHONY += prepare
|
||||
prepare: $(offsets-file) missing-syscalls $(atomic-checks)
|
||||
@:
|
||||
|
||||
# Ordinary directory descending
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
obj-y += init/
|
||||
obj-y += usr/
|
||||
obj-y += arch/$(SRCARCH)/
|
||||
obj-y += $(ARCH_CORE)
|
||||
obj-y += kernel/
|
||||
obj-y += certs/
|
||||
obj-y += mm/
|
||||
obj-y += fs/
|
||||
obj-y += ipc/
|
||||
obj-y += security/
|
||||
obj-y += crypto/
|
||||
obj-$(CONFIG_BLOCK) += block/
|
||||
obj-$(CONFIG_IO_URING) += io_uring/
|
||||
obj-$(CONFIG_RUST) += rust/
|
||||
obj-y += $(ARCH_LIB)
|
||||
obj-y += drivers/
|
||||
obj-y += sound/
|
||||
obj-$(CONFIG_SAMPLES) += samples/
|
||||
obj-$(CONFIG_NET) += net/
|
||||
obj-y += virt/
|
||||
obj-y += $(ARCH_DRIVERS)
|
||||
|
||||
184
Makefile
184
Makefile
@@ -538,7 +538,7 @@ LDFLAGS_MODULE =
|
||||
CFLAGS_KERNEL =
|
||||
RUSTFLAGS_KERNEL =
|
||||
AFLAGS_KERNEL =
|
||||
LDFLAGS_vmlinux =
|
||||
export LDFLAGS_vmlinux =
|
||||
|
||||
# Use USERINCLUDE when you must reference the UAPI directories only.
|
||||
USERINCLUDE := \
|
||||
@@ -648,7 +648,7 @@ quiet_cmd_makefile = GEN Makefile
|
||||
} > Makefile
|
||||
|
||||
outputmakefile:
|
||||
$(Q)if [ -f $(srctree)/.config -o \
|
||||
@if [ -f $(srctree)/.config -o \
|
||||
-d $(srctree)/include/config -o \
|
||||
-d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
|
||||
echo >&2 "***"; \
|
||||
@@ -710,6 +710,8 @@ else
|
||||
__all: modules
|
||||
endif
|
||||
|
||||
targets :=
|
||||
|
||||
# Decide whether to build built-in, modular, or both.
|
||||
# Normally, just do built-in.
|
||||
|
||||
@@ -741,11 +743,8 @@ endif
|
||||
|
||||
ifeq ($(KBUILD_EXTMOD),)
|
||||
# Objects we will link into vmlinux / subdirs we need to visit
|
||||
core-y := init/ usr/ arch/$(SRCARCH)/
|
||||
drivers-y := drivers/ sound/
|
||||
drivers-$(CONFIG_SAMPLES) += samples/
|
||||
drivers-$(CONFIG_NET) += net/
|
||||
drivers-y += virt/
|
||||
core-y :=
|
||||
drivers-y :=
|
||||
libs-y := lib/
|
||||
endif # KBUILD_EXTMOD
|
||||
|
||||
@@ -804,7 +803,7 @@ else # !may-sync-config
|
||||
PHONY += include/config/auto.conf
|
||||
|
||||
include/config/auto.conf:
|
||||
$(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
|
||||
@test -e include/generated/autoconf.h -a -e $@ || ( \
|
||||
echo >&2; \
|
||||
echo >&2 " ERROR: Kernel configuration is invalid."; \
|
||||
echo >&2 " include/generated/autoconf.h or $@ are missing.";\
|
||||
@@ -862,7 +861,6 @@ KBUILD_CFLAGS += $(stackp-flags-y)
|
||||
|
||||
KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
|
||||
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
|
||||
KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
|
||||
|
||||
KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
|
||||
KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
|
||||
@@ -1041,7 +1039,6 @@ ifdef CONFIG_CC_IS_GCC
|
||||
KBUILD_CFLAGS += -Wno-maybe-uninitialized
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CC_IS_GCC
|
||||
# The allocators already balk at large sizes, so silence the compiler
|
||||
# warnings for bounds checks involving those possible values. While
|
||||
# -Wno-alloc-size-larger-than would normally be used here, earlier versions
|
||||
@@ -1053,8 +1050,8 @@ ifdef CONFIG_CC_IS_GCC
|
||||
# ignored, continuing to default to PTRDIFF_MAX. So, left with no other
|
||||
# choice, we must perform a versioned check to disable this warning.
|
||||
# https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au
|
||||
KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0901, -Wno-alloc-size-larger-than)
|
||||
endif
|
||||
KBUILD_CFLAGS-$(call gcc-min-version, 90100) += -Wno-alloc-size-larger-than
|
||||
KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
|
||||
|
||||
# disable invalid "can't wrap" optimizations for signed / pointers
|
||||
KBUILD_CFLAGS += -fno-strict-overflow
|
||||
@@ -1110,7 +1107,7 @@ KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
|
||||
LDFLAGS_vmlinux += $(call ld-option, -X,)
|
||||
LDFLAGS_vmlinux += -X
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RELR),y)
|
||||
@@ -1171,41 +1168,27 @@ export MODORDER := $(extmod_prefix)modules.order
|
||||
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
|
||||
|
||||
ifeq ($(KBUILD_EXTMOD),)
|
||||
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
|
||||
core-$(CONFIG_BLOCK) += block/
|
||||
core-$(CONFIG_IO_URING) += io_uring/
|
||||
core-$(CONFIG_RUST) += rust/
|
||||
|
||||
vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
|
||||
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
|
||||
$(libs-y) $(libs-m)))
|
||||
|
||||
vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
|
||||
build-dir := .
|
||||
clean-dirs := $(sort . Documentation \
|
||||
$(patsubst %/,%,$(filter %/, $(core-) \
|
||||
$(drivers-) $(libs-))))
|
||||
|
||||
build-dirs := $(vmlinux-dirs)
|
||||
clean-dirs := $(vmlinux-alldirs)
|
||||
|
||||
subdir-modorder := $(addsuffix /modules.order, $(build-dirs))
|
||||
|
||||
export ARCH_CORE := $(core-y)
|
||||
export ARCH_LIB := $(filter %/, $(libs-y))
|
||||
export ARCH_DRIVERS := $(drivers-y) $(drivers-m)
|
||||
# Externally visible symbols (used by link-vmlinux.sh)
|
||||
KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y))
|
||||
KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y)))
|
||||
|
||||
KBUILD_VMLINUX_OBJS := ./built-in.a
|
||||
ifdef CONFIG_MODULES
|
||||
KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
|
||||
KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
|
||||
else
|
||||
KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y))
|
||||
endif
|
||||
KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y))
|
||||
|
||||
export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
|
||||
export KBUILD_VMLINUX_LIBS
|
||||
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
|
||||
# used by scripts/Makefile.package
|
||||
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools)
|
||||
|
||||
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
|
||||
|
||||
# Recurse until adjust_autoksyms.sh is satisfied
|
||||
PHONY += autoksyms_recursive
|
||||
@@ -1215,7 +1198,7 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS
|
||||
# (this can be evaluated only once include/config/auto.conf has been included)
|
||||
KBUILD_MODULES := 1
|
||||
|
||||
autoksyms_recursive: descend modules.order
|
||||
autoksyms_recursive: $(build-dir) modules.order
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
|
||||
"$(MAKE) -f $(srctree)/Makefile autoksyms_recursive"
|
||||
endif
|
||||
@@ -1229,21 +1212,31 @@ quiet_cmd_autoksyms_h = GEN $@
|
||||
$(autoksyms_h):
|
||||
$(call cmd,autoksyms_h)
|
||||
|
||||
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
|
||||
# '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14
|
||||
quiet_cmd_ar_vmlinux.a = AR $@
|
||||
cmd_ar_vmlinux.a = \
|
||||
rm -f $@; \
|
||||
$(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \
|
||||
$(AR) mPiT $$($(AR) t $@ | head -n1) $@ $$($(AR) t $@ | grep -F --file=$(srctree)/scripts/head-object-list.txt)
|
||||
|
||||
# Final link of vmlinux with optional arch pass after final link
|
||||
cmd_link-vmlinux = \
|
||||
$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \
|
||||
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
|
||||
targets += vmlinux.a
|
||||
vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt autoksyms_recursive FORCE
|
||||
$(call if_changed,ar_vmlinux.a)
|
||||
|
||||
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
|
||||
+$(call if_changed_dep,link-vmlinux)
|
||||
PHONY += vmlinux_o
|
||||
vmlinux_o: vmlinux.a $(KBUILD_VMLINUX_LIBS)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_o
|
||||
|
||||
targets := vmlinux
|
||||
vmlinux.o modules.builtin.modinfo modules.builtin: vmlinux_o
|
||||
@:
|
||||
|
||||
PHONY += vmlinux
|
||||
vmlinux: vmlinux.o $(KBUILD_LDS) modpost
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux
|
||||
|
||||
# The actual objects are generated when descending,
|
||||
# make sure no implicit rule kicks in
|
||||
$(sort $(vmlinux-deps) $(subdir-modorder)): descend ;
|
||||
$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
|
||||
|
||||
filechk_kernel.release = \
|
||||
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
||||
@@ -1269,11 +1262,11 @@ PHONY += prepare archprepare
|
||||
|
||||
archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
|
||||
asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
|
||||
include/generated/autoconf.h remove-stale-files
|
||||
include/generated/compile.h include/generated/autoconf.h remove-stale-files
|
||||
|
||||
prepare0: archprepare
|
||||
$(Q)$(MAKE) $(build)=scripts/mod
|
||||
$(Q)$(MAKE) $(build)=.
|
||||
$(Q)$(MAKE) $(build)=. prepare
|
||||
|
||||
# All the preparing..
|
||||
prepare: prepare0
|
||||
@@ -1335,6 +1328,12 @@ $(version_h): FORCE
|
||||
include/generated/utsrelease.h: include/config/kernel.release FORCE
|
||||
$(call filechk,utsrelease.h)
|
||||
|
||||
filechk_compile.h = $(srctree)/scripts/mkcompile_h \
|
||||
"$(UTS_MACHINE)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
|
||||
|
||||
include/generated/compile.h: FORCE
|
||||
$(call filechk,compile.h)
|
||||
|
||||
PHONY += headerdep
|
||||
headerdep:
|
||||
$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
|
||||
@@ -1509,22 +1508,16 @@ endif
|
||||
|
||||
# Build modules
|
||||
#
|
||||
# A module can be listed more than once in obj-m resulting in
|
||||
# duplicate lines in modules.order files. Those are removed
|
||||
# using awk while concatenating to the final file.
|
||||
|
||||
PHONY += modules
|
||||
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare
|
||||
# *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES
|
||||
# is an exception.
|
||||
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
|
||||
modules: vmlinux
|
||||
endif
|
||||
|
||||
cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
|
||||
|
||||
modules.order: $(subdir-modorder) FORCE
|
||||
$(call if_changed,modules_order)
|
||||
|
||||
targets += modules.order
|
||||
modules: modules_prepare
|
||||
|
||||
# Target to prepare building external modules
|
||||
PHONY += modules_prepare
|
||||
modules_prepare: prepare
|
||||
$(Q)$(MAKE) $(build)=scripts scripts/module.lds
|
||||
|
||||
@@ -1574,7 +1567,8 @@ endif # CONFIG_MODULES
|
||||
# Directories & files removed with 'make clean'
|
||||
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
|
||||
modules.builtin modules.builtin.modinfo modules.nsdeps \
|
||||
compile_commands.json .thinlto-cache rust/test rust/doc
|
||||
compile_commands.json .thinlto-cache rust/test rust/doc \
|
||||
.vmlinux.objs .vmlinux.export.c
|
||||
|
||||
# Directories & files removed with 'make mrproper'
|
||||
MRPROPER_FILES += include/config include/generated \
|
||||
@@ -1862,9 +1856,7 @@ else # KBUILD_EXTMOD
|
||||
KBUILD_BUILTIN :=
|
||||
KBUILD_MODULES := 1
|
||||
|
||||
build-dirs := $(KBUILD_EXTMOD)
|
||||
$(MODORDER): descend
|
||||
@:
|
||||
build-dir := $(KBUILD_EXTMOD)
|
||||
|
||||
compile_commands.json: $(extmod_prefix)compile_commands.json
|
||||
PHONY += compile_commands.json
|
||||
@@ -1893,20 +1885,24 @@ help:
|
||||
@echo ' clean - remove generated files in module directory only'
|
||||
@echo ''
|
||||
|
||||
# no-op for external module builds
|
||||
PHONY += modules_prepare
|
||||
|
||||
endif # KBUILD_EXTMOD
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Modules
|
||||
|
||||
PHONY += modules modules_install
|
||||
PHONY += modules modules_install modules_prepare
|
||||
|
||||
ifdef CONFIG_MODULES
|
||||
|
||||
modules: modules_check
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
$(MODORDER): $(build-dir)
|
||||
@:
|
||||
|
||||
# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
|
||||
# This is solely useful to speed up test compiles.
|
||||
modules: modpost
|
||||
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
|
||||
endif
|
||||
|
||||
PHONY += modules_check
|
||||
modules_check: $(MODORDER)
|
||||
@@ -1933,8 +1929,15 @@ modules modules_install:
|
||||
@echo >&2 '***'
|
||||
@exit 1
|
||||
|
||||
KBUILD_MODULES :=
|
||||
|
||||
endif # CONFIG_MODULES
|
||||
|
||||
PHONY += modpost
|
||||
modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \
|
||||
$(if $(KBUILD_MODULES), modules_check)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
|
||||
# Single targets
|
||||
# ---------------------------------------------------------------------------
|
||||
# To build individual files in subdirectories, you can do like this:
|
||||
@@ -1954,47 +1957,32 @@ single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
|
||||
single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS)) \
|
||||
$(foreach x, o mod, $(patsubst %.ko, %.$x, $(single-ko)))
|
||||
|
||||
$(single-ko): single_modpost
|
||||
$(single-ko): single_modules
|
||||
@:
|
||||
$(single-no-ko): descend
|
||||
$(single-no-ko): $(build-dir)
|
||||
@:
|
||||
|
||||
ifeq ($(KBUILD_EXTMOD),)
|
||||
# For the single build of in-tree modules, use a temporary file to avoid
|
||||
# the situation of modules_install installing an invalid modules.order.
|
||||
MODORDER := .modules.tmp
|
||||
endif
|
||||
|
||||
PHONY += single_modpost
|
||||
single_modpost: $(single-no-ko) modules_prepare
|
||||
# Remove MODORDER when done because it is not the real one.
|
||||
PHONY += single_modules
|
||||
single_modules: $(single-no-ko) modules_prepare
|
||||
$(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$m;) } > $(MODORDER)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
|
||||
endif
|
||||
$(Q)rm -f $(MODORDER)
|
||||
|
||||
KBUILD_MODULES := 1
|
||||
|
||||
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod_prefix), $(single-no-ko))
|
||||
|
||||
# trim unrelated directories
|
||||
build-dirs := $(foreach d, $(build-dirs), \
|
||||
$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
|
||||
single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
|
||||
|
||||
endif
|
||||
|
||||
ifndef CONFIG_MODULES
|
||||
KBUILD_MODULES :=
|
||||
endif
|
||||
|
||||
# Handle descending into subdirectories listed in $(build-dirs)
|
||||
# Preset locale variables to speed up the build process. Limit locale
|
||||
# tweaks to this spot to avoid wrong language settings when running
|
||||
# make menuconfig etc.
|
||||
# Error messages still appears in the original language
|
||||
PHONY += descend $(build-dirs)
|
||||
descend: $(build-dirs)
|
||||
$(build-dirs): prepare
|
||||
$(Q)$(MAKE) $(build)=$@ \
|
||||
single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \
|
||||
need-builtin=1 need-modorder=1
|
||||
PHONY += $(build-dir)
|
||||
$(build-dir): prepare
|
||||
$(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 $(single-goals)
|
||||
|
||||
clean-dirs := $(addprefix _clean_, $(clean-dirs))
|
||||
PHONY += $(clean-dirs) clean
|
||||
@@ -2042,7 +2030,7 @@ quiet_cmd_gen_compile_commands = GEN $@
|
||||
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
|
||||
|
||||
$(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
|
||||
$(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \
|
||||
$(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
|
||||
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
|
||||
$(call if_changed,gen_compile_commands)
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ cflags-y += $(cpuflags-y)
|
||||
# BWX is most important, but we don't really want any emulation ever.
|
||||
KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6
|
||||
|
||||
head-y := arch/alpha/kernel/head.o
|
||||
|
||||
libs-y += arch/alpha/lib/
|
||||
|
||||
# export what is needed by arch/alpha/boot/Makefile
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
# Makefile for the linux kernel.
|
||||
#
|
||||
|
||||
extra-y := head.o vmlinux.lds
|
||||
extra-y := vmlinux.lds
|
||||
asflags-y := $(KBUILD_CFLAGS)
|
||||
ccflags-y := -Wno-sign-compare
|
||||
|
||||
obj-y := entry.o traps.o process.o osf_sys.o irq.o \
|
||||
obj-y := head.o entry.o traps.o process.o osf_sys.o irq.o \
|
||||
irq_alpha.o signal.o setup.o ptrace.o time.o \
|
||||
systbls.o err_common.o io.o bugs.o termios.o
|
||||
|
||||
|
||||
@@ -82,8 +82,6 @@ KBUILD_CFLAGS += $(cflags-y)
|
||||
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
|
||||
KBUILD_LDFLAGS += $(ldflags-y)
|
||||
|
||||
head-y := arch/arc/kernel/head.o
|
||||
|
||||
# w/o this dtb won't embed into kernel binary
|
||||
core-y += arch/arc/boot/dts/
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
|
||||
#
|
||||
|
||||
obj-y := arcksyms.o setup.o irq.o reset.o ptrace.o process.o devtree.o
|
||||
obj-y := head.o arcksyms.o setup.o irq.o reset.o ptrace.o process.o devtree.o
|
||||
obj-y += signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o
|
||||
obj-$(CONFIG_ISA_ARCOMPACT) += entry-compact.o intc-compact.o
|
||||
obj-$(CONFIG_ISA_ARCV2) += entry-arcv2.o intc-arcv2.o
|
||||
@@ -31,4 +31,4 @@ else
|
||||
obj-y += ctx_sw_asm.o
|
||||
endif
|
||||
|
||||
extra-y := vmlinux.lds head.o
|
||||
extra-y := vmlinux.lds
|
||||
|
||||
@@ -137,9 +137,6 @@ KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/uni
|
||||
|
||||
CHECKFLAGS += -D__arm__
|
||||
|
||||
#Default value
|
||||
head-y := arch/arm/kernel/head$(MMUEXT).o
|
||||
|
||||
# Text offset. This list is sorted numerically by address in order to
|
||||
# provide a means to avoid/resolve conflicts in multi-arch kernels.
|
||||
# Note: the 32kB below this value is reserved for use by the kernel
|
||||
|
||||
@@ -88,7 +88,7 @@ obj-$(CONFIG_VDSO) += vdso.o
|
||||
obj-$(CONFIG_EFI) += efi.o
|
||||
obj-$(CONFIG_PARAVIRT) += paravirt.o
|
||||
|
||||
head-y := head$(MMUEXT).o
|
||||
obj-y += head$(MMUEXT).o
|
||||
obj-$(CONFIG_DEBUG_LL) += debug.o
|
||||
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
|
||||
obj-$(CONFIG_ARM_PATCH_PHYS_VIRT) += phys2virt.o
|
||||
@@ -108,4 +108,4 @@ obj-$(CONFIG_HAVE_ARM_SMCCC) += smccc-call.o
|
||||
|
||||
obj-$(CONFIG_GENERIC_CPU_VULNERABILITIES) += spectre.o
|
||||
|
||||
extra-y := $(head-y) vmlinux.lds
|
||||
extra-y := vmlinux.lds
|
||||
|
||||
@@ -133,9 +133,6 @@ ifeq ($(CONFIG_DYNAMIC_FTRACE_WITH_REGS),y)
|
||||
CC_FLAGS_FTRACE := -fpatchable-function-entry=2
|
||||
endif
|
||||
|
||||
# Default value
|
||||
head-y := arch/arm64/kernel/head.o
|
||||
|
||||
ifeq ($(CONFIG_KASAN_SW_TAGS), y)
|
||||
KASAN_SHADOW_SCALE_SHIFT := 4
|
||||
else ifeq ($(CONFIG_KASAN_GENERIC), y)
|
||||
|
||||
@@ -86,8 +86,8 @@ $(obj)/vdso-wrap.o: $(obj)/vdso/vdso.so
|
||||
$(obj)/vdso32-wrap.o: $(obj)/vdso32/vdso.so
|
||||
|
||||
obj-y += probes/
|
||||
head-y := head.o
|
||||
extra-y += $(head-y) vmlinux.lds
|
||||
obj-y += head.o
|
||||
extra-y += vmlinux.lds
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_EFI),y)
|
||||
AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\""
|
||||
|
||||
@@ -59,8 +59,6 @@ LDFLAGS += -EL
|
||||
|
||||
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
|
||||
|
||||
head-y := arch/csky/kernel/head.o
|
||||
|
||||
core-y += arch/csky/$(CSKYABI)/
|
||||
|
||||
libs-y += arch/csky/lib/ \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
extra-y := head.o vmlinux.lds
|
||||
extra-y := vmlinux.lds
|
||||
|
||||
obj-y += entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/
|
||||
obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/
|
||||
obj-y += power.o syscall.o syscall_table.o setup.o io.o
|
||||
obj-y += process.o cpu-probe.o ptrace.o stacktrace.o
|
||||
obj-y += probes/
|
||||
|
||||
@@ -32,5 +32,3 @@ KBUILD_LDFLAGS += $(ldflags-y)
|
||||
TIR_NAME := r19
|
||||
KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
|
||||
KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
|
||||
|
||||
head-y := arch/hexagon/kernel/head.o
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
extra-y := head.o vmlinux.lds
|
||||
extra-y := vmlinux.lds
|
||||
|
||||
obj-y += head.o
|
||||
obj-$(CONFIG_SMP) += smp.o
|
||||
|
||||
obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o
|
||||
|
||||
@@ -44,7 +44,6 @@ quiet_cmd_objcopy = OBJCOPY $@
|
||||
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
|
||||
|
||||
KBUILD_CFLAGS += $(cflags-y)
|
||||
head-y := arch/ia64/kernel/head.o
|
||||
|
||||
libs-y += arch/ia64/lib/
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ ifdef CONFIG_DYNAMIC_FTRACE
|
||||
CFLAGS_REMOVE_ftrace.o = -pg
|
||||
endif
|
||||
|
||||
extra-y := head.o vmlinux.lds
|
||||
extra-y := vmlinux.lds
|
||||
|
||||
obj-y := entry.o efi.o efi_stub.o gate-data.o fsys.o irq.o irq_ia64.o \
|
||||
obj-y := head.o entry.o efi.o efi_stub.o gate-data.o fsys.o irq.o irq_ia64.o \
|
||||
irq_lsapic.o ivt.o pal.o patch.o process.o ptrace.o sal.o \
|
||||
salinfo.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
|
||||
unwind.o mca.o mca_asm.o topology.o dma-mapping.o iosapic.o acpi.o \
|
||||
@@ -34,10 +34,7 @@ mca_recovery-y += mca_drv.o mca_drv_asm.o
|
||||
obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o
|
||||
obj-$(CONFIG_STACKTRACE) += stacktrace.o
|
||||
|
||||
obj-$(CONFIG_IA64_ESI) += esi.o
|
||||
ifneq ($(CONFIG_IA64_ESI),)
|
||||
obj-y += esi_stub.o # must be in kernel proper
|
||||
endif
|
||||
obj-$(CONFIG_IA64_ESI) += esi.o esi_stub.o # must be in kernel proper
|
||||
obj-$(CONFIG_INTEL_IOMMU) += pci-dma.o
|
||||
|
||||
obj-$(CONFIG_ELF_CORE) += elfcore.o
|
||||
|
||||
@@ -79,8 +79,6 @@ CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
|
||||
sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
|
||||
endif
|
||||
|
||||
head-y := arch/loongarch/kernel/head.o
|
||||
|
||||
libs-y += arch/loongarch/lib/
|
||||
libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# Makefile for the Linux/LoongArch kernel.
|
||||
#
|
||||
|
||||
extra-y := head.o vmlinux.lds
|
||||
extra-y := vmlinux.lds
|
||||
|
||||
obj-y += cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
|
||||
obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
|
||||
traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \
|
||||
elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user