mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'kbuild-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada:
- Support zstd-compressed debug info
- Allow W=1 builds to detect objects shared among multiple modules
- Add srcrpm-pkg target to generate a source RPM package
- Make the -s option detection work for future GNU Make versions
- Add -Werror to KBUILD_CPPFLAGS when CONFIG_WERROR=y
- Allow W=1 builds to detect -Wundef warnings in any preprocessed files
- Raise the minimum supported version of binutils to 2.25
- Use $(intcmp ...) to compare integers if GNU Make >= 4.4 is used
- Use $(file ...) to read a file if GNU Make >= 4.2 is used
- Print error if GNU Make older than 3.82 is used
- Allow modpost to detect section mismatches with Clang LTO
- Include vmlinuz.efi into kernel tarballs for arm64 CONFIG_EFI_ZBOOT=y
* tag 'kbuild-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (29 commits)
buildtar: fix tarballs with EFI_ZBOOT enabled
modpost: Include '.text.*' in TEXT_SECTIONS
padata: Mark padata_work_init() as __ref
kbuild: ensure Make >= 3.82 is used
kbuild: refactor the prerequisites of the modpost rule
kbuild: change module.order to list *.o instead of *.ko
kbuild: use .NOTINTERMEDIATE for future GNU Make versions
kconfig: refactor Makefile to reduce process forks
kbuild: add read-file macro
kbuild: do not sort after reading modules.order
kbuild: add test-{ge,gt,le,lt} macros
Documentation: raise minimum supported version of binutils to 2.25
kbuild: add -Wundef to KBUILD_CPPFLAGS for W=1 builds
kbuild: move -Werror from KBUILD_CFLAGS to KBUILD_CPPFLAGS
kbuild: Port silent mode detection to future gnu make.
init/version.c: remove #include <generated/utsrelease.h>
firmware_loader: remove #include <generated/utsrelease.h>
modpost: Mark uuid_le type to be suitable only for MEI
kbuild: add ability to make source rpm buildable using koji
kbuild: warn objects shared among multiple modules
...
This commit is contained in:
@@ -35,7 +35,7 @@ Rust (optional) 1.62.0 rustc --version
|
||||
bindgen (optional) 0.56.0 bindgen --version
|
||||
GNU make 3.82 make --version
|
||||
bash 4.2 bash --version
|
||||
binutils 2.23 ld -v
|
||||
binutils 2.25 ld -v
|
||||
flex 2.5.35 flex --version
|
||||
bison 2.0 bison --version
|
||||
pahole 1.16 pahole --version
|
||||
@@ -119,7 +119,7 @@ Bash 4.2 or newer is needed.
|
||||
Binutils
|
||||
--------
|
||||
|
||||
Binutils 2.23 or newer is needed to build the kernel.
|
||||
Binutils 2.25 or newer is needed to build the kernel.
|
||||
|
||||
pkg-config
|
||||
----------
|
||||
|
||||
@@ -11,6 +11,10 @@ NAME = Hurr durr I'ma ninja sloth
|
||||
# Comments in this file are targeted only to the developer, do not
|
||||
# expect to learn how to build the kernel reading this file.
|
||||
|
||||
ifeq ($(filter undefine,$(.FEATURES)),)
|
||||
$(error GNU Make >= 3.82 is required. Your Make version is $(MAKE_VERSION))
|
||||
endif
|
||||
|
||||
$(if $(filter __%, $(MAKECMDGOALS)), \
|
||||
$(error targets prefixed with '__' are only for internal use))
|
||||
|
||||
@@ -93,10 +97,17 @@ endif
|
||||
|
||||
# If the user is running make -s (silent mode), suppress echoing of
|
||||
# commands
|
||||
# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
|
||||
|
||||
ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
|
||||
quiet=silent_
|
||||
KBUILD_VERBOSE = 0
|
||||
ifeq ($(filter 3.%,$(MAKE_VERSION)),)
|
||||
silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
|
||||
else
|
||||
silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
|
||||
endif
|
||||
|
||||
ifeq ($(silence),s)
|
||||
quiet=silent_
|
||||
KBUILD_VERBOSE = 0
|
||||
endif
|
||||
|
||||
export quiet Q KBUILD_VERBOSE
|
||||
@@ -369,7 +380,7 @@ else # !mixed-build
|
||||
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)
|
||||
KERNELRELEASE = $(call read-file, include/config/kernel.release)
|
||||
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
||||
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
|
||||
|
||||
@@ -859,7 +870,8 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
|
||||
|
||||
KBUILD_CFLAGS += $(stackp-flags-y)
|
||||
|
||||
KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
|
||||
KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror
|
||||
KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)
|
||||
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
|
||||
|
||||
KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
|
||||
@@ -990,7 +1002,7 @@ KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
|
||||
# Check for frame size exceeding threshold during prolog/epilog insertion
|
||||
# when using lld < 13.0.0.
|
||||
ifneq ($(CONFIG_FRAME_WARN),0)
|
||||
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
|
||||
ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 130000),y)
|
||||
KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
|
||||
endif
|
||||
endif
|
||||
@@ -1560,7 +1572,7 @@ __modinst_pre:
|
||||
rm -f $(MODLIB)/build ; \
|
||||
ln -s $(CURDIR) $(MODLIB)/build ; \
|
||||
fi
|
||||
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
|
||||
@sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
|
||||
@cp -f modules.builtin $(MODLIB)/
|
||||
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LD_IS_LLD),y)
|
||||
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0)
|
||||
ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 150000),y)
|
||||
KBUILD_CFLAGS += -mno-relax
|
||||
KBUILD_AFLAGS += -mno-relax
|
||||
ifndef CONFIG_AS_IS_LLVM
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ endif
|
||||
KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
|
||||
|
||||
ifdef CONFIG_LTO_CLANG
|
||||
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
|
||||
ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 130000),y)
|
||||
KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/completion.h>
|
||||
|
||||
#include <generated/utsrelease.h>
|
||||
|
||||
/**
|
||||
* enum fw_opt - options to control firmware loading behaviour
|
||||
*
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <linux/printk.h>
|
||||
#include <linux/uts.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <generated/utsrelease.h>
|
||||
#include <linux/proc_ns.h>
|
||||
|
||||
static int __init early_hostname(char *arg)
|
||||
|
||||
+10
-2
@@ -83,8 +83,16 @@ static struct padata_work *padata_work_alloc(void)
|
||||
return pw;
|
||||
}
|
||||
|
||||
static void padata_work_init(struct padata_work *pw, work_func_t work_fn,
|
||||
void *data, int flags)
|
||||
/*
|
||||
* This function is marked __ref because this function may be optimized in such
|
||||
* a way that it directly refers to work_fn's address, which causes modpost to
|
||||
* complain when work_fn is marked __init. This scenario was observed with clang
|
||||
* LTO, where padata_work_init() was optimized to refer directly to
|
||||
* padata_mt_helper() because the calls to padata_work_init() with other work_fn
|
||||
* values were eliminated or inlined.
|
||||
*/
|
||||
static void __ref padata_work_init(struct padata_work *pw, work_func_t work_fn,
|
||||
void *data, int flags)
|
||||
{
|
||||
if (flags & PADATA_WORK_ONSTACK)
|
||||
INIT_WORK_ONSTACK(&pw->pw_work, work_fn);
|
||||
|
||||
+27
-2
@@ -312,8 +312,21 @@ config DEBUG_INFO_REDUCED
|
||||
DEBUG_INFO build and compile times are reduced too.
|
||||
Only works with newer gcc versions.
|
||||
|
||||
config DEBUG_INFO_COMPRESSED
|
||||
bool "Compressed debugging information"
|
||||
choice
|
||||
prompt "Compressed Debug information"
|
||||
help
|
||||
Compress the resulting debug info. Results in smaller debug info sections,
|
||||
but requires that consumers are able to decompress the results.
|
||||
|
||||
If unsure, choose DEBUG_INFO_COMPRESSED_NONE.
|
||||
|
||||
config DEBUG_INFO_COMPRESSED_NONE
|
||||
bool "Don't compress debug information"
|
||||
help
|
||||
Don't compress debug info sections.
|
||||
|
||||
config DEBUG_INFO_COMPRESSED_ZLIB
|
||||
bool "Compress debugging information with zlib"
|
||||
depends on $(cc-option,-gz=zlib)
|
||||
depends on $(ld-option,--compress-debug-sections=zlib)
|
||||
help
|
||||
@@ -327,6 +340,18 @@ config DEBUG_INFO_COMPRESSED
|
||||
preferable to setting $KDEB_COMPRESS to "none" which would be even
|
||||
larger.
|
||||
|
||||
config DEBUG_INFO_COMPRESSED_ZSTD
|
||||
bool "Compress debugging information with zstd"
|
||||
depends on $(cc-option,-gz=zstd)
|
||||
depends on $(ld-option,--compress-debug-sections=zstd)
|
||||
help
|
||||
Compress the debug information using zstd. This may provide better
|
||||
compression than zlib, for about the same time costs, but requires newer
|
||||
toolchain support. Requires GCC 13.0+ or Clang 16.0+, binutils 2.40+, and
|
||||
zstd.
|
||||
|
||||
endchoice # "Compressed Debug information"
|
||||
|
||||
config DEBUG_INFO_SPLIT
|
||||
bool "Produce split debuginfo in .dwo files"
|
||||
depends on $(cc-option,-gsplit-dwarf)
|
||||
|
||||
+45
-3
@@ -10,6 +10,26 @@ empty :=
|
||||
space := $(empty) $(empty)
|
||||
space_escape := _-_SPACE_-_
|
||||
pound := \#
|
||||
define newline
|
||||
|
||||
|
||||
endef
|
||||
|
||||
###
|
||||
# Comparison macros.
|
||||
# Usage: $(call test-lt, $(CONFIG_LLD_VERSION), 150000)
|
||||
#
|
||||
# Use $(intcmp ...) if supported. (Make >= 4.4)
|
||||
# Otherwise, fall back to the 'test' shell command.
|
||||
ifeq ($(intcmp 1,0,,,y),y)
|
||||
test-ge = $(intcmp $(strip $1)0, $(strip $2)0,,y,y)
|
||||
test-gt = $(intcmp $(strip $1)0, $(strip $2)0,,,y)
|
||||
else
|
||||
test-ge = $(shell test $(strip $1)0 -ge $(strip $2)0 && echo y)
|
||||
test-gt = $(shell test $(strip $1)0 -gt $(strip $2)0 && echo y)
|
||||
endif
|
||||
test-le = $(call test-ge, $2, $1)
|
||||
test-lt = $(call test-gt, $2, $1)
|
||||
|
||||
###
|
||||
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
|
||||
@@ -40,6 +60,21 @@ escsq = $(subst $(squote),'\$(squote)',$1)
|
||||
# Quote a string to pass it to C files. foo => '"foo"'
|
||||
stringify = $(squote)$(quote)$1$(quote)$(squote)
|
||||
|
||||
###
|
||||
# The path to Kbuild or Makefile. Kbuild has precedence over Makefile.
|
||||
kbuild-dir = $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
||||
kbuild-file = $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
|
||||
|
||||
###
|
||||
# Read a file, replacing newlines with spaces
|
||||
#
|
||||
# Make 4.2 or later can read a file by using its builtin function.
|
||||
ifneq ($(filter-out 3.% 4.0 4.1, $(MAKE_VERSION)),)
|
||||
read-file = $(subst $(newline),$(space),$(file < $1))
|
||||
else
|
||||
read-file = $(shell cat $1 2>/dev/null)
|
||||
endif
|
||||
|
||||
###
|
||||
# Easy method for doing a status message
|
||||
kecho := :
|
||||
@@ -150,9 +185,6 @@ endif
|
||||
make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
|
||||
|
||||
# Find any prerequisites that are newer than target or that do not exist.
|
||||
# (This is not true for now; $? should contain any non-existent prerequisites,
|
||||
# but it does not work as expected when .SECONDARY is present. This seems a bug
|
||||
# of GNU Make.)
|
||||
# PHONY targets skipped in both cases.
|
||||
newer-prereqs = $(filter-out $(PHONY),$?)
|
||||
|
||||
@@ -228,4 +260,14 @@ endif
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
# do not delete intermediate files automatically
|
||||
#
|
||||
# .NOTINTERMEDIATE is more correct, but only available on newer Make versions.
|
||||
# Make 4.4 introduced .NOTINTERMEDIATE, and it appears in .FEATURES, but the
|
||||
# global .NOTINTERMEDIATE does not work. We can use it on Make > 4.4.
|
||||
# Use .SECONDARY for older Make versions, but "newer-prereq" cannot detect
|
||||
# deleted files.
|
||||
ifneq ($(and $(filter notintermediate, $(.FEATURES)),$(filter-out 4.4,$(MAKE_VERSION))),)
|
||||
.NOTINTERMEDIATE:
|
||||
else
|
||||
.SECONDARY:
|
||||
endif
|
||||
|
||||
@@ -10,15 +10,15 @@ PHONY := all
|
||||
all:
|
||||
|
||||
src := $(subst /generated,,$(obj))
|
||||
-include $(src)/Kbuild
|
||||
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
-include $(kbuild-file)
|
||||
|
||||
# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
|
||||
ifneq ($(SRCARCH),um)
|
||||
include $(srctree)/$(generic)/Kbuild
|
||||
endif
|
||||
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
|
||||
redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
|
||||
redundant := $(sort $(redundant))
|
||||
|
||||
@@ -38,11 +38,7 @@ subdir-ccflags-y :=
|
||||
|
||||
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))
|
||||
include $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
|
||||
|
||||
include $(kbuild-file)
|
||||
include $(srctree)/scripts/Makefile.lib
|
||||
|
||||
# Do not include hostprogs rules unless needed.
|
||||
@@ -226,6 +222,10 @@ endif
|
||||
|
||||
cmd_check_local_export = $(srctree)/scripts/check-local-export $@
|
||||
|
||||
ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
|
||||
cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi)))
|
||||
endif
|
||||
|
||||
define rule_cc_o_c
|
||||
$(call cmd_and_fixdep,cc_o_c)
|
||||
$(call cmd,gen_ksymdeps)
|
||||
@@ -235,6 +235,7 @@ define rule_cc_o_c
|
||||
$(call cmd,gen_objtooldep)
|
||||
$(call cmd,gen_symversions_c)
|
||||
$(call cmd,record_mcount)
|
||||
$(call cmd,warn_shared_object)
|
||||
endef
|
||||
|
||||
define rule_as_o_S
|
||||
@@ -243,6 +244,7 @@ define rule_as_o_S
|
||||
$(call cmd,check_local_export)
|
||||
$(call cmd,gen_objtooldep)
|
||||
$(call cmd,gen_symversions_S)
|
||||
$(call cmd,warn_shared_object)
|
||||
endef
|
||||
|
||||
# Built-in and composite module parts
|
||||
@@ -433,7 +435,7 @@ $(obj)/built-in.a: $(real-obj-y) FORCE
|
||||
# modules.order unless contained modules are updated.
|
||||
|
||||
cmd_modules_order = { $(foreach m, $(real-prereqs), \
|
||||
$(if $(filter %/modules.order, $m), cat $m, echo $(patsubst %.o,%.ko,$m));) :; } \
|
||||
$(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \
|
||||
> $@
|
||||
|
||||
$(obj)/modules.order: $(obj-m) FORCE
|
||||
|
||||
@@ -9,10 +9,7 @@ PHONY := __clean
|
||||
__clean:
|
||||
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
# The filename Kbuild has precedence over Makefile
|
||||
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
||||
include $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
|
||||
include $(kbuild-file)
|
||||
|
||||
# Figure out what we need to build from the various variables
|
||||
# ==========================================================================
|
||||
|
||||
@@ -63,11 +63,11 @@ cc-disable-warning = $(call try-run,\
|
||||
|
||||
# gcc-min-version
|
||||
# Usage: cflags-$(call gcc-min-version, 70100) += -foo
|
||||
gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION)0 -ge $(1)0 ] && echo y)
|
||||
gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1)
|
||||
|
||||
# clang-min-version
|
||||
# Usage: cflags-$(call clang-min-version, 110000) += -foo
|
||||
clang-min-version = $(shell [ $(CONFIG_CLANG_VERSION)0 -ge $(1)0 ] && echo y)
|
||||
clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1)
|
||||
|
||||
# ld-option
|
||||
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
|
||||
|
||||
@@ -27,10 +27,14 @@ else
|
||||
DEBUG_RUSTFLAGS += -Cdebuginfo=2
|
||||
endif
|
||||
|
||||
ifdef CONFIG_DEBUG_INFO_COMPRESSED
|
||||
ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZLIB
|
||||
DEBUG_CFLAGS += -gz=zlib
|
||||
KBUILD_AFLAGS += -gz=zlib
|
||||
KBUILD_LDFLAGS += --compress-debug-sections=zlib
|
||||
else ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZSTD
|
||||
DEBUG_CFLAGS += -gz=zstd
|
||||
KBUILD_AFLAGS += -gz=zstd
|
||||
KBUILD_LDFLAGS += --compress-debug-sections=zstd
|
||||
endif
|
||||
|
||||
KBUILD_CFLAGS += $(DEBUG_CFLAGS)
|
||||
|
||||
@@ -15,7 +15,7 @@ __dtbs_install:
|
||||
|
||||
include include/config/auto.conf
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
include $(src)/Makefile
|
||||
include $(kbuild-file)
|
||||
|
||||
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
||||
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
|
||||
|
||||
@@ -38,6 +38,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
|
||||
KBUILD_CFLAGS += -Wno-type-limits
|
||||
KBUILD_CFLAGS += -Wno-shift-negative-value
|
||||
|
||||
KBUILD_CPPFLAGS += -Wundef
|
||||
KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
|
||||
|
||||
else
|
||||
|
||||
@@ -13,9 +13,9 @@ include $(srctree)/scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Makefile.lib
|
||||
|
||||
# find all modules listed in modules.order
|
||||
modules := $(sort $(shell cat $(MODORDER)))
|
||||
modules := $(call read-file, $(MODORDER))
|
||||
|
||||
__modfinal: $(modules)
|
||||
__modfinal: $(modules:%.o=%.ko)
|
||||
@:
|
||||
|
||||
# modname and part-of-module are set to make c_flags define proper module flags
|
||||
@@ -57,13 +57,13 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
|
||||
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
||||
|
||||
# Re-generate module BTFs if either module's .ko or vmlinux changed
|
||||
$(modules): %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||
%.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||
+$(call if_changed_except,ld_ko_o,vmlinux)
|
||||
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
|
||||
+$(if $(newer-prereqs),$(call cmd,btf_ko))
|
||||
endif
|
||||
|
||||
targets += $(modules) $(modules:.ko=.mod.o)
|
||||
targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o)
|
||||
|
||||
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -9,7 +9,7 @@ __modinst:
|
||||
include include/config/auto.conf
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
modules := $(sort $(shell cat $(MODORDER)))
|
||||
modules := $(call read-file, $(MODORDER))
|
||||
|
||||
ifeq ($(KBUILD_EXTMOD),)
|
||||
dst := $(MODLIB)/kernel
|
||||
@@ -26,7 +26,7 @@ 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))
|
||||
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
|
||||
|
||||
__modinst: $(modules)
|
||||
@:
|
||||
|
||||
+26
-15
@@ -38,6 +38,8 @@ __modpost:
|
||||
include include/config/auto.conf
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
MODPOST = scripts/mod/modpost
|
||||
|
||||
modpost-args = \
|
||||
$(if $(CONFIG_MODVERSIONS),-m) \
|
||||
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
|
||||
@@ -46,6 +48,8 @@ modpost-args = \
|
||||
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
|
||||
-o $@
|
||||
|
||||
modpost-deps := $(MODPOST)
|
||||
|
||||
# 'make -i -k' ignores compile errors, and builds as many modules as possible.
|
||||
ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),)
|
||||
modpost-args += -n
|
||||
@@ -78,12 +82,13 @@ targets += .vmlinux.objs
|
||||
.vmlinux.objs: vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
|
||||
$(call if_changed,vmlinux_objs)
|
||||
|
||||
vmlinux.o-if-present := $(wildcard vmlinux.o)
|
||||
output-symdump := vmlinux.symvers
|
||||
|
||||
ifdef KBUILD_MODULES
|
||||
output-symdump := $(if $(vmlinux.o-if-present), Module.symvers, modules-only.symvers)
|
||||
missing-input := $(filter-out $(vmlinux.o-if-present),vmlinux.o)
|
||||
ifeq ($(wildcard vmlinux.o),)
|
||||
missing-input := vmlinux.o
|
||||
output-symdump := modules-only.symvers
|
||||
else
|
||||
modpost-args += vmlinux.o
|
||||
modpost-deps += vmlinux.o
|
||||
output-symdump := $(if $(KBUILD_MODULES), Module.symvers, vmlinux.symvers)
|
||||
endif
|
||||
|
||||
else
|
||||
@@ -93,13 +98,18 @@ obj := $(KBUILD_EXTMOD)
|
||||
src := $(obj)
|
||||
|
||||
# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
|
||||
include $(or $(wildcard $(src)/Kbuild), $(src)/Makefile)
|
||||
include $(kbuild-file)
|
||||
|
||||
module.symvers-if-present := $(wildcard Module.symvers)
|
||||
output-symdump := $(KBUILD_EXTMOD)/Module.symvers
|
||||
missing-input := $(filter-out $(module.symvers-if-present), Module.symvers)
|
||||
|
||||
modpost-args += -e $(addprefix -i ,$(module.symvers-if-present) $(KBUILD_EXTRA_SYMBOLS))
|
||||
ifeq ($(wildcard Module.symvers),)
|
||||
missing-input := Module.symvers
|
||||
else
|
||||
modpost-args += -i Module.symvers
|
||||
modpost-deps += Module.symvers
|
||||
endif
|
||||
|
||||
modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS))
|
||||
|
||||
endif # ($(KBUILD_EXTMOD),)
|
||||
|
||||
@@ -107,9 +117,10 @@ ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),)
|
||||
modpost-args += -w
|
||||
endif
|
||||
|
||||
modorder-if-needed := $(if $(KBUILD_MODULES), $(MODORDER))
|
||||
|
||||
MODPOST = scripts/mod/modpost
|
||||
ifdef KBUILD_MODULES
|
||||
modpost-args += -T $(MODORDER)
|
||||
modpost-deps += $(MODORDER)
|
||||
endif
|
||||
|
||||
# Read out modules.order to pass in modpost.
|
||||
# Otherwise, allmodconfig would fail with "Argument list too long".
|
||||
@@ -119,10 +130,10 @@ quiet_cmd_modpost = MODPOST $@
|
||||
echo >&2 "WARNING: $(missing-input) is missing."; \
|
||||
echo >&2 " Modules may not have dependencies or modversions."; \
|
||||
echo >&2 " You may get many unresolved symbol warnings.";) \
|
||||
sed 's/ko$$/o/' $(or $(modorder-if-needed), /dev/null) | $(MODPOST) $(modpost-args) -T - $(vmlinux.o-if-present)
|
||||
$(MODPOST) $(modpost-args)
|
||||
|
||||
targets += $(output-symdump)
|
||||
$(output-symdump): $(modorder-if-needed) $(vmlinux.o-if-present) $(module.symvers-if-present) $(MODPOST) FORCE
|
||||
$(output-symdump): $(modpost-deps) FORCE
|
||||
$(call if_changed,modpost)
|
||||
|
||||
__modpost: $(output-symdump)
|
||||
|
||||
@@ -62,6 +62,16 @@ rpm-pkg:
|
||||
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
|
||||
--define='_smp_mflags %{nil}'
|
||||
|
||||
# srcrpm-pkg
|
||||
# ---------------------------------------------------------------------------
|
||||
PHONY += srcrpm-pkg
|
||||
srcrpm-pkg:
|
||||
$(MAKE) clean
|
||||
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
||||
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
|
||||
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \
|
||||
--define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)'
|
||||
|
||||
# binrpm-pkg
|
||||
# ---------------------------------------------------------------------------
|
||||
PHONY += binrpm-pkg
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user