1
0
Fork 0

Kbuild updates for v5.2

- allow users to invoke 'make' out of the source tree
 
 - refactor scripts/mkmakefile
 
 - deprecate KBUILD_SRC, which was used to track the source tree
   location for O= build.
 
 - fix recordmcount.pl in case objdump output is localized
 
 - turn unresolved symbols in external modules to errors from warnings
   by default; pass KBUILD_MODPOST_WARN=1 to get them back to warnings
 
 - generate modules.builtin.modinfo to collect .modinfo data from
   built-in modules
 
 - misc Makefile cleanups
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJc0upmAAoJED2LAQed4NsGreoP/jkKQojVdzTjM/nn/Xe9FrE9
 elQ59Wu/gW/q7jouN733WTJ2fRPAEVaGPw/CT/cCRWjNJjd6MM4voDKVxifZE+u4
 qz5XUGq4Mjozd0MJdU1LA1dIRJrEaPofOj7E0JEIerEdLPKpv4kjCCbbHOZwN2Kl
 YrpPFJkYspCRVG+txEWY8YaZeU/+OAdNckJnMkX8hnUwsNplAlPw4L/5Y12Uncuz
 7g/3T1f701pJhStoO4OPR/+Rivi0EX5AP7TZyv2/FOwTO+Oau5G1rF0j1BT0+ceg
 d+bApuaHLR4ocZ6GvWfACMYhH7ais0BUgAwi6HY/b78SGMmNB6xlD5biVqcklx6c
 mjrPNaj6WJEQIflZ3yr83tRNhTu7xXRKZkrGHHUjOGNsRULuD8RFrXtusl06A22S
 hA3vt2SF4FuLBabPw5yFkKNOTX+P5dG79BC1fWIQjglBGoYqWTRQNYoottr/7t2T
 Si+E6J2lAD0EDNuc/EFKWfrgONfatgcdgQuTibwCcE2KfYnMG/C+9DvxRV4lAQtn
 fYpap9gws+0AisbVx0m1W088NMFiwrMbN3n3KITGY/15XDmeySEA1QgPKFN8JHJd
 Do0duaMx8BHjkA5ms/Bf0AZd0tWUkWVdt0epwU2KafWNGK7VaPnhKxn5eQOGkWV+
 gT3J3XZc3b7OEOQ4XX3Z
 =zj9w
 -----END PGP SIGNATURE-----

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

Pull Kbuild updates from Masahiro Yamada:

 - allow users to invoke 'make' out of the source tree

 - refactor scripts/mkmakefile

 - deprecate KBUILD_SRC, which was used to track the source tree
   location for O= build.

 - fix recordmcount.pl in case objdump output is localized

 - turn unresolved symbols in external modules to errors from warnings
   by default; pass KBUILD_MODPOST_WARN=1 to get them back to warnings

 - generate modules.builtin.modinfo to collect .modinfo data from
   built-in modules

 - misc Makefile cleanups

* tag 'kbuild-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (21 commits)
  .gitignore: add more all*.config patterns
  moduleparam: Save information about built-in modules in separate file
  Remove MODULE_ALIAS() calls that take undefined macro
  .gitignore: add leading and trailing slashes to generated directories
  scripts/tags.sh: fix direct execution of scripts/tags.sh
  scripts: override locale from environment when running recordmcount.pl
  samples: kobject: allow CONFIG_SAMPLE_KOBJECT to become y
  samples: seccomp: turn CONFIG_SAMPLE_SECCOMP into a bool option
  kbuild: move Documentation to vmlinux-alldirs
  kbuild: move samples/ to KBUILD_VMLINUX_OBJS
  modpost: make KBUILD_MODPOST_WARN also configurable for external modules
  kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build
  kbuild: remove unneeded dependency for include/config/kernel.release
  memory: squash drivers/memory/Makefile.asm-offsets
  kbuild: use $(srctree) instead of KBUILD_SRC to check out-of-tree build
  kbuild: mkmakefile: generate a simple wrapper of top Makefile
  kbuild: mkmakefile: do not check the generated Makefile marker
  kbuild: allow Kbuild to start from any directory
  kbuild: pass $(MAKECMDGOALS) to sub-make as is
  kbuild: fix warning "overriding recipe for target 'Makefile'"
  ...
hifive-unleashed-5.2
Linus Torvalds 2019-05-08 12:25:12 -07:00
commit 2646719a48
25 changed files with 128 additions and 124 deletions

16
.gitignore vendored
View File

@ -58,6 +58,7 @@ modules.builtin
/vmlinuz /vmlinuz
/System.map /System.map
/Module.markers /Module.markers
/modules.builtin.modinfo
# #
# RPM spec file (make rpm-pkg) # RPM spec file (make rpm-pkg)
@ -90,10 +91,10 @@ modules.builtin
# #
# Generated include files # Generated include files
# #
include/config /include/config/
include/generated /include/generated/
include/ksym /include/ksym/
arch/*/include/generated /arch/*/include/generated/
# stgit generated dirs # stgit generated dirs
patches-* patches-*
@ -129,7 +130,12 @@ signing_key.x509
x509.genkey x509.genkey
# Kconfig presets # Kconfig presets
all.config /all.config
/alldef.config
/allmod.config
/allno.config
/allrandom.config
/allyes.config
# Kdevelop4 # Kdevelop4
*.kdev4 *.kdev4

View File

@ -179,6 +179,7 @@ mktree
mkutf8data mkutf8data
modpost modpost
modules.builtin modules.builtin
modules.builtin.modinfo
modules.order modules.order
modversions.h* modversions.h*
nconf nconf

View File

@ -11,6 +11,11 @@ modules.builtin
This file lists all modules that are built into the kernel. This is used This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin. by modprobe to not fail when trying to load something builtin.
modules.builtin.modinfo
--------------------------------------------------
This file contains modinfo from all modules that are built into the kernel.
Unlike modinfo of a separate module, all fields are prefixed with module name.
Environment variables Environment variables

146
Makefile
View File

@ -96,56 +96,65 @@ endif
export quiet Q KBUILD_VERBOSE export quiet Q KBUILD_VERBOSE
# kbuild supports saving output files in a separate directory. # Kbuild will save output files in the current working directory.
# To locate output files in a separate directory two syntaxes are supported. # This does not need to match to the root of the kernel source tree.
# In both cases the working directory must be the root of the kernel src. #
# For example, you can do this:
#
# cd /dir/to/store/output/files; make -f /dir/to/kernel/source/Makefile
#
# If you want to save output files in a different location, there are
# two syntaxes to specify it.
#
# 1) O= # 1) O=
# Use "make O=dir/to/store/output/files/" # Use "make O=dir/to/store/output/files/"
# #
# 2) Set KBUILD_OUTPUT # 2) Set KBUILD_OUTPUT
# Set the environment variable KBUILD_OUTPUT to point to the directory # Set the environment variable KBUILD_OUTPUT to point to the output directory.
# where the output files shall be placed. # export KBUILD_OUTPUT=dir/to/store/output/files/; make
# export KBUILD_OUTPUT=dir/to/store/output/files/
# make
# #
# The O= assignment takes precedence over the KBUILD_OUTPUT environment # The O= assignment takes precedence over the KBUILD_OUTPUT environment
# variable. # variable.
# KBUILD_SRC is not intended to be used by the regular user (for now), # Do we want to change the working directory?
# it is set on invocation of make with KBUILD_OUTPUT or O= specified.
# OK, Make called in directory where kernel src resides
# Do we want to locate output files in a separate directory?
ifeq ("$(origin O)", "command line") ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O) KBUILD_OUTPUT := $(O)
endif endif
ifneq ($(words $(subst :, ,$(CURDIR))), 1) ifneq ($(KBUILD_OUTPUT),)
$(error main directory cannot contain spaces nor colons) # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
# expand a shell special character '~'. We use a somewhat tedious way here.
abs_objtree := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)
$(if $(abs_objtree),, \
$(error failed to create output directory "$(KBUILD_OUTPUT)"))
# $(realpath ...) resolves symlinks
abs_objtree := $(realpath $(abs_objtree))
else
abs_objtree := $(CURDIR)
endif # ifneq ($(KBUILD_OUTPUT),)
ifeq ($(abs_objtree),$(CURDIR))
# Suppress "Entering directory ..." unless we are changing the work directory.
MAKEFLAGS += --no-print-directory
else
need-sub-make := 1
endif endif
ifneq ($(KBUILD_OUTPUT),) abs_srctree := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
# check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
&& pwd)
$(if $(KBUILD_OUTPUT),, \
$(error failed to create output directory "$(saved-output)"))
ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
$(error source directory cannot contain spaces or colons)
endif
ifneq ($(abs_srctree),$(abs_objtree))
# Look for make include files relative to root of kernel src # Look for make include files relative to root of kernel src
# #
# This does not become effective immediately because MAKEFLAGS is re-parsed # This does not become effective immediately because MAKEFLAGS is re-parsed
# once after the Makefile is read. It is OK since we are going to invoke # once after the Makefile is read. We need to invoke sub-make.
# 'sub-make' below. MAKEFLAGS += --include-dir=$(abs_srctree)
MAKEFLAGS += --include-dir=$(CURDIR)
need-sub-make := 1 need-sub-make := 1
else endif
# Do not print "Entering directory ..." at all for in-tree build.
MAKEFLAGS += --no-print-directory
endif # ifneq ($(KBUILD_OUTPUT),)
ifneq ($(filter 3.%,$(MAKE_VERSION)),) ifneq ($(filter 3.%,$(MAKE_VERSION)),)
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x # 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
@ -155,20 +164,19 @@ need-sub-make := 1
$(lastword $(MAKEFILE_LIST)): ; $(lastword $(MAKEFILE_LIST)): ;
endif endif
export abs_srctree abs_objtree
export sub_make_done := 1 export sub_make_done := 1
ifeq ($(need-sub-make),1) ifeq ($(need-sub-make),1)
PHONY += $(MAKECMDGOALS) sub-make PHONY += $(MAKECMDGOALS) sub-make
$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make $(filter-out _all sub-make $(lastword $(MAKEFILE_LIST)), $(MAKECMDGOALS)) _all: sub-make
@: @:
# Invoke a second make in the output directory, passing relevant variables # Invoke a second make in the output directory, passing relevant variables
sub-make: sub-make:
$(Q)$(MAKE) \ $(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
$(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \
-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
endif # need-sub-make endif # need-sub-make
endif # sub_make_done endif # sub_make_done
@ -213,16 +221,21 @@ ifeq ("$(origin M)", "command line")
KBUILD_EXTMOD := $(M) KBUILD_EXTMOD := $(M)
endif endif
ifeq ($(KBUILD_SRC),) ifeq ($(abs_srctree),$(abs_objtree))
# building in the source tree # building in the source tree
srctree := . srctree := .
else else
ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR))) ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
# building in a subdirectory of the source tree # building in a subdirectory of the source tree
srctree := .. srctree := ..
else else
srctree := $(KBUILD_SRC) srctree := $(abs_srctree)
endif endif
# TODO:
# KBUILD_SRC is only used to distinguish in-tree/out-of-tree build.
# Replace it with $(srctree) or something.
KBUILD_SRC := $(abs_srctree)
endif endif
export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC
@ -436,7 +449,7 @@ USERINCLUDE := \
LINUXINCLUDE := \ LINUXINCLUDE := \
-I$(srctree)/arch/$(SRCARCH)/include \ -I$(srctree)/arch/$(SRCARCH)/include \
-I$(objtree)/arch/$(SRCARCH)/include/generated \ -I$(objtree)/arch/$(SRCARCH)/include/generated \
$(if $(KBUILD_SRC), -I$(srctree)/include) \ $(if $(filter .,$(srctree)),,-I$(srctree)/include) \
-I$(objtree)/include \ -I$(objtree)/include \
$(USERINCLUDE) $(USERINCLUDE)
@ -497,7 +510,7 @@ PHONY += outputmakefile
# At the same time when output Makefile generated, generate .gitignore to # At the same time when output Makefile generated, generate .gitignore to
# ignore whole output directory # ignore whole output directory
outputmakefile: outputmakefile:
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
$(Q)ln -fsn $(srctree) source $(Q)ln -fsn $(srctree) source
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
$(Q)test -e .gitignore || \ $(Q)test -e .gitignore || \
@ -520,15 +533,6 @@ KBUILD_AFLAGS += $(CLANG_FLAGS)
export CLANG_FLAGS export CLANG_FLAGS
endif endif
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_VDSO_CFLAGS_CLANG)))
export RETPOLINE_CFLAGS
export RETPOLINE_VDSO_CFLAGS
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export), # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
@ -595,20 +599,21 @@ endif
export KBUILD_MODULES KBUILD_BUILTIN export KBUILD_MODULES KBUILD_BUILTIN
ifeq ($(dot-config),1)
include include/config/auto.conf
endif
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit # Objects we will link into vmlinux / subdirs we need to visit
init-y := init/ init-y := init/
drivers-y := drivers/ sound/ drivers-y := drivers/ sound/
drivers-$(CONFIG_SAMPLES) += samples/
net-y := net/ net-y := net/
libs-y := lib/ libs-y := lib/
core-y := usr/ core-y := usr/
virt-y := virt/ virt-y := virt/
endif # KBUILD_EXTMOD endif # KBUILD_EXTMOD
ifeq ($(dot-config),1)
include include/config/auto.conf
endif
# The all: target is the default when no target is given on the # The all: target is the default when no target is given on the
# command line. # command line.
# This allow a user to issue only 'make' to build a kernel including modules # This allow a user to issue only 'make' to build a kernel including modules
@ -625,6 +630,15 @@ ifdef CONFIG_FUNCTION_TRACER
CC_FLAGS_FTRACE := -pg CC_FLAGS_FTRACE := -pg
endif endif
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_VDSO_CFLAGS_CLANG)))
export RETPOLINE_CFLAGS
export RETPOLINE_VDSO_CFLAGS
# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
# values of the respective KBUILD_* variables # values of the respective KBUILD_* variables
ARCH_CPPFLAGS := ARCH_CPPFLAGS :=
@ -985,8 +999,9 @@ vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
$(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y))) $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
$(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-)))) $(patsubst %/,%,$(filter %/, $(init-) $(core-) \
$(drivers-) $(net-) $(libs-) $(virt-))))
init-y := $(patsubst %/, %/built-in.a, $(init-y)) init-y := $(patsubst %/, %/built-in.a, $(init-y))
core-y := $(patsubst %/, %/built-in.a, $(core-y)) core-y := $(patsubst %/, %/built-in.a, $(core-y))
@ -1003,7 +1018,7 @@ export KBUILD_VMLINUX_LIBS := $(libs-y1)
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
export LDFLAGS_vmlinux export LDFLAGS_vmlinux
# used by scripts/package/Makefile # used by scripts/package/Makefile
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch include scripts tools)
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
@ -1040,11 +1055,8 @@ vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
targets := vmlinux targets := vmlinux
# Build samples along the rest of the kernel. This needs headers_install. # Some samples need headers_install.
ifdef CONFIG_SAMPLES
vmlinux-dirs += samples
samples: headers_install samples: headers_install
endif
# The actual objects are generated when descending, # The actual objects are generated when descending,
# make sure no implicit rule kicks in # make sure no implicit rule kicks in
@ -1064,7 +1076,7 @@ filechk_kernel.release = \
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
# Store (new) KERNELRELEASE string in include/config/kernel.release # Store (new) KERNELRELEASE string in include/config/kernel.release
include/config/kernel.release: $(srctree)/Makefile FORCE include/config/kernel.release: FORCE
$(call filechk,kernel.release) $(call filechk,kernel.release)
# Additional helpers built in scripts/ # Additional helpers built in scripts/
@ -1086,9 +1098,11 @@ PHONY += prepare archprepare prepare1 prepare3
# and if so do: # and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree) # 1) Check that make has not been executed in the kernel src $(srctree)
prepare3: include/config/kernel.release prepare3: include/config/kernel.release
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
@$(kecho) ' Using $(srctree) as source for kernel' @$(kecho) ' Using $(srctree) as source for kernel'
$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ $(Q)if [ -f $(srctree)/.config -o \
-d $(srctree)/include/config -o \
-d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
echo >&2 " in the '$(srctree)' directory.";\ echo >&2 " in the '$(srctree)' directory.";\
/bin/false; \ /bin/false; \
@ -1304,6 +1318,7 @@ _modinst_:
fi fi
@cp -f $(objtree)/modules.order $(MODLIB)/ @cp -f $(objtree)/modules.order $(MODLIB)/
@cp -f $(objtree)/modules.builtin $(MODLIB)/ @cp -f $(objtree)/modules.builtin $(MODLIB)/
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# This depmod is only for convenience to give the initial # This depmod is only for convenience to give the initial
@ -1344,10 +1359,11 @@ endif # CONFIG_MODULES
# Directories & files removed with 'make clean' # Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR) include/ksym CLEAN_DIRS += $(MODVERDIR) include/ksym
CLEAN_FILES += modules.builtin.modinfo
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config usr/include include/generated \ MRPROPER_DIRS += include/config usr/include include/generated \
arch/*/include/generated .tmp_objdiff arch/$(SRCARCH)/include/generated .tmp_objdiff
MRPROPER_FILES += .config .config.old .version \ MRPROPER_FILES += .config .config.old .version \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
signing_key.pem signing_key.priv signing_key.x509 \ signing_key.pem signing_key.priv signing_key.x509 \
@ -1358,7 +1374,7 @@ MRPROPER_FILES += .config .config.old .version \
# #
clean: rm-dirs := $(CLEAN_DIRS) clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES) clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples) clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs))
PHONY += $(clean-dirs) clean archclean vmlinuxclean PHONY += $(clean-dirs) clean archclean vmlinuxclean
$(clean-dirs): $(clean-dirs):

View File

@ -1449,7 +1449,6 @@ static void __exit omap_system_dma_exit(void)
MODULE_DESCRIPTION("OMAP SYSTEM DMA DRIVER"); MODULE_DESCRIPTION("OMAP SYSTEM DMA DRIVER");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRIVER_NAME);
MODULE_AUTHOR("Texas Instruments Inc"); MODULE_AUTHOR("Texas Instruments Inc");
/* /*

View File

@ -970,5 +970,4 @@ module_platform_driver(omap_dm_timer_driver);
MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver"); MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRIVER_NAME);
MODULE_AUTHOR("Texas Instruments Inc"); MODULE_AUTHOR("Texas Instruments Inc");

View File

@ -28,6 +28,9 @@ ti-emif-sram-objs := ti-emif-pm.o ti-emif-sram-pm.o
AFLAGS_ti-emif-sram-pm.o :=-Wa,-march=armv7-a AFLAGS_ti-emif-sram-pm.o :=-Wa,-march=armv7-a
include drivers/memory/Makefile.asm-offsets
drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s FORCE
$(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
targets += emif-asm-offsets.s

View File

@ -1,4 +0,0 @@
include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s FORCE
$(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
targets += emif-asm-offsets.s

View File

@ -459,7 +459,6 @@ EXPORT_SYMBOL_GPL(omap_tll_disable);
MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>"); MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>");
MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>"); MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("usb tll driver for TI OMAP EHCI and OHCI controllers"); MODULE_DESCRIPTION("usb tll driver for TI OMAP EHCI and OHCI controllers");

View File

@ -844,6 +844,7 @@
EXIT_CALL \ EXIT_CALL \
*(.discard) \ *(.discard) \
*(.discard.*) \ *(.discard.*) \
*(.modinfo) \
} }
/** /**

View File

@ -253,6 +253,7 @@ extern typeof(name) __mod_##type##__##name##_device_table \
#define MODULE_VERSION(_version) MODULE_INFO(version, _version) #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
#else #else
#define MODULE_VERSION(_version) \ #define MODULE_VERSION(_version) \
MODULE_INFO(version, _version); \
static struct module_version_attribute ___modver_attr = { \ static struct module_version_attribute ___modver_attr = { \
.mattr = { \ .mattr = { \
.attr = { \ .attr = { \

View File

@ -10,23 +10,21 @@
module name. */ module name. */
#ifdef MODULE #ifdef MODULE
#define MODULE_PARAM_PREFIX /* empty */ #define MODULE_PARAM_PREFIX /* empty */
#define __MODULE_INFO_PREFIX /* empty */
#else #else
#define MODULE_PARAM_PREFIX KBUILD_MODNAME "." #define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
/* We cannot use MODULE_PARAM_PREFIX because some modules override it. */
#define __MODULE_INFO_PREFIX KBUILD_MODNAME "."
#endif #endif
/* Chosen so that structs with an unsigned long line up. */ /* Chosen so that structs with an unsigned long line up. */
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
#ifdef MODULE
#define __MODULE_INFO(tag, name, info) \ #define __MODULE_INFO(tag, name, info) \
static const char __UNIQUE_ID(name)[] \ static const char __UNIQUE_ID(name)[] \
__used __attribute__((section(".modinfo"), unused, aligned(1))) \ __used __attribute__((section(".modinfo"), unused, aligned(1))) \
= __stringify(tag) "=" info = __MODULE_INFO_PREFIX __stringify(tag) "=" info
#else /* !MODULE */
/* This struct is here for syntactic coherency, it is not used */
#define __MODULE_INFO(tag, name, info) \
struct __UNIQUE_ID(name) {}
#endif
#define __MODULE_PARM_TYPE(name, _type) \ #define __MODULE_PARM_TYPE(name, _type) \
__MODULE_INFO(parmtype, name##type, #name ":" _type) __MODULE_INFO(parmtype, name##type, #name ":" _type)

View File

@ -20,8 +20,7 @@ config SAMPLE_TRACE_PRINTK
test various trace_printk() calls from a module. test various trace_printk() calls from a module.
config SAMPLE_KOBJECT config SAMPLE_KOBJECT
tristate "Build kobject examples -- loadable modules only" tristate "Build kobject examples"
depends on m
help help
This config option will allow you to build a number of This config option will allow you to build a number of
different kobject sample modules showing how to use kobjects, different kobject sample modules showing how to use kobjects,
@ -103,8 +102,8 @@ config SAMPLE_CONNECTOR
See also Documentation/connector/connector.txt See also Documentation/connector/connector.txt
config SAMPLE_SECCOMP config SAMPLE_SECCOMP
tristate "Build seccomp sample code -- loadable modules only" bool "Build seccomp sample code"
depends on SECCOMP_FILTER && m depends on SECCOMP_FILTER
help help
Build samples of seccomp filters using various methods of Build samples of seccomp filters using various methods of
BPF filter construction. BPF filter construction.

View File

@ -1,6 +1,6 @@
# Makefile for Linux samples code # Makefile for Linux samples code
obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ obj-y += kobject/ kprobes/ trace_events/ livepatch/ \
hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
configfs/ connector/ v4l/ trace_printk/ \ configfs/ connector/ v4l/ trace_printk/ \
vfio-mdev/ vfs/ qmi/ binderfs/ pidfd/ vfio-mdev/ vfs/ qmi/ binderfs/ pidfd/

View File

@ -40,5 +40,5 @@ HOSTLDLIBS_bpf-fancy += $(MFLAG)
HOSTLDLIBS_dropper += $(MFLAG) HOSTLDLIBS_dropper += $(MFLAG)
HOSTLDLIBS_user-trap += $(MFLAG) HOSTLDLIBS_user-trap += $(MFLAG)
endif endif
always := $(hostprogs-m) always := $(hostprogs-y)
endif endif

View File

@ -504,7 +504,7 @@ existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
# Create directories for object files if they do not exist # Create directories for object files if they do not exist
obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
# If targets exist, their directories apparently exist. Skip mkdir. # If targets exist, their directories apparently exist. Skip mkdir.

View File

@ -71,7 +71,7 @@ __hostc_flags = $(_hostc_flags)
__hostcxx_flags = $(_hostcxx_flags) __hostcxx_flags = $(_hostcxx_flags)
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
__hostc_flags = -I$(obj) $(call flags,_hostc_flags) __hostc_flags = -I$(obj) $(call flags,_hostc_flags)
__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
endif endif

View File

@ -144,7 +144,7 @@ __cpp_flags = $(_cpp_flags)
# If building the kernel in a separate objtree expand all occurrences # If building the kernel in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
# -I$(obj) locates generated .h files # -I$(obj) locates generated .h files
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files

View File

@ -15,7 +15,7 @@ include include/config/tristate.conf
include scripts/Kbuild.include include scripts/Kbuild.include
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
# Create output directory if not already present # Create output directory if not already present
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
endif endif

View File

@ -78,7 +78,7 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) $(if $(KBUILD_MODPOST_WARN),-w)
MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS))) MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
ifneq ($(KBUILD_SRC),) ifneq ($(srctree),.)
symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))

View File

@ -212,6 +212,9 @@ modpost_link vmlinux.o
# modpost vmlinux.o to check for section mismatches # modpost vmlinux.o to check for section mismatches
${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o ${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
info MODINFO modules.builtin.modinfo
${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo
kallsymso="" kallsymso=""
kallsyms_vmlinux="" kallsyms_vmlinux=""
if [ -n "${CONFIG_KALLSYMS}" ]; then if [ -n "${CONFIG_KALLSYMS}" ]; then

View File

@ -7,33 +7,11 @@
# Usage # Usage
# $1 - Kernel src directory # $1 - Kernel src directory
# Only overwrite automatically generated Makefiles
# (so we do not overwrite kernel Makefile)
if test -e Makefile && ! grep -q Automatically Makefile
then
exit 0
fi
if [ "${quiet}" != "silent_" ]; then if [ "${quiet}" != "silent_" ]; then
echo " GEN Makefile" echo " GEN Makefile"
fi fi
cat << EOF > Makefile cat << EOF > Makefile
# Automatically generated by $0: don't edit # Automatically generated by $(realpath $0): don't edit
include $(realpath $1/Makefile)
ifeq ("\$(origin V)", "command line")
VERBOSE := \$(V)
endif
ifneq (\$(VERBOSE),1)
Q := @
endif
MAKEFLAGS += --no-print-directory
.PHONY: __sub-make \$(MAKECMDGOALS)
__sub-make:
\$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
@:
EOF EOF

View File

@ -496,7 +496,7 @@ sub update_funcs
# #
# Step 2: find the sections and mcount call sites # Step 2: find the sections and mcount call sites
# #
open(IN, "$objdump -hdr $inputfile|") || die "error running $objdump"; open(IN, "LANG=C $objdump -hdr $inputfile|") || die "error running $objdump";
my $text; my $text;

View File

@ -19,7 +19,7 @@ ignore="$ignore ( -name *.mod.c ) -prune -o"
# Do not use full path if we do not use O=.. builds # Do not use full path if we do not use O=.. builds
# Use make O=. {tags|cscope} # Use make O=. {tags|cscope}
# to force full paths for a non-O= build # to force full paths for a non-O= build
if [ "${KBUILD_SRC}" = "" ]; then if [ "${srctree}" = "." -o -z "${srctree}" ]; then
tree= tree=
else else
tree=${srctree}/ tree=${srctree}/