Commit 368d060b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull Kbuild updates from Masahiro Yamada:

 - detect missing include guard in UAPI headers

 - do not create orphan built-in.a or obj-y objects

 - generate modules.builtin more simply, and drop tristate.conf

 - simplify built-in initramfs creation

 - make linux-headers deb package thinner

 - optimize the deb package build script

 - misc cleanups

* tag 'kbuild-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
  builddeb: split libc headers deployment out into a function
  builddeb: split kernel headers deployment out into a function
  builddeb: remove redundant make for ARCH=um
  builddeb: avoid invoking sub-shells where possible
  builddeb: remove redundant $objtree/
  builddeb: match temporary directory name to the package name
  builddeb: remove unneeded files in hdrobjfiles for headers package
  kbuild: use -S instead of -E for precise cc-option test in Kconfig
  builddeb: allow selection of .deb compressor
  kbuild: remove 'Building modules, stage 2.' log
  kbuild: remove *.tmp file when filechk fails
  kbuild: remove PYTHON2 variable
  modpost: assume STT_SPARC_REGISTER is defined
  gen_initramfs.sh: remove intermediate cpio_list on errors
  initramfs: refactor the initramfs build rules
  gen_initramfs.sh: always output cpio even without -o option
  initramfs: add default_cpio_list, and delete -d option support
  initramfs: generate dependency list and cpio at the same time
  initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile
  initramfs: make initramfs compression choice non-optional
  ...
parents acd77500 451dff37
Loading
Loading
Loading
Loading
+0 −5
Original line number Original line Diff line number Diff line
@@ -154,11 +154,6 @@ KCONFIG_AUTOCONFIG
This environment variable can be set to specify the path & name of the
This environment variable can be set to specify the path & name of the
"auto.conf" file.  Its default value is "include/config/auto.conf".
"auto.conf" file.  Its default value is "include/config/auto.conf".


KCONFIG_TRISTATE
----------------
This environment variable can be set to specify the path & name of the
"tristate.conf" file.  Its default value is "include/config/tristate.conf".

KCONFIG_AUTOHEADER
KCONFIG_AUTOHEADER
------------------
------------------
This environment variable can be set to specify the path & name of the
This environment variable can be set to specify the path & name of the
+6 −18
Original line number Original line Diff line number Diff line
@@ -423,7 +423,6 @@ INSTALLKERNEL := installkernel
DEPMOD		= /sbin/depmod
DEPMOD		= /sbin/depmod
PERL		= perl
PERL		= perl
PYTHON		= python
PYTHON		= python
PYTHON2		= python2
PYTHON3		= python3
PYTHON3		= python3
CHECK		= sparse
CHECK		= sparse
BASH		= bash
BASH		= bash
@@ -474,7 +473,7 @@ CLANG_FLAGS :=


export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL
export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL
export PERL PYTHON PYTHON2 PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE


export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
@@ -674,7 +673,7 @@ $(KCONFIG_CONFIG):
#
#
# This exploits the 'multi-target pattern rule' trick.
# This exploits the 'multi-target pattern rule' trick.
# The syncconfig should be executed only once to make all the targets.
# The syncconfig should be executed only once to make all the targets.
%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
%/auto.conf %/auto.conf.cmd: $(KCONFIG_CONFIG)
	$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
	$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
else # !may-sync-config
else # !may-sync-config
# External modules and some install targets need include/generated/autoconf.h
# External modules and some install targets need include/generated/autoconf.h
@@ -1278,24 +1277,13 @@ all: modules
# using awk while concatenating to the final file.
# using awk while concatenating to the final file.


PHONY += modules
PHONY += modules
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order
	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh


modules.order: descend
modules.order: descend
	$(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@
	$(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@


modbuiltin-dirs := $(addprefix _modbuiltin_, $(build-dirs))

modules.builtin: $(modbuiltin-dirs)
	$(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@

PHONY += $(modbuiltin-dirs)
# tristate.conf is not included from this Makefile. Add it as a prerequisite
# here to make it self-healing in case somebody accidentally removes it.
$(modbuiltin-dirs): include/config/tristate.conf
	$(Q)$(MAKE) $(modbuiltin)=$(patsubst _modbuiltin_%,%,$@)

# Target to prepare building external modules
# Target to prepare building external modules
PHONY += modules_prepare
PHONY += modules_prepare
modules_prepare: prepare
modules_prepare: prepare
@@ -1315,7 +1303,7 @@ _modinst_:
		ln -s $(CURDIR) $(MODLIB)/build ; \
		ln -s $(CURDIR) $(MODLIB)/build ; \
	fi
	fi
	@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
	@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
	@sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin
	@cp -f modules.builtin $(MODLIB)/
	@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
	@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst


@@ -1357,7 +1345,7 @@ endif # CONFIG_MODULES


# Directories & files removed with 'make clean'
# Directories & files removed with 'make clean'
CLEAN_DIRS  += include/ksym
CLEAN_DIRS  += include/ksym
CLEAN_FILES += modules.builtin.modinfo modules.nsdeps
CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps


# Directories & files removed with 'make mrproper'
# Directories & files removed with 'make mrproper'
MRPROPER_DIRS  += include/config include/generated          \
MRPROPER_DIRS  += include/config include/generated          \
@@ -1712,7 +1700,7 @@ clean: $(clean-dirs)
		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
		-o -name '*.asn1.[ch]' \
		-o -name '*.asn1.[ch]' \
		-o -name '*.symtypes' -o -name 'modules.order' \
		-o -name '*.symtypes' -o -name 'modules.order' \
		-o -name modules.builtin -o -name '.tmp_*.o.*' \
		-o -name '.tmp_*.o.*' \
		-o -name '*.c.[012]*.*' \
		-o -name '*.c.[012]*.*' \
		-o -name '*.ll' \
		-o -name '*.ll' \
		-o -name '*.gcno' \) -type f -print | xargs rm -f
		-o -name '*.gcno' \) -type f -print | xargs rm -f
+11 −1
Original line number Original line Diff line number Diff line
@@ -169,6 +169,16 @@ extern void cleanup_module(void);
 */
 */
#define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)
#define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)


/*
 * MODULE_FILE is used for generating modules.builtin
 * So, make it no-op when this is being built as a module
 */
#ifdef MODULE
#define MODULE_FILE
#else
#define MODULE_FILE	MODULE_INFO(file, KBUILD_MODFILE);
#endif

/*
/*
 * The following license idents are currently accepted as indicating free
 * The following license idents are currently accepted as indicating free
 * software modules
 * software modules
@@ -213,7 +223,7 @@ extern void cleanup_module(void);
 * 2.	So the community can ignore bug reports including proprietary modules
 * 2.	So the community can ignore bug reports including proprietary modules
 * 3.	So vendors can do likewise based on their own policies
 * 3.	So vendors can do likewise based on their own policies
 */
 */
#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
#define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license, _license)


/*
/*
 * Author(s), use "Name <email>" or just "Name", for multiple
 * Author(s), use "Name <email>" or just "Name", for multiple
+11 −14
Original line number Original line Diff line number Diff line
@@ -32,6 +32,10 @@ real-prereqs = $(filter-out $(PHONY), $^)
# Escape single quote for use in echo statements
# Escape single quote for use in echo statements
escsq = $(subst $(squote),'\$(squote)',$1)
escsq = $(subst $(squote),'\$(squote)',$1)


###
# Quote a string to pass it to C files. foo => '"foo"'
stringify = $(squote)$(quote)$1$(quote)$(squote)

###
###
# Easy method for doing a status message
# Easy method for doing a status message
       kecho := :
       kecho := :
@@ -57,12 +61,11 @@ kecho := $($(quiet)kecho)
define filechk
define filechk
	$(Q)set -e;						\
	$(Q)set -e;						\
	mkdir -p $(dir $@);					\
	mkdir -p $(dir $@);					\
	{ $(filechk_$(1)); } > $@.tmp;		\
	trap "rm -f $(dot-target).tmp" EXIT;			\
	if [ -r $@ ] && cmp -s $@ $@.tmp; then	\
	{ $(filechk_$(1)); } > $(dot-target).tmp;		\
		rm -f $@.tmp;			\
	if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then	\
	else					\
		$(kecho) '  UPD     $@';			\
		$(kecho) '  UPD     $@';			\
		mv -f $@.tmp $@;		\
		mv -f $(dot-target).tmp $@;			\
	fi
	fi
endef
endef


@@ -159,12 +162,6 @@ ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
# $(Q)$(MAKE) $(build)=dir
# $(Q)$(MAKE) $(build)=dir
build := -f $(srctree)/scripts/Makefile.build obj
build := -f $(srctree)/scripts/Makefile.build obj


###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
# Usage:
# $(Q)$(MAKE) $(modbuiltin)=dir
modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj

###
###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
# Usage:
# Usage:
+1 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)


# $(cc-option,<flag>)
# $(cc-option,<flag>)
# Return y if the compiler supports <flag>, n otherwise
# Return y if the compiler supports <flag>, n otherwise
cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null)
cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)


# $(ld-option,<flag>)
# $(ld-option,<flag>)
# Return y if the linker supports <flag>, n otherwise
# Return y if the linker supports <flag>, n otherwise
Loading