Kbuild updates for v5.13
- Evaluate $(call cc-option,...) etc. only for build targets - Add CONFIG_VMLINUX_MAP to generate .map file when linking vmlinux - Remove unnecessary --gcc-toolchains Clang flag because the --prefix flag finds the toolchains - Do not pass Clang's --prefix flag when using the integrated as - Check the assembler version in Kconfig time - Add new CONFIG options, AS_VERSION, AS_IS_GNU, AS_IS_LLVM to clean up some dependencies in Kconfig - Fix invalid Module.symvers creation when building only modules without vmlinux - Fix false-positive modpost warnings when CONFIG_TRIM_UNUSED_KSYMS is set, but there is no module to build - Refactor module installation Makefile - Support zstd for module compression - Convert alpha and ia64 to use generic shell scripts to generate the syscall headers - Add a new elfnote to indicate if the kernel was built with LTO, which will be used by pahole - Flatten the directory structure under include/config/ so CONFIG options and filenames match - Change the deb source package name from linux-$(KERNELRELEASE) to linux-upstream -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmCKOLUVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGdq8P/2z+saxIWGXVWt0ggavR0vimcY4e NQIKGu9uZpo/lfoC78UG8HO+XvzvPUrcRuOX+WIVr2GfScgVnweDukexUAY0/2oi 4UvqhndJ0sjEwRj8mXXJ0O+PED+OtgrqrbhkLq9wHQd/jpSD4XEWXwn1g1XVrTZu WbwP6b1G/Rnjp2lz3HKC017rPkmfsCFQB7r+hbJGKhT0rCaceheUuBvGa/XqLknr IOyaUAY76u3Gtj6fVY1rk70kQgDMF8+LJPgdSSZ/XPCvbNJQAeop36EeRNfmxGIh vQhFJRJeqy+K5MhCpdGtTGYDawlmQVn/f/99SkDw9F04S4ZL2Xnaaqw4L1QDhjTh xBlckbPvmq36F4xSqWd5kYF3iwS+LsEJROwZKFLEVDb3zMsRQPEGQM/556QmrBi2 5KXzwOYEJKuobWr1hQ3PwLumJKTPGLvGEFB3Bq2eG8LrgpOAHPI4ejC2EBu0vCez QbskP2lPlMj3MbL5iZg+6ZRlOChZ7RUrSDj6+iTeOcinmXHqQONCL6qy+um4Rfcb zUkfwTlqM9d88u6AbO2VvQMOobMjvp4bvmqi/Xv8IiTukLHco4tc8zTuySmZwSyI rd3RKYn367qWztX5YyaoGRPVmlMG7ssbRc4fkXiV13vfeZebNfVwlX/CHv9+IWwN RVnMhYBhUZR68h6z =ti9L -----END PGP SIGNATURE----- Merge tag 'kbuild-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - Evaluate $(call cc-option,...) etc. only for build targets - Add CONFIG_VMLINUX_MAP to generate .map file when linking vmlinux - Remove unnecessary --gcc-toolchains Clang flag because the --prefix flag finds the toolchains - Do not pass Clang's --prefix flag when using the integrated as - Check the assembler version in Kconfig time - Add new CONFIG options, AS_VERSION, AS_IS_GNU, AS_IS_LLVM to clean up some dependencies in Kconfig - Fix invalid Module.symvers creation when building only modules without vmlinux - Fix false-positive modpost warnings when CONFIG_TRIM_UNUSED_KSYMS is set, but there is no module to build - Refactor module installation Makefile - Support zstd for module compression - Convert alpha and ia64 to use generic shell scripts to generate the syscall headers - Add a new elfnote to indicate if the kernel was built with LTO, which will be used by pahole - Flatten the directory structure under include/config/ so CONFIG options and filenames match - Change the deb source package name from linux-$(KERNELRELEASE) to linux-upstream * tag 'kbuild-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (42 commits) kbuild: Add $(KBUILD_HOSTLDFLAGS) to 'has_libelf' test kbuild: deb-pkg: change the source package name to linux-upstream tools: do not include scripts/Kbuild.include kbuild: redo fake deps at include/config/*.h kbuild: remove TMPO from try-run MAINTAINERS: add pattern for dummy-tools kbuild: add an elfnote for whether vmlinux is built with lto ia64: syscalls: switch to generic syscallhdr.sh ia64: syscalls: switch to generic syscalltbl.sh alpha: syscalls: switch to generic syscallhdr.sh alpha: syscalls: switch to generic syscalltbl.sh sysctl: use min() helper for namecmp() kbuild: add support for zstd compressed modules kbuild: remove CONFIG_MODULE_COMPRESS kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst kbuild: move module strip/compression code into scripts/Makefile.modinst kbuild: refactor scripts/Makefile.modinst kbuild: rename extmod-prefix to extmod_prefix kbuild: check module name conflict for external modules as well kbuild: show the target directory for depmod log ...
This commit is contained in:
commit
b0030af53a
|
@ -57,8 +57,10 @@ modules.order
|
|||
/tags
|
||||
/TAGS
|
||||
/linux
|
||||
/modules-only.symvers
|
||||
/vmlinux
|
||||
/vmlinux.32
|
||||
/vmlinux.map
|
||||
/vmlinux.symvers
|
||||
/vmlinux-gdb.py
|
||||
/vmlinuz
|
||||
|
|
|
@ -48,7 +48,7 @@ define rule_chkdt
|
|||
$(call cmd,mk_schema)
|
||||
endef
|
||||
|
||||
DT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||')
|
||||
DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_cmd)))
|
||||
|
||||
override DTC_FLAGS := \
|
||||
-Wno-avoid_unnecessary_addr_size \
|
||||
|
|
|
@ -178,6 +178,7 @@ mktables
|
|||
mktree
|
||||
mkutf8data
|
||||
modpost
|
||||
modules-only.symvers
|
||||
modules.builtin
|
||||
modules.builtin.modinfo
|
||||
modules.nsdeps
|
||||
|
@ -252,6 +253,7 @@ vmlinux-*
|
|||
vmlinux.aout
|
||||
vmlinux.bin.all
|
||||
vmlinux.lds
|
||||
vmlinux.map
|
||||
vmlinux.symvers
|
||||
vmlinuz
|
||||
voffset.h
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
|
||||
#
|
||||
# The recursive limitations with Kconfig has some non intuitive implications on
|
||||
# kconfig sematics which are documented here. One known practical implication
|
||||
# kconfig semantics which are documented here. One known practical implication
|
||||
# of the recursive limitation is that drivers cannot negate features from other
|
||||
# drivers if they share a common core requirement and use disjoint semantics to
|
||||
# annotate those requirements, ie, some drivers use "depends on" while others
|
||||
|
|
|
@ -9844,6 +9844,7 @@ F: scripts/*vmlinux*
|
|||
F: scripts/Kbuild*
|
||||
F: scripts/Makefile*
|
||||
F: scripts/basic/
|
||||
F: scripts/dummy-tools/
|
||||
F: scripts/mk*
|
||||
F: scripts/mod/
|
||||
F: scripts/package/
|
||||
|
|
230
Makefile
230
Makefile
|
@ -264,6 +264,10 @@ no-dot-config-targets := $(clean-targets) \
|
|||
$(version_h) headers headers_% archheaders archscripts \
|
||||
%asm-generic kernelversion %src-pkg dt_binding_check \
|
||||
outputmakefile
|
||||
# Installation targets should not require compiler. Unfortunately, vdso_install
|
||||
# is an exception where build artifacts may be updated. This must be fixed.
|
||||
no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
|
||||
headers_install modules_install kernelrelease image_name
|
||||
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
|
||||
image_name
|
||||
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
|
||||
|
@ -271,6 +275,7 @@ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
|
|||
config-build :=
|
||||
mixed-build :=
|
||||
need-config := 1
|
||||
need-compiler := 1
|
||||
may-sync-config := 1
|
||||
single-build :=
|
||||
|
||||
|
@ -280,6 +285,12 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),)
|
||||
ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),)
|
||||
need-compiler :=
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
|
||||
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
|
||||
may-sync-config :=
|
||||
|
@ -339,14 +350,14 @@ __build_one_by_one:
|
|||
|
||||
else # !mixed-build
|
||||
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
||||
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
||||
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
||||
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
|
||||
|
||||
include scripts/subarch.include
|
||||
include $(srctree)/scripts/subarch.include
|
||||
|
||||
# Cross compiling and selecting different set of gcc/bin-utils
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -563,20 +574,18 @@ endif
|
|||
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
|
||||
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
|
||||
# and from include/config/auto.conf.cmd to detect the compiler upgrade.
|
||||
CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1 | sed 's/\#//g')
|
||||
CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1))
|
||||
|
||||
ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
|
||||
ifneq ($(CROSS_COMPILE),)
|
||||
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
|
||||
endif
|
||||
ifeq ($(LLVM_IAS),1)
|
||||
CLANG_FLAGS += -integrated-as
|
||||
else
|
||||
CLANG_FLAGS += -no-integrated-as
|
||||
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
|
||||
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
|
||||
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
|
||||
endif
|
||||
ifneq ($(GCC_TOOLCHAIN),)
|
||||
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
|
||||
endif
|
||||
ifneq ($(LLVM_IAS),1)
|
||||
CLANG_FLAGS += -no-integrated-as
|
||||
endif
|
||||
CLANG_FLAGS += -Werror=unknown-warning-option
|
||||
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
||||
|
@ -584,6 +593,12 @@ KBUILD_AFLAGS += $(CLANG_FLAGS)
|
|||
export CLANG_FLAGS
|
||||
endif
|
||||
|
||||
# Include this also for config targets because some architectures need
|
||||
# cc-cross-prefix to determine CROSS_COMPILE.
|
||||
ifdef need-compiler
|
||||
include $(srctree)/scripts/Makefile.compiler
|
||||
endif
|
||||
|
||||
ifdef config-build
|
||||
# ===========================================================================
|
||||
# *config targets only - make sure prerequisites are updated, and descend
|
||||
|
@ -592,7 +607,7 @@ ifdef config-build
|
|||
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
|
||||
# KBUILD_DEFCONFIG may point out an alternative default configuration
|
||||
# used for 'make defconfig'
|
||||
include arch/$(SRCARCH)/Makefile
|
||||
include $(srctree)/arch/$(SRCARCH)/Makefile
|
||||
export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
|
||||
|
||||
config: outputmakefile scripts_basic FORCE
|
||||
|
@ -679,7 +694,7 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc
|
|||
export RETPOLINE_CFLAGS
|
||||
export RETPOLINE_VDSO_CFLAGS
|
||||
|
||||
include arch/$(SRCARCH)/Makefile
|
||||
include $(srctree)/arch/$(SRCARCH)/Makefile
|
||||
|
||||
ifdef need-config
|
||||
ifdef may-sync-config
|
||||
|
@ -908,7 +923,7 @@ endif
|
|||
ifdef CONFIG_LTO_CLANG
|
||||
ifdef CONFIG_LTO_CLANG_THIN
|
||||
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
|
||||
KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod-prefix).thinlto-cache
|
||||
KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod_prefix).thinlto-cache
|
||||
else
|
||||
CC_FLAGS_LTO := -flto
|
||||
endif
|
||||
|
@ -1069,51 +1084,10 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
|
|||
MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
|
||||
export MODLIB
|
||||
|
||||
#
|
||||
# INSTALL_MOD_STRIP, if defined, will cause modules to be
|
||||
# stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
|
||||
# the default option --strip-debug will be used. Otherwise,
|
||||
# INSTALL_MOD_STRIP value will be used as the options to the strip command.
|
||||
|
||||
ifdef INSTALL_MOD_STRIP
|
||||
ifeq ($(INSTALL_MOD_STRIP),1)
|
||||
mod_strip_cmd = $(STRIP) --strip-debug
|
||||
else
|
||||
mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP)
|
||||
endif # INSTALL_MOD_STRIP=1
|
||||
else
|
||||
mod_strip_cmd = true
|
||||
endif # INSTALL_MOD_STRIP
|
||||
export mod_strip_cmd
|
||||
|
||||
# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed
|
||||
# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP
|
||||
# or CONFIG_MODULE_COMPRESS_XZ.
|
||||
|
||||
mod_compress_cmd = true
|
||||
ifdef CONFIG_MODULE_COMPRESS
|
||||
ifdef CONFIG_MODULE_COMPRESS_GZIP
|
||||
mod_compress_cmd = $(KGZIP) -n -f
|
||||
endif # CONFIG_MODULE_COMPRESS_GZIP
|
||||
ifdef CONFIG_MODULE_COMPRESS_XZ
|
||||
mod_compress_cmd = $(XZ) --lzma2=dict=2MiB -f
|
||||
endif # CONFIG_MODULE_COMPRESS_XZ
|
||||
endif # CONFIG_MODULE_COMPRESS
|
||||
export mod_compress_cmd
|
||||
|
||||
ifdef CONFIG_MODULE_SIG_ALL
|
||||
$(eval $(call config_filename,MODULE_SIG_KEY))
|
||||
|
||||
mod_sign_cmd = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509
|
||||
else
|
||||
mod_sign_cmd = true
|
||||
endif
|
||||
export mod_sign_cmd
|
||||
|
||||
HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
|
||||
|
||||
has_libelf = $(call try-run,\
|
||||
echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
|
||||
echo "int main() {}" | $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
|
||||
|
||||
ifdef CONFIG_STACK_VALIDATION
|
||||
ifeq ($(has_libelf),1)
|
||||
|
@ -1147,9 +1121,9 @@ endif # CONFIG_BPF
|
|||
|
||||
PHONY += prepare0
|
||||
|
||||
extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
|
||||
export MODORDER := $(extmod-prefix)modules.order
|
||||
export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps
|
||||
export extmod_prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
|
||||
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/ block/
|
||||
|
@ -1217,7 +1191,7 @@ cmd_link-vmlinux = \
|
|||
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
|
||||
|
||||
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
|
||||
+$(call if_changed,link-vmlinux)
|
||||
+$(call if_changed_dep,link-vmlinux)
|
||||
|
||||
targets := vmlinux
|
||||
|
||||
|
@ -1362,7 +1336,11 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
|
|||
# Deprecated. It is no-op now.
|
||||
PHONY += headers_check
|
||||
headers_check:
|
||||
@:
|
||||
@echo >&2 "=================== WARNING ==================="
|
||||
@echo >&2 "Since Linux 5.5, 'make headers_check' is no-op,"
|
||||
@echo >&2 "and will be removed after Linux 5.15 release."
|
||||
@echo >&2 "Please remove headers_check from your scripts."
|
||||
@echo >&2 "==============================================="
|
||||
|
||||
ifdef CONFIG_HEADERS_INSTALL
|
||||
prepare: headers
|
||||
|
@ -1460,11 +1438,6 @@ endif
|
|||
|
||||
PHONY += modules
|
||||
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
|
||||
PHONY += modules_check
|
||||
modules_check: modules.order
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
|
||||
|
||||
cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
|
||||
|
||||
|
@ -1478,12 +1451,28 @@ PHONY += modules_prepare
|
|||
modules_prepare: prepare
|
||||
$(Q)$(MAKE) $(build)=scripts scripts/module.lds
|
||||
|
||||
# Target to install modules
|
||||
PHONY += modules_install
|
||||
modules_install: _modinst_ _modinst_post
|
||||
export modules_sign_only :=
|
||||
|
||||
PHONY += _modinst_
|
||||
_modinst_:
|
||||
ifeq ($(CONFIG_MODULE_SIG),y)
|
||||
PHONY += modules_sign
|
||||
modules_sign: modules_install
|
||||
@:
|
||||
|
||||
# modules_sign is a subset of modules_install.
|
||||
# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
|
||||
ifeq ($(filter modules_install,$(MAKECMDGOALS)),)
|
||||
modules_sign_only := y
|
||||
endif
|
||||
endif
|
||||
|
||||
modinst_pre :=
|
||||
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
|
||||
modinst_pre := __modinst_pre
|
||||
endif
|
||||
|
||||
modules_install: $(modinst_pre)
|
||||
PHONY += __modinst_pre
|
||||
__modinst_pre:
|
||||
@rm -rf $(MODLIB)/kernel
|
||||
@rm -f $(MODLIB)/source
|
||||
@mkdir -p $(MODLIB)/kernel
|
||||
|
@ -1495,34 +1484,6 @@ _modinst_:
|
|||
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
|
||||
@cp -f modules.builtin $(MODLIB)/
|
||||
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
||||
|
||||
# This depmod is only for convenience to give the initial
|
||||
# boot a modules.dep even before / is mounted read-write. However the
|
||||
# boot script depmod is the master version.
|
||||
PHONY += _modinst_post
|
||||
_modinst_post: _modinst_
|
||||
$(call cmd,depmod)
|
||||
|
||||
ifeq ($(CONFIG_MODULE_SIG), y)
|
||||
PHONY += modules_sign
|
||||
modules_sign:
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
|
||||
endif
|
||||
|
||||
else # CONFIG_MODULES
|
||||
|
||||
# Modules not configured
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
PHONY += modules modules_install
|
||||
modules modules_install:
|
||||
@echo >&2
|
||||
@echo >&2 "The present kernel configuration has modules disabled."
|
||||
@echo >&2 "Type 'make config' and enable loadable module support."
|
||||
@echo >&2 "Then build a kernel with module support enabled."
|
||||
@echo >&2
|
||||
@exit 1
|
||||
|
||||
endif # CONFIG_MODULES
|
||||
|
||||
|
@ -1534,7 +1495,7 @@ endif # CONFIG_MODULES
|
|||
# make distclean Remove editor backup files, patch leftover files and the like
|
||||
|
||||
# Directories & files removed with 'make clean'
|
||||
CLEAN_FILES += include/ksym vmlinux.symvers \
|
||||
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
|
||||
modules.builtin modules.builtin.modinfo modules.nsdeps \
|
||||
compile_commands.json .thinlto-cache
|
||||
|
||||
|
@ -1771,27 +1732,10 @@ KBUILD_BUILTIN :=
|
|||
KBUILD_MODULES := 1
|
||||
|
||||
build-dirs := $(KBUILD_EXTMOD)
|
||||
PHONY += modules
|
||||
modules: $(MODORDER)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
|
||||
$(MODORDER): descend
|
||||
@:
|
||||
|
||||
PHONY += modules_install
|
||||
modules_install: _emodinst_ _emodinst_post
|
||||
|
||||
install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
|
||||
PHONY += _emodinst_
|
||||
_emodinst_:
|
||||
$(Q)mkdir -p $(MODLIB)/$(install-dir)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
||||
|
||||
PHONY += _emodinst_post
|
||||
_emodinst_post: _emodinst_
|
||||
$(call cmd,depmod)
|
||||
|
||||
compile_commands.json: $(extmod-prefix)compile_commands.json
|
||||
compile_commands.json: $(extmod_prefix)compile_commands.json
|
||||
PHONY += compile_commands.json
|
||||
|
||||
clean-dirs := $(KBUILD_EXTMOD)
|
||||
|
@ -1813,6 +1757,43 @@ PHONY += prepare modules_prepare
|
|||
|
||||
endif # KBUILD_EXTMOD
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Modules
|
||||
|
||||
PHONY += modules modules_install
|
||||
|
||||
ifdef CONFIG_MODULES
|
||||
|
||||
modules: modules_check
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
|
||||
PHONY += modules_check
|
||||
modules_check: $(MODORDER)
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
|
||||
|
||||
quiet_cmd_depmod = DEPMOD $(MODLIB)
|
||||
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
|
||||
$(KERNELRELEASE)
|
||||
|
||||
modules_install:
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
||||
$(call cmd,depmod)
|
||||
|
||||
else # CONFIG_MODULES
|
||||
|
||||
# Modules not configured
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
modules modules_install:
|
||||
@echo >&2 '***'
|
||||
@echo >&2 '*** The present kernel configuration has modules disabled.'
|
||||
@echo >&2 '*** To use the module feature, please run "make menuconfig" etc.'
|
||||
@echo >&2 '*** to enable CONFIG_MODULES.'
|
||||
@echo >&2 '***'
|
||||
@exit 1
|
||||
|
||||
endif # CONFIG_MODULES
|
||||
|
||||
# Single targets
|
||||
# ---------------------------------------------------------------------------
|
||||
# To build individual files in subdirectories, you can do like this:
|
||||
|
@ -1844,12 +1825,12 @@ endif
|
|||
|
||||
PHONY += single_modpost
|
||||
single_modpost: $(single-no-ko) modules_prepare
|
||||
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
|
||||
$(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$m;) } > $(MODORDER)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
|
||||
KBUILD_MODULES := 1
|
||||
|
||||
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
|
||||
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod_prefix), $(single-no-ko))
|
||||
|
||||
# trim unrelated directories
|
||||
build-dirs := $(foreach d, $(build-dirs), \
|
||||
|
@ -1918,12 +1899,12 @@ nsdeps: modules
|
|||
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 \
|
||||
$(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
|
||||
$(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \
|
||||
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
|
||||
$(call if_changed,gen_compile_commands)
|
||||
|
||||
targets += $(extmod-prefix)compile_commands.json
|
||||
targets += $(extmod_prefix)compile_commands.json
|
||||
|
||||
PHONY += clang-tidy clang-analyzer
|
||||
|
||||
|
@ -1931,7 +1912,7 @@ ifdef CONFIG_CC_IS_CLANG
|
|||
quiet_cmd_clang_tools = CHECK $<
|
||||
cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
|
||||
|
||||
clang-tidy clang-analyzer: $(extmod-prefix)compile_commands.json
|
||||
clang-tidy clang-analyzer: $(extmod_prefix)compile_commands.json
|
||||
$(call cmd,clang_tools)
|
||||
else
|
||||
clang-tidy clang-analyzer:
|
||||
|
@ -2001,11 +1982,6 @@ tools/%: FORCE
|
|||
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
|
||||
cmd_rmfiles = rm -rf $(rm-files)
|
||||
|
||||
# Run depmod only if we have System.map and depmod is executable
|
||||
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
|
||||
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
|
||||
$(KERNELRELEASE)
|
||||
|
||||
# read saved command lines for existing targets
|
||||
existing-targets := $(wildcard $(sort $(targets)))
|
||||
|
||||
|
|
|
@ -631,8 +631,7 @@ config ARCH_SUPPORTS_LTO_CLANG_THIN
|
|||
config HAS_LTO_CLANG
|
||||
def_bool y
|
||||
# Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510
|
||||
depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD
|
||||
depends on $(success,test $(LLVM_IAS) -eq 1)
|
||||
depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD && AS_IS_LLVM
|
||||
depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
|
||||
depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
|
||||
depends on ARCH_SUPPORTS_LTO_CLANG
|
||||
|
|
|
@ -6,20 +6,14 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
|
|||
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
|
||||
|
||||
syscall := $(src)/syscall.tbl
|
||||
syshdr := $(srctree)/$(src)/syscallhdr.sh
|
||||
systbl := $(srctree)/$(src)/syscalltbl.sh
|
||||
syshdr := $(srctree)/scripts/syscallhdr.sh
|
||||
systbl := $(srctree)/scripts/syscalltbl.sh
|
||||
|
||||
quiet_cmd_syshdr = SYSHDR $@
|
||||
cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
|
||||
'$(syshdr_abis_$(basetarget))' \
|
||||
'$(syshdr_pfx_$(basetarget))' \
|
||||
'$(syshdr_offset_$(basetarget))'
|
||||
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr $< $@
|
||||
|
||||
quiet_cmd_systbl = SYSTBL $@
|
||||
cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \
|
||||
'$(systbl_abis_$(basetarget))' \
|
||||
'$(systbl_abi_$(basetarget))' \
|
||||
'$(systbl_offset_$(basetarget))'
|
||||
cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
|
||||
|
||||
$(uapi)/unistd_32.h: $(syscall) $(syshdr) FORCE
|
||||
$(call if_changed,syshdr)
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
in="$1"
|
||||
out="$2"
|
||||
my_abis=`echo "($3)" | tr ',' '|'`
|
||||
prefix="$4"
|
||||
offset="$5"
|
||||
|
||||
fileguard=_UAPI_ASM_ALPHA_`basename "$out" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
|
||||
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
|
||||
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
|
||||
printf "#ifndef %s\n" "${fileguard}"
|
||||
printf "#define %s\n" "${fileguard}"
|
||||
printf "\n"
|
||||
|
||||
nxt=0
|
||||
while read nr abi name entry ; do
|
||||
if [ -z "$offset" ]; then
|
||||
printf "#define __NR_%s%s\t%s\n" \
|
||||
"${prefix}" "${name}" "${nr}"
|
||||
else
|
||||
printf "#define __NR_%s%s\t(%s + %s)\n" \
|
||||
"${prefix}" "${name}" "${offset}" "${nr}"
|
||||
fi
|
||||
nxt=$((nr+1))
|
||||
done
|
||||
|
||||
printf "\n"
|
||||
printf "#ifdef __KERNEL__\n"
|
||||
printf "#define __NR_syscalls\t%s\n" "${nxt}"
|
||||
printf "#endif\n"
|
||||
printf "\n"
|
||||
printf "#endif /* %s */\n" "${fileguard}"
|
||||
) > "$out"
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
in="$1"
|
||||
out="$2"
|
||||
my_abis=`echo "($3)" | tr ',' '|'`
|
||||
my_abi="$4"
|
||||
offset="$5"
|
||||
|
||||
emit() {
|
||||
t_nxt="$1"
|
||||
t_nr="$2"
|
||||
t_entry="$3"
|
||||
|
||||
while [ $t_nxt -lt $t_nr ]; do
|
||||
printf "__SYSCALL(%s, sys_ni_syscall, )\n" "${t_nxt}"
|
||||
t_nxt=$((t_nxt+1))
|
||||
done
|
||||
printf "__SYSCALL(%s, %s, )\n" "${t_nxt}" "${t_entry}"
|
||||
}
|
||||
|
||||
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
|
||||
nxt=0
|
||||
if [ -z "$offset" ]; then
|
||||
offset=0
|
||||
fi
|
||||
|
||||
while read nr abi name entry ; do
|
||||
emit $((nxt+offset)) $((nr+offset)) $entry
|
||||
nxt=$((nr+1))
|
||||
done
|
||||
) > "$out"
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#define __SYSCALL(nr, entry, nargs) .quad entry
|
||||
#define __SYSCALL(nr, entry) .quad entry
|
||||
.data
|
||||
.align 3
|
||||
.globl sys_call_table
|
||||
sys_call_table:
|
||||
#include <asm/syscall_table.h>
|
||||
#undef __SYSCALL
|
||||
|
|
|
@ -525,6 +525,9 @@ config ARM64_ERRATUM_843419
|
|||
|
||||
If unsure, say Y.
|
||||
|
||||
config ARM64_LD_HAS_FIX_ERRATUM_843419
|
||||
def_bool $(ld-option,--fix-cortex-a53-843419)
|
||||
|
||||
config ARM64_ERRATUM_1024718
|
||||
bool "Cortex-A55: 1024718: Update of DBM/AP bits without break before make might result in incorrect update"
|
||||
default y
|
||||
|
|
|
@ -21,7 +21,7 @@ LDFLAGS_vmlinux += -shared -Bsymbolic -z notext \
|
|||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
|
||||
ifeq ($(call ld-option, --fix-cortex-a53-843419),)
|
||||
ifneq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
|
||||
$(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
|
||||
else
|
||||
LDFLAGS_vmlinux += --fix-cortex-a53-843419
|
||||
|
|
|
@ -1420,10 +1420,9 @@ END(ftrace_stub)
|
|||
|
||||
#endif /* CONFIG_FUNCTION_TRACER */
|
||||
|
||||
#define __SYSCALL(nr, entry, nargs) data8 entry
|
||||
#define __SYSCALL(nr, entry) data8 entry
|
||||
.rodata
|
||||
.align 8
|
||||
.globl sys_call_table
|
||||
sys_call_table:
|
||||
#include <asm/syscall_table.h>
|
||||
#undef __SYSCALL
|
||||
|
|
|
@ -6,26 +6,18 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
|
|||
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
|
||||
|
||||
syscall := $(src)/syscall.tbl
|
||||
syshdr := $(srctree)/$(src)/syscallhdr.sh
|
||||
systbl := $(srctree)/$(src)/syscalltbl.sh
|
||||
syshdr := $(srctree)/scripts/syscallhdr.sh
|
||||
systbl := $(srctree)/scripts/syscalltbl.sh
|
||||
|
||||
quiet_cmd_syshdr = SYSHDR $@
|
||||
cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
|
||||
'$(syshdr_abis_$(basetarget))' \
|
||||
'$(syshdr_pfx_$(basetarget))' \
|
||||
'$(syshdr_offset_$(basetarget))'
|
||||
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --offset __NR_Linux $< $@
|
||||
|
||||
quiet_cmd_systbl = SYSTBL $@
|
||||
cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \
|
||||
'$(systbl_abis_$(basetarget))' \
|
||||
'$(systbl_abi_$(basetarget))' \
|
||||
'$(systbl_offset_$(basetarget))'
|
||||
cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
|
||||
|
||||
syshdr_offset_unistd_64 := __NR_Linux
|
||||
$(uapi)/unistd_64.h: $(syscall) $(syshdr) FORCE
|
||||
$(call if_changed,syshdr)
|
||||
|
||||
systbl_offset_syscall_table := 1024
|
||||
$(kapi)/syscall_table.h: $(syscall) $(systbl) FORCE
|
||||
$(call if_changed,systbl)
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
in="$1"
|
||||
out="$2"
|
||||
my_abis=`echo "($3)" | tr ',' '|'`
|
||||
prefix="$4"
|
||||
offset="$5"
|
||||
|
||||
fileguard=_UAPI_ASM_IA64_`basename "$out" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
|
||||
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
|
||||
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
|
||||
printf "#ifndef %s\n" "${fileguard}"
|
||||
printf "#define %s\n" "${fileguard}"
|
||||
printf "\n"
|
||||
|
||||
nxt=0
|
||||
while read nr abi name entry ; do
|
||||
if [ -z "$offset" ]; then
|
||||
printf "#define __NR_%s%s\t%s\n" \
|
||||
"${prefix}" "${name}" "${nr}"
|
||||
else
|
||||
printf "#define __NR_%s%s\t(%s + %s)\n" \
|
||||
"${prefix}" "${name}" "${offset}" "${nr}"
|
||||
fi
|
||||
nxt=$((nr+1))
|
||||
done
|
||||
|
||||
printf "\n"
|
||||
printf "#ifdef __KERNEL__\n"
|
||||
printf "#define __NR_syscalls\t%s\n" "${nxt}"
|
||||
printf "#endif\n"
|
||||
printf "\n"
|
||||
printf "#endif /* %s */\n" "${fileguard}"
|
||||
) > "$out"
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
in="$1"
|
||||
out="$2"
|
||||
my_abis=`echo "($3)" | tr ',' '|'`
|
||||
my_abi="$4"
|
||||
offset="$5"
|
||||
|
||||
emit() {
|
||||
t_nxt="$1"
|
||||
t_nr="$2"
|
||||
t_entry="$3"
|
||||
|
||||
while [ $t_nxt -lt $t_nr ]; do
|
||||
printf "__SYSCALL(%s, sys_ni_syscall, )\n" "${t_nxt}"
|
||||
t_nxt=$((t_nxt+1))
|
||||
done
|
||||
printf "__SYSCALL(%s, %s, )\n" "${t_nxt}" "${t_entry}"
|
||||
}
|
||||
|
||||
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
|
||||
nxt=0
|
||||
if [ -z "$offset" ]; then
|
||||
offset=0
|
||||
fi
|
||||
|
||||
while read nr abi name entry ; do
|
||||
emit $((nxt+offset)) $((nr+offset)) $entry
|
||||
nxt=$((nr+1))
|
||||
done
|
||||
) > "$out"
|
|
@ -138,8 +138,8 @@ ifdef CONFIG_X86_X32
|
|||
x32_ld_ok := $(call try-run,\
|
||||
/bin/echo -e '1: .quad 1b' | \
|
||||
$(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \
|
||||
$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
|
||||
$(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
|
||||
$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMP.o" && \
|
||||
$(LD) -m elf32_x86_64 "$$TMP.o" -o "$$TMP",y,n)
|
||||
ifeq ($(x32_ld_ok),y)
|
||||
CONFIG_X86_X32_ABI := y
|
||||
KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI
|
||||
|
|
|
@ -94,14 +94,9 @@ static void sysctl_print_dir(struct ctl_dir *dir)
|
|||
|
||||
static int namecmp(const char *name1, int len1, const char *name2, int len2)
|
||||
{
|
||||
int minlen;
|
||||
int cmp;
|
||||
|
||||
minlen = len1;
|
||||
if (minlen > len2)
|
||||
minlen = len2;
|
||||
|
||||
cmp = memcmp(name1, name2, minlen);
|
||||
cmp = memcmp(name1, name2, min(len1, len2));
|
||||
if (cmp == 0)
|
||||
cmp = len1 - len2;
|
||||
return cmp;
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
* This header exists to force full rebuild when the compiler is upgraded.
|
||||
*
|
||||
* When fixdep scans this, it will find this string "CONFIG_CC_VERSION_TEXT"
|
||||
* and add dependency on include/config/cc/version/text.h, which is touched
|
||||
* and add dependency on include/config/CC_VERSION_TEXT, which is touched
|
||||
* by Kconfig when the version string from the compiler changes.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __ELFNOTE_LTO_H
|
||||
#define __ELFNOTE_LTO_H
|
||||
|
||||
#include <linux/elfnote.h>
|
||||
|
||||
#define LINUX_ELFNOTE_LTO_INFO 0x101
|
||||
|
||||
#ifdef CONFIG_LTO
|
||||
#define BUILD_LTO_INFO ELFNOTE32("Linux", LINUX_ELFNOTE_LTO_INFO, 1)
|
||||
#else
|
||||
#define BUILD_LTO_INFO ELFNOTE32("Linux", LINUX_ELFNOTE_LTO_INFO, 0)
|
||||
#endif
|
||||
|
||||
#endif /* __ELFNOTE_LTO_H */
|
77
init/Kconfig
77
init/Kconfig
|
@ -21,7 +21,7 @@ config CC_VERSION_TEXT
|
|||
|
||||
- Ensure full rebuild when the compiler is updated
|
||||
include/linux/compiler-version.h contains this option in the comment
|
||||
line so fixdep adds include/config/cc/version/text.h into the
|
||||
line so fixdep adds include/config/CC_VERSION_TEXT into the
|
||||
auto-generated dependency. When the compiler is updated, syncconfig
|
||||
will touch it and then every file will be rebuilt.
|
||||
|
||||
|
@ -41,6 +41,18 @@ config CLANG_VERSION
|
|||
default $(cc-version) if CC_IS_CLANG
|
||||
default 0
|
||||
|
||||
config AS_IS_GNU
|
||||
def_bool $(success,test "$(as-name)" = GNU)
|
||||
|
||||
config AS_IS_LLVM
|
||||
def_bool $(success,test "$(as-name)" = LLVM)
|
||||
|
||||
config AS_VERSION
|
||||
int
|
||||
# Use clang version if this is the integrated assembler
|
||||
default CLANG_VERSION if AS_IS_LLVM
|
||||
default $(as-version)
|
||||
|
||||
config LD_IS_BFD
|
||||
def_bool $(success,test "$(ld-name)" = BFD)
|
||||
|
||||
|
@ -2229,40 +2241,53 @@ config MODULE_SIG_HASH
|
|||
default "sha384" if MODULE_SIG_SHA384
|
||||
default "sha512" if MODULE_SIG_SHA512
|
||||
|
||||
config MODULE_COMPRESS
|
||||
bool "Compress modules on installation"
|
||||
help
|
||||
|
||||
Compresses kernel modules when 'make modules_install' is run; gzip or
|
||||
xz depending on "Compression algorithm" below.
|
||||
|
||||
module-init-tools MAY support gzip, and kmod MAY support gzip and xz.
|
||||
|
||||
Out-of-tree kernel modules installed using Kbuild will also be
|
||||
compressed upon installation.
|
||||
|
||||
Note: for modules inside an initrd or initramfs, it's more efficient
|
||||
to compress the whole initrd or initramfs instead.
|
||||
|
||||
Note: This is fully compatible with signed modules.
|
||||
|
||||
If in doubt, say N.
|
||||
|
||||
choice
|
||||
prompt "Compression algorithm"
|
||||
depends on MODULE_COMPRESS
|
||||
default MODULE_COMPRESS_GZIP
|
||||
prompt "Module compression mode"
|
||||
help
|
||||
This determines which sort of compression will be used during
|
||||
'make modules_install'.
|
||||
This option allows you to choose the algorithm which will be used to
|
||||
compress modules when 'make modules_install' is run. (or, you can
|
||||
choose to not compress modules at all.)
|
||||
|
||||
GZIP (default) and XZ are supported.
|
||||
External modules will also be compressed in the same way during the
|
||||
installation.
|
||||
|
||||
For modules inside an initrd or initramfs, it's more efficient to
|
||||
compress the whole initrd or initramfs instead.
|
||||
|
||||
This is fully compatible with signed modules.
|
||||
|
||||
Please note that the tool used to load modules needs to support the
|
||||
corresponding algorithm. module-init-tools MAY support gzip, and kmod
|
||||
MAY support gzip, xz and zstd.
|
||||
|
||||
Your build system needs to provide the appropriate compression tool
|
||||
to compress the modules.
|
||||
|
||||
If in doubt, select 'None'.
|
||||
|
||||
config MODULE_COMPRESS_NONE
|
||||
bool "None"
|
||||
help
|
||||
Do not compress modules. The installed modules are suffixed
|
||||
with .ko.
|
||||
|
||||
config MODULE_COMPRESS_GZIP
|
||||
bool "GZIP"
|
||||
help
|
||||
Compress modules with GZIP. The installed modules are suffixed
|
||||
with .ko.gz.
|
||||
|
||||
config MODULE_COMPRESS_XZ
|
||||
bool "XZ"
|
||||
help
|
||||
Compress modules with XZ. The installed modules are suffixed
|
||||
with .ko.xz.
|
||||
|
||||
config MODULE_COMPRESS_ZSTD
|
||||
bool "ZSTD"
|
||||
help
|
||||
Compress modules with ZSTD. The installed modules are suffixed
|
||||
with .ko.zst.
|
||||
|
||||
endchoice
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <generated/compile.h>
|
||||
#include <linux/build-salt.h>
|
||||
#include <linux/elfnote-lto.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/uts.h>
|
||||
#include <linux/utsname.h>
|
||||
|
@ -45,3 +46,4 @@ const char linux_proc_banner[] =
|
|||
" (" LINUX_COMPILER ") %s\n";
|
||||
|
||||
BUILD_SALT;
|
||||
BUILD_LTO_INFO;
|
||||
|
|
|
@ -36,7 +36,7 @@ all_dirs="$all_dirs $dir_list"
|
|||
#
|
||||
# When Kconfig regenerates include/generated/autoconf.h, its timestamp is
|
||||
# updated, but the contents might be still the same. When any CONFIG option is
|
||||
# changed, Kconfig touches the corresponding timestamp file include/config/*.h.
|
||||
# changed, Kconfig touches the corresponding timestamp file include/config/*.
|
||||
# Hence, the md5sum detects the configuration change anyway. We do not need to
|
||||
# check include/generated/autoconf.h explicitly.
|
||||
#
|
||||
|
|
|
@ -284,8 +284,7 @@ config DEBUG_INFO_DWARF4
|
|||
|
||||
config DEBUG_INFO_DWARF5
|
||||
bool "Generate DWARF Version 5 debuginfo"
|
||||
depends on GCC_VERSION >= 50000 || CC_IS_CLANG
|
||||
depends on CC_IS_GCC || $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS))
|
||||
depends on GCC_VERSION >= 50000 || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
|
||||
depends on !DEBUG_INFO_BTF
|
||||
help
|
||||
Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
|
||||
|
@ -449,6 +448,16 @@ config VMLINUX_VALIDATION
|
|||
depends on STACK_VALIDATION && DEBUG_ENTRY && !PARAVIRT
|
||||
default y
|
||||
|
||||
config VMLINUX_MAP
|
||||
bool "Generate vmlinux.map file when linking"
|
||||
depends on EXPERT
|
||||
help
|
||||
Selecting this option will pass "-Map=vmlinux.map" to ld
|
||||
when linking vmlinux. That file can be useful for verifying
|
||||
and debugging magic section games, and for seeing which
|
||||
pieces of code get eliminated with
|
||||
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION.
|
||||
|
||||
config DEBUG_FORCE_WEAK_PER_CPU
|
||||
bool "Force weak per-cpu definitions"
|
||||
depends on DEBUG_KERNEL
|
||||
|
|
|
@ -67,86 +67,6 @@ define filechk
|
|||
fi
|
||||
endef
|
||||
|
||||
######
|
||||
# gcc support functions
|
||||
# See documentation in Documentation/kbuild/makefiles.rst
|
||||
|
||||
# cc-cross-prefix
|
||||
# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
|
||||
# Return first <prefix> where a <prefix>gcc is found in PATH.
|
||||
# If no gcc found in PATH with listed prefixes return nothing
|
||||
#
|
||||
# Note: '2>/dev/null' is here to force Make to invoke a shell. Otherwise, it
|
||||
# would try to directly execute the shell builtin 'command'. This workaround
|
||||
# should be kept for a long time since this issue was fixed only after the
|
||||
# GNU Make 4.2.1 release.
|
||||
cc-cross-prefix = $(firstword $(foreach c, $(1), \
|
||||
$(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
|
||||
|
||||
# output directory for tests below
|
||||
TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
|
||||
|
||||
# try-run
|
||||
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
|
||||
# Exit code chooses option. "$$TMP" serves as a temporary file and is
|
||||
# automatically cleaned up.
|
||||
try-run = $(shell set -e; \
|
||||
TMP=$(TMPOUT)/tmp; \
|
||||
TMPO=$(TMPOUT)/tmp.o; \
|
||||
mkdir -p $(TMPOUT); \
|
||||
trap "rm -rf $(TMPOUT)" EXIT; \
|
||||
if ($(1)) >/dev/null 2>&1; \
|
||||
then echo "$(2)"; \
|
||||
else echo "$(3)"; \
|
||||
fi)
|
||||
|
||||
# as-option
|
||||
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
|
||||
|
||||
as-option = $(call try-run,\
|
||||
$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
|
||||
|
||||
# as-instr
|
||||
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
|
||||
|
||||
as-instr = $(call try-run,\
|
||||
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
|
||||
|
||||
# __cc-option
|
||||
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
||||
__cc-option = $(call try-run,\
|
||||
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
|
||||
|
||||
# cc-option
|
||||
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
|
||||
|
||||
cc-option = $(call __cc-option, $(CC),\
|
||||
$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
|
||||
|
||||
# cc-option-yn
|
||||
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
|
||||
cc-option-yn = $(call try-run,\
|
||||
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
|
||||
|
||||
# cc-disable-warning
|
||||
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
|
||||
cc-disable-warning = $(call try-run,\
|
||||
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
|
||||
|
||||
# cc-ifversion
|
||||
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
|
||||
cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
|
||||
|
||||
# ld-option
|
||||
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
|
||||
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
|
||||
|
||||
# ld-ifversion
|
||||
# Usage: $(call ld-ifversion, -ge, 22252, y)
|
||||
ld-ifversion = $(shell [ $(CONFIG_LD_VERSION)0 $(1) $(2)0 ] && echo $(3) || echo $(4))
|
||||
|
||||
######
|
||||
|
||||
###
|
||||
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
|
||||
# Usage:
|
||||
|
|
|
@ -45,6 +45,12 @@ $(error-if,$(success,test -z "$(cc-info)"),Sorry$(comma) this compiler is not su
|
|||
cc-name := $(shell,set -- $(cc-info) && echo $1)
|
||||
cc-version := $(shell,set -- $(cc-info) && echo $2)
|
||||
|
||||
# Get the assembler name, version, and error out if it is not supported.
|
||||
as-info := $(shell,$(srctree)/scripts/as-version.sh $(CC) $(CLANG_FLAGS))
|
||||
$(error-if,$(success,test -z "$(as-info)"),Sorry$(comma) this assembler is not supported.)
|
||||
as-name := $(shell,set -- $(as-info) && echo $1)
|
||||
as-version := $(shell,set -- $(as-info) && echo $2)
|
||||
|
||||
# Get the linker name, version, and error out if it is not supported.
|
||||
ld-info := $(shell,$(srctree)/scripts/ld-version.sh $(LD))
|
||||
$(error-if,$(success,test -z "$(ld-info)"),Sorry$(comma) this linker is not supported.)
|
||||
|
|
|
@ -14,10 +14,10 @@ src := $(subst /generated,,$(obj))
|
|||
|
||||
# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
|
||||
ifneq ($(SRCARCH),um)
|
||||
include $(generic)/Kbuild
|
||||
include $(srctree)/$(generic)/Kbuild
|
||||
endif
|
||||
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
|
||||
redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
|
||||
|
|
|
@ -35,27 +35,28 @@ subdir-ccflags-y :=
|
|||
# Read auto.conf if it exists, otherwise ignore
|
||||
-include include/config/auto.conf
|
||||
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Makefile.compiler
|
||||
|
||||
# The filename Kbuild has precedence over Makefile
|
||||
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
||||
kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
|
||||
include $(kbuild-file)
|
||||
|
||||
include scripts/Makefile.lib
|
||||
include $(srctree)/scripts/Makefile.lib
|
||||
|
||||
# Do not include hostprogs rules unless needed.
|
||||
# $(sort ...) is used here to remove duplicated words and excessive spaces.
|
||||
hostprogs := $(sort $(hostprogs))
|
||||
ifneq ($(hostprogs),)
|
||||
include scripts/Makefile.host
|
||||
include $(srctree)/scripts/Makefile.host
|
||||
endif
|
||||
|
||||
# Do not include userprogs rules unless needed.
|
||||
# $(sort ...) is used here to remove duplicated words and excessive spaces.
|
||||
userprogs := $(sort $(userprogs))
|
||||
ifneq ($(userprogs),)
|
||||
include scripts/Makefile.userprogs
|
||||
include $(srctree)/scripts/Makefile.userprogs
|
||||
endif
|
||||
|
||||
ifndef obj
|
||||
|
@ -238,8 +239,8 @@ endif # CONFIG_STACK_VALIDATION
|
|||
|
||||
# Rebuild all objects when objtool changes, or is enabled/disabled.
|
||||
objtool_dep = $(objtool_obj) \
|
||||
$(wildcard include/config/orc/unwinder.h \
|
||||
include/config/stack/validation.h)
|
||||
$(wildcard include/config/ORC_UNWINDER \
|
||||
include/config/STACK_VALIDATION)
|
||||
|
||||
ifdef CONFIG_TRIM_UNUSED_KSYMS
|
||||
cmd_gen_ksymdeps = \
|
||||
|
@ -444,11 +445,11 @@ quiet_cmd_link_multi-m = LD [M] $@
|
|||
cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^)
|
||||
endif
|
||||
|
||||
$(multi-used-m): FORCE
|
||||
$(multi-obj-m): FORCE
|
||||
$(call if_changed,link_multi-m)
|
||||
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
|
||||
$(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
|
||||
|
||||
targets += $(multi-used-m)
|
||||
targets += $(multi-obj-m)
|
||||
targets := $(filter-out $(PHONY), $(targets))
|
||||
|
||||
# Add intermediate targets:
|
||||
|
|
|
@ -8,7 +8,7 @@ src := $(obj)
|
|||
PHONY := __clean
|
||||
__clean:
|
||||
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
# The filename Kbuild has precedence over Makefile
|
||||
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
# cc-cross-prefix
|
||||
# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
|
||||
# Return first <prefix> where a <prefix>gcc is found in PATH.
|
||||
# If no gcc found in PATH with listed prefixes return nothing
|
||||
#
|
||||
# Note: '2>/dev/null' is here to force Make to invoke a shell. Otherwise, it
|
||||
# would try to directly execute the shell builtin 'command'. This workaround
|
||||
# should be kept for a long time since this issue was fixed only after the
|
||||
# GNU Make 4.2.1 release.
|
||||
cc-cross-prefix = $(firstword $(foreach c, $(1), \
|
||||
$(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
|
||||
|
||||
# output directory for tests below
|
||||
TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
|
||||
|
||||
# try-run
|
||||
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
|
||||
# Exit code chooses option. "$$TMP" serves as a temporary file and is
|
||||
# automatically cleaned up.
|
||||
try-run = $(shell set -e; \
|
||||
TMP=$(TMPOUT)/tmp; \
|
||||
mkdir -p $(TMPOUT); \
|
||||
trap "rm -rf $(TMPOUT)" EXIT; \
|
||||
if ($(1)) >/dev/null 2>&1; \
|
||||
then echo "$(2)"; \
|
||||
else echo "$(3)"; \
|
||||
fi)
|
||||
|
||||
# as-option
|
||||
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
|
||||
|
||||
as-option = $(call try-run,\
|
||||
$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
|
||||
|
||||
# as-instr
|
||||
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
|
||||
|
||||
as-instr = $(call try-run,\
|
||||
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
|
||||
|
||||
# __cc-option
|
||||
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
||||
__cc-option = $(call try-run,\
|
||||
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
|
||||
|
||||
# cc-option
|
||||
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
|
||||
|
||||
cc-option = $(call __cc-option, $(CC),\
|
||||
$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
|
||||
|
||||
# cc-option-yn
|
||||
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
|
||||
cc-option-yn = $(call try-run,\
|
||||
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
|
||||
|
||||
# cc-disable-warning
|
||||
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
|
||||
cc-disable-warning = $(call try-run,\
|
||||
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
|
||||
|
||||
# cc-ifversion
|
||||
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
|
||||
cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
|
||||
|
||||
# ld-option
|
||||
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
|
||||
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
|
||||
|
||||
# ld-ifversion
|
||||
# Usage: $(call ld-ifversion, -ge, 22252, y)
|
||||
ld-ifversion = $(shell [ $(CONFIG_LD_VERSION)0 $(1) $(2)0 ] && echo $(3) || echo $(4))
|
|
@ -14,7 +14,7 @@ PHONY := __dtbs_install
|
|||
__dtbs_install:
|
||||
|
||||
include include/config/auto.conf
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
include $(src)/Makefile
|
||||
|
||||
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
PHONY := __headers
|
||||
__headers:
|
||||
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
src := $(srctree)/$(obj)
|
||||
gen := $(objtree)/$(subst include/,include/generated/,$(obj))
|
||||
|
|
|
@ -45,16 +45,16 @@ obj-y := $(filter-out %/, $(obj-y))
|
|||
endif
|
||||
|
||||
# Expand $(foo-objs) $(foo-y) by calling $(call suffix-search,foo.o,-objs -y)
|
||||
suffix-search = $(foreach s,$(2),$($(1:.o=$s)))
|
||||
suffix-search = $(strip $(foreach s, $2, $($(1:.o=$s))))
|
||||
# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
|
||||
multi-search = $(sort $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)), $(m))))
|
||||
multi-used-y := $(call multi-search,$(obj-y),-objs -y)
|
||||
multi-used-m := $(call multi-search,$(obj-m),-objs -y -m)
|
||||
multi-used := $(multi-used-y) $(multi-used-m)
|
||||
multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $m)))
|
||||
multi-obj-y := $(call multi-search,$(obj-y),-objs -y)
|
||||
multi-obj-m := $(call multi-search,$(obj-m),-objs -y -m)
|
||||
multi-obj-ym := $(multi-obj-y) $(multi-obj-m)
|
||||
|
||||
# Replace multi-part objects by their individual parts,
|
||||
# including built-in.a from subdirectories
|
||||
real-search = $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)),$(call suffix-search,$(m),$(2)),$(m)))
|
||||
real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $(call suffix-search, $m, $2), $m))
|
||||
real-obj-y := $(call real-search, $(obj-y),-objs -y)
|
||||
real-obj-m := $(call real-search, $(obj-m),-objs -y -m)
|
||||
|
||||
|
@ -104,12 +104,12 @@ obj-m := $(addprefix $(obj)/,$(obj-m))
|
|||
lib-y := $(addprefix $(obj)/,$(lib-y))
|
||||
real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
|
||||
real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
|
||||
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
|
||||
multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
|
||||
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
|
||||
|
||||
# Finds the multi-part object the current object will be linked into.
|
||||
# If the object belongs to two or more multi-part objects, list them all.
|
||||
modname-multi = $(sort $(foreach m,$(multi-used),\
|
||||
modname-multi = $(sort $(foreach m,$(multi-obj-ym),\
|
||||
$(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))
|
||||
|
||||
__modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
|
||||
|
|
|
@ -6,30 +6,109 @@
|
|||
PHONY := __modinst
|
||||
__modinst:
|
||||
|
||||
include scripts/Kbuild.include
|
||||
include include/config/auto.conf
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order))
|
||||
modules := $(sort $(shell cat $(MODORDER)))
|
||||
|
||||
ifeq ($(KBUILD_EXTMOD),)
|
||||
dst := $(MODLIB)/kernel
|
||||
else
|
||||
INSTALL_MOD_DIR ?= extra
|
||||
dst := $(MODLIB)/$(INSTALL_MOD_DIR)
|
||||
endif
|
||||
|
||||
suffix-y :=
|
||||
suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz
|
||||
suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
|
||||
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
|
||||
|
||||
modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules))
|
||||
|
||||
PHONY += $(modules)
|
||||
__modinst: $(modules)
|
||||
@:
|
||||
|
||||
# Don't stop modules_install if we can't sign external modules.
|
||||
quiet_cmd_modules_install = INSTALL $@
|
||||
cmd_modules_install = \
|
||||
mkdir -p $(2) ; \
|
||||
cp $@ $(2) ; \
|
||||
$(mod_strip_cmd) $(2)/$(notdir $@) ; \
|
||||
$(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \
|
||||
$(mod_compress_cmd) $(2)/$(notdir $@)
|
||||
quiet_cmd_none =
|
||||
cmd_none = :
|
||||
|
||||
# Modules built outside the kernel source tree go into extra by default
|
||||
INSTALL_MOD_DIR ?= extra
|
||||
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
|
||||
#
|
||||
# Installation
|
||||
#
|
||||
quiet_cmd_install = INSTALL $@
|
||||
cmd_install = mkdir -p $(dir $@); cp $< $@
|
||||
|
||||
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
|
||||
# Strip
|
||||
#
|
||||
# INSTALL_MOD_STRIP, if defined, will cause modules to be stripped after they
|
||||
# are installed. If INSTALL_MOD_STRIP is '1', then the default option
|
||||
# --strip-debug will be used. Otherwise, INSTALL_MOD_STRIP value will be used
|
||||
# as the options to the strip command.
|
||||
ifdef INSTALL_MOD_STRIP
|
||||
|
||||
$(modules):
|
||||
$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
|
||||
ifeq ($(INSTALL_MOD_STRIP),1)
|
||||
strip-option := --strip-debug
|
||||
else
|
||||
strip-option := $(INSTALL_MOD_STRIP)
|
||||
endif
|
||||
|
||||
quiet_cmd_strip = STRIP $@
|
||||
cmd_strip = $(STRIP) $(strip-option) $@
|
||||
|
||||
else
|
||||
|
||||
quiet_cmd_strip =
|
||||
cmd_strip = :
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# Signing
|
||||
# Don't stop modules_install even if we can't sign external modules.
|
||||
#
|
||||
ifeq ($(CONFIG_MODULE_SIG_ALL),y)
|
||||
quiet_cmd_sign = SIGN $@
|
||||
$(eval $(call config_filename,MODULE_SIG_KEY))
|
||||
cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \
|
||||
$(if $(KBUILD_EXTMOD),|| true)
|
||||
else
|
||||
quiet_cmd_sign :=
|
||||
cmd_sign := :
|
||||
endif
|
||||
|
||||
ifeq ($(modules_sign_only),)
|
||||
|
||||
$(dst)/%.ko: $(extmod_prefix)%.ko FORCE
|
||||
$(call cmd,install)
|
||||
$(call cmd,strip)
|
||||
$(call cmd,sign)
|
||||
|
||||
else
|
||||
|
||||
$(dst)/%.ko: FORCE
|
||||
$(call cmd,sign)
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# Compression
|
||||
#
|
||||
quiet_cmd_gzip = GZIP $@
|
||||
cmd_gzip = $(KGZIP) -n -f $<
|
||||
quiet_cmd_xz = XZ $@
|
||||
cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
|
||||
quiet_cmd_zstd = ZSTD $@
|
||||
cmd_zstd = $(ZSTD) -T0 --rm -f -q $<
|
||||
|
||||
$(dst)/%.ko.gz: $(dst)/%.ko FORCE
|
||||
$(call cmd,gzip)
|
||||
|
||||
$(dst)/%.ko.xz: $(dst)/%.ko FORCE
|
||||
$(call cmd,xz)
|
||||
|
||||
$(dst)/%.ko.zst: $(dst)/%.ko FORCE
|
||||
$(call cmd,zstd)
|
||||
|
||||
PHONY += FORCE
|
||||
FORCE:
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
# Step 4 is solely used to allow module versioning in external modules,
|
||||
# where the CRC of each module is retrieved from the Module.symvers file.
|
||||
|
||||
# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined
|
||||
# symbols in the final module linking stage
|
||||
# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
|
||||
# This is solely useful to speed up test compiles
|
||||
|
||||
|
@ -41,16 +39,15 @@ PHONY := __modpost
|
|||
__modpost:
|
||||
|
||||
include include/config/auto.conf
|
||||
include scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
# for ld_flags
|
||||
include scripts/Makefile.lib
|
||||
include $(srctree)/scripts/Makefile.lib
|
||||
|
||||
MODPOST = scripts/mod/modpost \
|
||||
$(if $(CONFIG_MODVERSIONS),-m) \
|
||||
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
|
||||
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
|
||||
$(if $(KBUILD_MODPOST_WARN),-w) \
|
||||
-o $@
|
||||
|
||||
ifdef MODPOST_VMLINUX
|
||||
|
@ -68,7 +65,20 @@ else
|
|||
ifeq ($(KBUILD_EXTMOD),)
|
||||
|
||||
input-symdump := vmlinux.symvers
|
||||
output-symdump := Module.symvers
|
||||
output-symdump := modules-only.symvers
|
||||
|
||||
quiet_cmd_cat = GEN $@
|
||||
cmd_cat = cat $(real-prereqs) > $@
|
||||
|
||||
ifneq ($(wildcard vmlinux.symvers),)
|
||||
|
||||
__modpost: Module.symvers
|
||||
Module.symvers: vmlinux.symvers modules-only.symvers FORCE
|
||||
$(call if_changed,cat)
|
||||
|
||||
targets += Module.symvers
|
||||
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
|
@ -88,9 +98,11 @@ output-symdump := $(KBUILD_EXTMOD)/Module.symvers
|
|||
|
||||
endif
|
||||
|
||||
existing-input-symdump := $(wildcard $(input-symdump))
|
||||
|
||||
# modpost options for modules (both in-kernel and external)
|
||||
MODPOST += \
|
||||
$(addprefix -i ,$(wildcard $(input-symdump))) \
|
||||
$(addprefix -i ,$(existing-input-symdump)) \
|
||||
$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \
|
||||
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)
|
||||
|
||||
|
@ -104,6 +116,7 @@ VPATH :=
|
|||
$(input-symdump):
|
||||
@echo >&2 'WARNING: Symbol version dump "$@" is missing.'
|
||||
@echo >&2 ' Modules may not have dependencies or modversions.'
|
||||
@echo >&2 ' You may get many unresolved symbol warnings.'
|
||||
|
||||
ifdef CONFIG_LTO_CLANG
|
||||
# With CONFIG_LTO_CLANG, .o files might be LLVM bitcode, so we need to run
|
||||
|
@ -123,6 +136,11 @@ endif
|
|||
|
||||
modules := $(sort $(shell cat $(MODORDER)))
|
||||
|
||||
# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined symbols
|
||||
ifneq ($(KBUILD_MODPOST_WARN)$(filter-out $(existing-input-symdump), $(input-symdump)),)
|
||||
MODPOST += -w
|
||||
endif
|
||||
|
||||
# Read out modules.order to pass in modpost.
|
||||
# Otherwise, allmodconfig would fail with "Argument list too long".
|
||||
quiet_cmd_modpost = MODPOST $@
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
# ==========================================================================
|
||||
# Signing modules
|
||||
# ==========================================================================
|
||||
|
||||
PHONY := __modsign
|
||||
__modsign:
|
||||
|
||||
include scripts/Kbuild.include
|
||||
|
||||
modules := $(sort $(shell cat modules.order))
|
||||
|
||||
PHONY += $(modules)
|
||||
__modsign: $(modules)
|
||||
@:
|
||||
|
||||
quiet_cmd_sign_ko = SIGN [M] $(2)/$(notdir $@)
|
||||
cmd_sign_ko = $(mod_sign_cmd) $(2)/$(notdir $@)
|
||||
|
||||
# Modules built outside the kernel source tree go into extra by default
|
||||
INSTALL_MOD_DIR ?= extra
|
||||
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
|
||||
|
||||
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
|
||||
|
||||
$(modules):
|
||||
$(call cmd,sign_ko,$(MODLIB)/$(modinst_dir))
|
||||
|
||||
.PHONY: $(PHONY)
|
|
@ -25,7 +25,7 @@ include $(srctree)/scripts/Kbuild.include
|
|||
|
||||
# Remove hyphens since they have special meaning in RPM filenames
|
||||
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
|
||||
KDEB_SOURCENAME ?= linux-$(KERNELRELEASE)
|
||||
KDEB_SOURCENAME ?= linux-upstream
|
||||
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
|
||||
export KDEB_SOURCENAME
|
||||
# Include only those top-level files that are needed by make, plus the GPL copy
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Print the assembler name and its version in a 5 or 6-digit form.
|
||||
# Also, perform the minimum version check.
|
||||
# (If it is the integrated assembler, return 0 as the version, and
|
||||
# skip the version check.)
|
||||
|
||||
set -e
|
||||
|
||||
# Convert the version string x.y.z to a canonical 5 or 6-digit form.
|
||||
get_canonical_version()
|
||||
{
|
||||
IFS=.
|
||||
set -- $1
|
||||
|
||||
# If the 2nd or 3rd field is missing, fill it with a zero.
|
||||
#
|
||||
# The 4th field, if present, is ignored.
|
||||
# This occurs in development snapshots as in 2.35.1.20201116
|
||||
echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
|
||||
}
|
||||
|
||||
# Clang fails to handle -Wa,--version unless -no-integrated-as is given.
|
||||
# We check -(f)integrated-as, expecting it is explicitly passed in for the
|
||||
# integrated assembler case.
|
||||
check_integrated_as()
|
||||
{
|
||||
while [ $# -gt 0 ]; do
|
||||
if [ "$1" = -integrated-as -o "$1" = -fintegrated-as ]; then
|
||||
# For the intergrated assembler, we do not check the
|
||||
# version here. It is the same as the clang version, and
|
||||
# it has been already checked by scripts/cc-version.sh.
|
||||
echo LLVM 0
|
||||
exit 0
|
||||
fi
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
check_integrated_as "$@"
|
||||
|
||||
orig_args="$@"
|
||||
|
||||
# Get the first line of the --version output.
|
||||
IFS='
|
||||
'
|
||||
set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler /dev/null -o /dev/null 2>/dev/null)
|
||||
|
||||
# Split the line on spaces.
|
||||
IFS=' '
|
||||
set -- $1
|
||||
|
||||
min_tool_version=$(dirname $0)/min-tool-version.sh
|
||||
|
||||
if [ "$1" = GNU -a "$2" = assembler ]; then
|
||||
shift $(($# - 1))
|
||||
version=$1
|
||||
min_version=$($min_tool_version binutils)
|
||||
name=GNU
|
||||
else
|
||||
echo "$orig_args: unknown assembler invoked" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Some distributions append a package release number, as in 2.34-4.fc32
|
||||
# Trim the hyphen and any characters that follow.
|
||||
version=${version%-*}
|
||||
|
||||
cversion=$(get_canonical_version $version)
|
||||
min_cversion=$(get_canonical_version $min_version)
|
||||
|
||||
if [ "$cversion" -lt "$min_cversion" ]; then
|
||||
echo >&2 "***"
|
||||
echo >&2 "*** Assembler is too old."
|
||||
echo >&2 "*** Your $name assembler version: $version"
|
||||
echo >&2 "*** Minimum $name assembler version: $min_version"
|
||||
echo >&2 "***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $name $cversion
|
|
@ -34,7 +34,7 @@
|
|||
* the config symbols are rebuilt.
|
||||
*
|
||||
* So if the user changes his CONFIG_HIS_DRIVER option, only the objects
|
||||
* which depend on "include/config/his/driver.h" will be rebuilt,
|
||||
* which depend on "include/config/HIS_DRIVER" will be rebuilt,
|
||||
* so most likely only his driver ;-)
|
||||
*
|
||||
* The idea above dates, by the way, back to Michael E Chastain, AFAIK.
|
||||
|
@ -74,7 +74,7 @@
|
|||
*
|
||||
* and then basically copies the .<target>.d file to stdout, in the
|
||||
* process filtering out the dependency on autoconf.h and adding
|
||||
* dependencies on include/config/my/option.h for every
|
||||
* dependencies on include/config/MY_OPTION for every
|
||||
* CONFIG_MY_OPTION encountered in any of the prerequisites.
|
||||
*
|
||||
* We don't even try to really parse the header files, but
|
||||
|
@ -107,8 +107,8 @@ static void usage(void)
|
|||
|
||||
/*
|
||||
* In the intended usage of this program, the stdout is redirected to .*.cmd
|
||||
* files. The return value of printf() and putchar() must be checked to catch
|
||||
* any error, e.g. "No space left on device".
|
||||
* files. The return value of printf() must be checked to catch any error,
|
||||
* e.g. "No space left on device".
|
||||
*/
|
||||
static void xprintf(const char *format, ...)
|
||||
{
|
||||
|
@ -124,38 +124,6 @@ static void xprintf(const char *format, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
static void xputchar(int c)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = putchar(c);
|
||||
if (ret == EOF) {
|
||||
perror("fixdep");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out a dependency path from a symbol name
|
||||
*/
|
||||
static void print_dep(const char *m, int slen, const char *dir)
|
||||
{
|
||||
int c, prev_c = '/', i;
|
||||
|
||||
xprintf(" $(wildcard %s/", dir);
|
||||
for (i = 0; i < slen; i++) {
|
||||
c = m[i];
|
||||
if (c == '_')
|
||||
c = '/';
|
||||
else
|
||||
c = tolower(c);
|
||||
if (c != '/' || prev_c != '/')
|
||||
xputchar(c);
|
||||
prev_c = c;
|
||||
}
|
||||
xprintf(".h) \\\n");
|
||||
}
|
||||
|
||||
struct item {
|
||||
struct item *next;
|
||||
unsigned int len;
|
||||
|
@ -220,7 +188,8 @@ static void use_config(const char *m, int slen)
|
|||
return;
|
||||
|
||||
define_config(m, slen, hash);
|
||||
print_dep(m, slen, "include/config");
|
||||
/* Print out a dependency path from a symbol name. */
|
||||
xprintf(" $(wildcard include/config/%.*s) \\\n", slen, m);
|
||||
}
|
||||
|
||||
/* test if s ends in sub */
|
||||
|
|
|
@ -6,18 +6,6 @@
|
|||
|
||||
set -e
|
||||
|
||||
# When you raise the minimum compiler version, please update
|
||||
# Documentation/process/changes.rst as well.
|
||||
gcc_min_version=4.9.0
|
||||
clang_min_version=10.0.1
|
||||
icc_min_version=16.0.3 # temporary
|
||||
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
|
||||
# https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk
|
||||
if [ "$SRCARCH" = arm64 ]; then
|
||||
gcc_min_version=5.1.0
|
||||
fi
|
||||
|
||||
# Print the compiler name and some version components.
|
||||
get_compiler_info()
|
||||
{
|
||||
|
@ -48,18 +36,20 @@ set -- $(get_compiler_info "$@")
|
|||
|
||||
name=$1
|
||||
|
||||
min_tool_version=$(dirname $0)/min-tool-version.sh
|
||||
|
||||
case "$name" in
|
||||
GCC)
|
||||
version=$2.$3.$4
|
||||
min_version=$gcc_min_version
|
||||
min_version=$($min_tool_version gcc)
|
||||
;;
|
||||
Clang)
|
||||
version=$2.$3.$4
|
||||
min_version=$clang_min_version
|
||||
min_version=$($min_tool_version llvm)
|
||||
;;
|
||||
ICC)
|
||||
version=$(($2 / 100)).$(($2 % 100)).$3
|
||||
min_version=$icc_min_version
|
||||
min_version=$($min_tool_version icc)
|
||||
;;
|
||||
*)
|
||||
echo "$orig_args: unknown compiler" >&2
|
||||
|
|
|
@ -67,6 +67,12 @@ if arg_contain -E "$@"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# To set CONFIG_AS_IS_GNU
|
||||
if arg_contain -Wa,--version "$@"; then
|
||||
echo "GNU assembler (scripts/dummy-tools) 2.50"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if arg_contain -S "$@"; then
|
||||
# For scripts/gcc-x86-*-has-stack-protector.sh
|
||||
if arg_contain -fstack-protector "$@"; then
|
||||
|
|
|
@ -130,19 +130,14 @@ static size_t depfile_prefix_len;
|
|||
static int conf_touch_dep(const char *name)
|
||||
{
|
||||
int fd, ret;
|
||||
const char *s;
|
||||
char *d, c;
|
||||
char *d;
|
||||
|
||||
/* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */
|
||||
if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path))
|
||||
/* check overflow: prefix + name + '\0' must fit in buffer. */
|
||||
if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path))
|
||||
return -1;
|
||||
|
||||
d = depfile_path + depfile_prefix_len;
|
||||
s = name;
|
||||
|
||||
while ((c = *s++))
|
||||
*d++ = (c == '_') ? '/' : tolower(c);
|
||||
strcpy(d, ".h");
|
||||
strcpy(d, name);
|
||||
|
||||
/* Assume directory path already exists. */
|
||||
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
|
@ -465,7 +460,7 @@ load:
|
|||
* Reading from include/config/auto.conf
|
||||
* If CONFIG_FOO previously existed in
|
||||
* auto.conf but it is missing now,
|
||||
* include/config/foo.h must be touched.
|
||||
* include/config/FOO must be touched.
|
||||
*/
|
||||
conf_touch_dep(line + strlen(CONFIG_));
|
||||
else
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
|
||||
set -e
|
||||
|
||||
# When you raise the minimum linker version, please update
|
||||
# Documentation/process/changes.rst as well.
|
||||
bfd_min_version=2.23.0
|
||||
lld_min_version=10.0.1
|
||||
|
||||
# Convert the version string x.y.z to a canonical 5 or 6-digit form.
|
||||
get_canonical_version()
|
||||
{
|
||||
|
@ -35,10 +30,12 @@ set -- $(LC_ALL=C "$@" --version)
|
|||
IFS=' '
|
||||
set -- $1
|
||||
|
||||
min_tool_version=$(dirname $0)/min-tool-version.sh
|
||||
|
||||
if [ "$1" = GNU -a "$2" = ld ]; then
|
||||
shift $(($# - 1))
|
||||
version=$1
|
||||
min_version=$bfd_min_version
|
||||
min_version=$($min_tool_version binutils)
|
||||
name=BFD
|
||||
disp_name="GNU ld"
|
||||
elif [ "$1" = GNU -a "$2" = gold ]; then
|
||||
|
@ -51,7 +48,7 @@ else
|
|||
|
||||
if [ "$1" = LLD ]; then
|
||||
version=$2
|
||||
min_version=$lld_min_version
|
||||
min_version=$($min_tool_version llvm)
|
||||
name=LLD
|
||||
disp_name=LLD
|
||||
else
|
||||
|
|
|
@ -155,6 +155,7 @@ vmlinux_link()
|
|||
local output=${1}
|
||||
local objects
|
||||
local strip_debug
|
||||
local map_option
|
||||
|
||||
info LD ${output}
|
||||
|
||||
|
@ -166,6 +167,10 @@ vmlinux_link()
|
|||
strip_debug=-Wl,--strip-debug
|
||||
fi
|
||||
|
||||
if [ -n "${CONFIG_VMLINUX_MAP}" ]; then
|
||||
map_option="-Map=${output}.map"
|
||||
fi
|
||||
|
||||
if [ "${SRCARCH}" != "um" ]; then
|
||||
if [ -n "${CONFIG_LTO_CLANG}" ]; then
|
||||
# Use vmlinux.o instead of performing the slow LTO
|
||||
|
@ -187,6 +192,7 @@ vmlinux_link()
|
|||
${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
|
||||
${strip_debug#-Wl,} \
|
||||
-o ${output} \
|
||||
${map_option} \
|
||||
-T ${lds} ${objects}
|
||||
else
|
||||
objects="-Wl,--whole-archive \
|
||||
|
@ -200,6 +206,7 @@ vmlinux_link()
|
|||
${CC} ${CFLAGS_vmlinux} \
|
||||
${strip_debug} \
|
||||
-o ${output} \
|
||||
${map_option:+-Wl,${map_option}} \
|
||||
-Wl,-T,${lds} \
|
||||
${objects} \
|
||||
-lutil -lrt -lpthread
|
||||
|
@ -308,7 +315,9 @@ cleanup()
|
|||
rm -f .tmp_vmlinux*
|
||||
rm -f System.map
|
||||
rm -f vmlinux
|
||||
rm -f vmlinux.map
|
||||
rm -f vmlinux.o
|
||||
rm -f .vmlinux.d
|
||||
}
|
||||
|
||||
on_exit()
|
||||
|
@ -446,3 +455,6 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# For fixdep
|
||||
echo "vmlinux: $0" > .vmlinux.d
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Print the minimum supported version of the given tool.
|
||||
# When you raise the minimum version, please update
|
||||
# Documentation/process/changes.rst as well.
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo "Usage: $0 toolname" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
binutils)
|
||||
echo 2.23.0
|
||||
;;
|
||||
gcc)
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
|
||||
# https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk
|
||||
if [ "$SRCARCH" = arm64 ]; then
|
||||
echo 5.1.0
|
||||
else
|
||||
echo 4.9.0
|
||||
fi
|
||||
;;
|
||||
icc)
|
||||
# temporary
|
||||
echo 16.0.3
|
||||
;;
|
||||
llvm)
|
||||
echo 10.0.1
|
||||
;;
|
||||
*)
|
||||
echo "$1: unknown tool" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
/* Are we using CONFIG_MODVERSIONS? */
|
||||
static int modversions = 0;
|
||||
/* Warn about undefined symbols? (do so if we have vmlinux) */
|
||||
static int have_vmlinux = 0;
|
||||
/* Is CONFIG_MODULE_SRCVERSION_ALL set? */
|
||||
static int all_versions = 0;
|
||||
/* If we are modposting external module set to 1 */
|
||||
|
@ -41,6 +39,13 @@ static int allow_missing_ns_imports;
|
|||
|
||||
static bool error_occurred;
|
||||
|
||||
/*
|
||||
* Cut off the warnings when there are too many. This typically occurs when
|
||||
* vmlinux is missing. ('make modules' without building vmlinux.)
|
||||
*/
|
||||
#define MAX_UNRESOLVED_REPORTS 10
|
||||
static unsigned int nr_unresolved;
|
||||
|
||||
enum export {
|
||||
export_plain,
|
||||
export_gpl,
|
||||
|
@ -177,9 +182,6 @@ static struct module *new_module(const char *modname)
|
|||
mod->next = modules;
|
||||
modules = mod;
|
||||
|
||||
if (mod->is_vmlinux)
|
||||
have_vmlinux = 1;
|
||||
|
||||
return mod;
|
||||
}
|
||||
|
||||
|
@ -202,7 +204,7 @@ struct symbol {
|
|||
|
||||
static struct symbol *symbolhash[SYMBOL_HASH_SIZE];
|
||||
|
||||
/* This is based on the hash agorithm from gdbm, via tdb */
|
||||
/* This is based on the hash algorithm from gdbm, via tdb */
|
||||
static inline unsigned int tdb_hash(const char *name)
|
||||
{
|
||||
unsigned value; /* Used to compute the hash value. */
|
||||
|
@ -985,7 +987,7 @@ enum mismatch {
|
|||
};
|
||||
|
||||
/**
|
||||
* Describe how to match sections on different criterias:
|
||||
* Describe how to match sections on different criteria:
|
||||
*
|
||||
* @fromsec: Array of sections to be matched.
|
||||
*
|
||||
|
@ -993,12 +995,12 @@ enum mismatch {
|
|||
* this array is forbidden (black-list). Can be empty.
|
||||
*
|
||||
* @good_tosec: Relocations applied to a section in @fromsec must be
|
||||
* targetting sections in this array (white-list). Can be empty.
|
||||
* targeting sections in this array (white-list). Can be empty.
|
||||
*
|
||||
* @mismatch: Type of mismatch.
|
||||
*
|
||||
* @symbol_white_list: Do not match a relocation to a symbol in this list
|
||||
* even if it is targetting a section in @bad_to_sec.
|
||||
* even if it is targeting a section in @bad_to_sec.
|
||||
*
|
||||
* @handler: Specific handler to call when a match is found. If NULL,
|
||||
* default_mismatch_handler() will be called.
|
||||
|
@ -2141,7 +2143,7 @@ static void check_exports(struct module *mod)
|
|||
const char *basename;
|
||||
exp = find_symbol(s->name);
|
||||
if (!exp || exp->module == mod) {
|
||||
if (have_vmlinux && !s->weak)
|
||||
if (!s->weak && nr_unresolved++ < MAX_UNRESOLVED_REPORTS)
|
||||
modpost_log(warn_unresolved ? LOG_WARN : LOG_ERROR,
|
||||
"\"%s\" [%s.ko] undefined!\n",
|
||||
s->name, mod->name);
|
||||
|
@ -2191,10 +2193,12 @@ static void add_header(struct buffer *b, struct module *mod)
|
|||
*/
|
||||
buf_printf(b, "#define INCLUDE_VERMAGIC\n");
|
||||
buf_printf(b, "#include <linux/build-salt.h>\n");
|
||||
buf_printf(b, "#include <linux/elfnote-lto.h>\n");
|
||||
buf_printf(b, "#include <linux/vermagic.h>\n");
|
||||
buf_printf(b, "#include <linux/compiler.h>\n");
|
||||
buf_printf(b, "\n");
|
||||
buf_printf(b, "BUILD_SALT;\n");
|
||||
buf_printf(b, "BUILD_LTO_INFO;\n");
|
||||
buf_printf(b, "\n");
|
||||
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
|
||||
buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
|
||||
|
@ -2423,19 +2427,6 @@ fail:
|
|||
fatal("parse error in symbol dump file\n");
|
||||
}
|
||||
|
||||
/* For normal builds always dump all symbols.
|
||||
* For external modules only dump symbols
|
||||
* that are not read from kernel Module.symvers.
|
||||
**/
|
||||
static int dump_sym(struct symbol *sym)
|
||||
{
|
||||
if (!external_module)
|
||||
return 1;
|
||||
if (sym->module->from_dump)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void write_dump(const char *fname)
|
||||
{
|
||||
struct buffer buf = { };
|
||||
|
@ -2446,7 +2437,7 @@ static void write_dump(const char *fname)
|
|||
for (n = 0; n < SYMBOL_HASH_SIZE ; n++) {
|
||||
symbol = symbolhash[n];
|
||||
while (symbol) {
|
||||
if (dump_sym(symbol)) {
|
||||
if (!symbol->module->from_dump) {
|
||||
namespace = symbol->namespace;
|
||||
buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n",
|
||||
symbol->crc, symbol->name,
|
||||
|
@ -2558,13 +2549,6 @@ int main(int argc, char **argv)
|
|||
if (files_source)
|
||||
read_symbols_from_files(files_source);
|
||||
|
||||
/*
|
||||
* When there's no vmlinux, don't print warnings about
|
||||
* unresolved symbols (since there'll be too many ;)
|
||||
*/
|
||||
if (!have_vmlinux)
|
||||
warn("Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.\n");
|
||||
|
||||
for (mod = modules; mod; mod = mod->next) {
|
||||
char fname[PATH_MAX];
|
||||
|
||||
|
@ -2608,6 +2592,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (nr_unresolved > MAX_UNRESOLVED_REPORTS)
|
||||
warn("suppressed %u unresolved symbol warnings because there were too many)\n",
|
||||
nr_unresolved - MAX_UNRESOLVED_REPORTS);
|
||||
|
||||
free(buf.p);
|
||||
|
||||
return error_occurred ? 1 : 0;
|
||||
|
|
|
@ -13,10 +13,10 @@ exit_code=0
|
|||
# Check uniqueness of module names
|
||||
check_same_name_modules()
|
||||
{
|
||||
for m in $(sed 's:.*/::' $1 | sort | uniq -d)
|
||||
for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
|
||||
do
|
||||
echo "error: the following would cause module name conflict:" >&2
|
||||
sed -n "/\/$m/s:^: :p" modules.order >&2
|
||||
sed -n "/\/$m/s:^: :p" "$1" >&2
|
||||
exit_code=1
|
||||
done
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# Test that the assembler doesn't need -Wa,-gdwarf-5 when presented with DWARF
|
||||
# v5 input, such as `.file 0` and `md5 0x00`. Should be fixed in GNU binutils
|
||||
# 2.35.2. https://sourceware.org/bugzilla/show_bug.cgi?id=25611
|
||||
echo '.file 0 "filename" md5 0x7a0b65214090b6693bd1dc24dd248245' | \
|
||||
$* -gdwarf-5 -Wno-unused-command-line-argument -c -x assembler -o /dev/null -
|
|
@ -100,3 +100,27 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX
|
|||
## HOSTCC C flags
|
||||
|
||||
host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))
|
||||
|
||||
# output directory for tests below
|
||||
TMPOUT = .tmp_$$$$
|
||||
|
||||
# try-run
|
||||
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
|
||||
# Exit code chooses option. "$$TMP" serves as a temporary file and is
|
||||
# automatically cleaned up.
|
||||
try-run = $(shell set -e; \
|
||||
TMP=$(TMPOUT)/tmp; \
|
||||
mkdir -p $(TMPOUT); \
|
||||
trap "rm -rf $(TMPOUT)" EXIT; \
|
||||
if ($(1)) >/dev/null 2>&1; \
|
||||
then echo "$(2)"; \
|
||||
else echo "$(3)"; \
|
||||
fi)
|
||||
|
||||
# cc-option
|
||||
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
|
||||
cc-option = $(call try-run, \
|
||||
$(CC) -Werror $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
|
||||
|
||||
# delete partially updated (i.e. corrupted) files on error
|
||||
.DELETE_ON_ERROR:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include ../../../../scripts/Kbuild.include
|
||||
include ../../../build/Build.include
|
||||
include ../../../scripts/Makefile.arch
|
||||
include ../../../scripts/Makefile.include
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
include ../../../../scripts/Kbuild.include
|
||||
include ../../../build/Build.include
|
||||
|
||||
all:
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include ../../../../../../scripts/Kbuild.include
|
||||
include ../../../../../build/Build.include
|
||||
|
||||
noarg:
|
||||
$(MAKE) -C ../../
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
# We need this for the "cc-option" macro.
|
||||
include ../../../scripts/Kbuild.include
|
||||
include ../../build/Build.include
|
||||
|
||||
VERSION = 1.0
|
||||
|
||||
|
|
Loading…
Reference in New Issue