Commit 53429336 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'kbuild-fixes-v6.3' of...

Merge tag 'kbuild-fixes-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Exclude kallsyms_seqs_of_names from kallsyms to fix build error

 - Fix 'make kernelrelease' for external module builds

 - Get the Debian source package compilable again

 - Fix the wrong uname when Debian packages are built with the
   KDEB_PKGVERSION option

 - Fix superfluous CROSS_COMPILE when building Debian packages

 - Fix RPM package build error when KCONFIG_CONFIG is set

 - Use 'git archive' for creating source tarballs

 - Remove the scripts/list-gitignored tool

* tag 'kbuild-fixes-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: use git-archive for source package creation
  kbuild: rpm-pkg: move source components to rpmbuild/SOURCES
  kbuild: deb-pkg: use dh_listpackages to know enabled packages
  kbuild: deb-pkg: split image and debug objects staging out into functions
  kbuild: deb-pkg: set CROSS_COMPILE only when undefined
  kbuild: deb-pkg: do not take KERNELRELEASE from the source version
  kbuild: deb-pkg: make debian source package working again
  Makefile: Make kernelrelease target work with M=
  kconfig: Update config changed flag before calling callback
  kallsyms: add kallsyms_seqs_of_names to list of special symbols
parents 2a3e75a7 05e96e96
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ modules.order
# RPM spec file (make rpm-pkg)
#
/*.spec
/rpmbuild/

#
# Debian directory (make deb-pkg)
+4 −7
Original line number Diff line number Diff line
@@ -274,8 +274,7 @@ no-dot-config-targets := $(clean-targets) \
			 cscope gtags TAGS tags help% %docs check% coccicheck \
			 $(version_h) headers headers_% archheaders archscripts \
			 %asm-generic kernelversion %src-pkg dt_binding_check \
			 outputmakefile rustavailable rustfmt rustfmtcheck \
			 scripts_package
			 outputmakefile rustavailable rustfmt rustfmtcheck
# 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 \
@@ -1605,7 +1604,7 @@ MRPROPER_FILES += include/config include/generated \
		  certs/signing_key.pem \
		  certs/x509.genkey \
		  vmlinux-gdb.py \
		  *.spec \
		  *.spec rpmbuild \
		  rust/libmacros.so

# clean - Delete most, but leave enough to build external modules
@@ -1656,10 +1655,6 @@ distclean: mrproper
%pkg: include/config/kernel.release FORCE
	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@

PHONY += scripts_package
scripts_package: scripts_basic
	$(Q)$(MAKE) $(build)=scripts scripts/list-gitignored

# Brief documentation of the typical targets used
# ---------------------------------------------------------------------------

@@ -1886,6 +1881,8 @@ endif

else # KBUILD_EXTMOD

filechk_kernel.release = echo $(KERNELRELEASE)

###
# External module support.
# When building external modules the kernel used as basis is considered
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
/generate_rust_target
/insert-sys-cert
/kallsyms
/list-gitignored
/module.lds
/recordmcount
/sign-file
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
endif

# The following programs are only built on demand
hostprogs += list-gitignored unifdef
hostprogs += unifdef

# The module linker script is preprocessed on demand
targets += module.lds
+69 −79
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
# Makefile for the different targets used to generate full packages of a kernel

include $(srctree)/scripts/Kbuild.include
include $(srctree)/scripts/Makefile.lib

KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
@@ -26,54 +27,46 @@ fi ; \
tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
	--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3)

# .tmp_filelist .tmp_filelist_exclude
# tarball compression
# ---------------------------------------------------------------------------

scripts/list-gitignored: FORCE
	$(Q)$(MAKE) -f $(srctree)/Makefile scripts_package
%.tar.gz: %.tar
	$(call cmd,gzip)

# 1f5d3a6b6532e25a5cdf1f311956b2b03d343a48 removed '*.rej' from .gitignore,
# but it is definitely a generated file.
filechk_filelist = \
	$< --exclude='*.rej' --output=$@_exclude --prefix=./ --rootdir=$(srctree) --stat=-
%.tar.bz2: %.tar
	$(call cmd,bzip2)

.tmp_filelist: scripts/list-gitignored FORCE
	$(call filechk,filelist)
%.tar.xz: %.tar
	$(call cmd,xzmisc)

# tarball
# ---------------------------------------------------------------------------

quiet_cmd_tar = TAR     $@
      cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
                --owner=0 --group=0 --sort=name \
                --transform 's:^\.:$*:S' -C $(tar-rootdir) .
%.tar.zst: %.tar
	$(call cmd,zstd)

tar-rootdir := $(srctree)

%.tar:
	$(call cmd,tar)
# Git
# ---------------------------------------------------------------------------

%.tar.gz: private tar-compress-opt := -I $(KGZIP)
%.tar.gz:
	$(call cmd,tar)
filechk_HEAD = git -C $(srctree) rev-parse --verify HEAD 2>/dev/null

%.tar.bz2: private tar-compress-opt := -I $(KBZIP2)
%.tar.bz2:
	$(call cmd,tar)
.tmp_HEAD: check-git FORCE
	$(call filechk,HEAD)

%.tar.xz: private tar-compress-opt := -I $(XZ)
%.tar.xz:
	$(call cmd,tar)

%.tar.zst: private tar-compress-opt := -I $(ZSTD)
%.tar.zst:
	$(call cmd,tar)
PHONY += check-git
check-git:
	@if ! $(srctree)/scripts/check-git; then \
		echo >&2 "error: creating source package requires git repository"; \
		false; \
	fi

# Linux source tarball
# ---------------------------------------------------------------------------

linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude
linux.tar.gz: .tmp_filelist
quiet_cmd_archive_linux = ARCHIVE $@
      cmd_archive_linux = \
	git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ $$(cat $<)

targets += linux.tar
linux.tar: .tmp_HEAD FORCE
	$(call if_changed,archive_linux)

# rpm-pkg
# ---------------------------------------------------------------------------
@@ -89,7 +82,7 @@ PHONY += srcrpm-pkg
srcrpm-pkg: linux.tar.gz
	$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
	+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -bs kernel.spec \
	--define='_smp_mflags %{nil}' --define='_sourcedir .' --define='_srcrpmdir .'
	--define='_smp_mflags %{nil}' --define='_sourcedir rpmbuild/SOURCES' --define='_srcrpmdir .'

# binrpm-pkg
# ---------------------------------------------------------------------------
@@ -148,74 +141,62 @@ snap-pkg:
# dir-pkg tar*-pkg - tarball targets
# ---------------------------------------------------------------------------

tar-pkg-tarball = linux-$(KERNELRELEASE)-$(ARCH).$(1)
tar-pkg-phony = $(subst .,,$(1))-pkg

tar-install: FORCE
	$(Q)$(MAKE) -f $(srctree)/Makefile
	+$(Q)$(srctree)/scripts/package/buildtar $@

quiet_cmd_tar = TAR     $@
      cmd_tar = cd $<; tar cf ../$@ --owner=root --group=root --sort=name *

linux-$(KERNELRELEASE)-$(ARCH).tar: tar-install
	$(call cmd,tar)

PHONY += dir-pkg
dir-pkg: tar-install
	@echo "Kernel tree successfully created in $<"

define tar-pkg-rule
PHONY += $(tar-pkg-phony)
$(tar-pkg-phony): $(tar-pkg-tarball)
PHONY += tar-pkg
tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar
	@:

$(tar-pkg-tarball): private tar-rootdir := tar-install
$(tar-pkg-tarball): tar-install
endef

$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call tar-pkg-rule,$(x))))
tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
	@:

# perf-tar*-src-pkg - generate a source tarball with perf source
# ---------------------------------------------------------------------------

perf-tar-src-pkg-tarball = perf-$(KERNELVERSION).$(1)
perf-tar-src-pkg-phony   = perf-$(subst .,,$(1))-src-pkg

quiet_cmd_stage_perf_src = STAGE   $@
      cmd_stage_perf_src = \
	rm -rf $@; \
	mkdir -p $@; \
	tar -c -f - --exclude-from=$<_exclude -C $(srctree) --files-from=$(srctree)/tools/perf/MANIFEST | \
	tar -x -f - -C $@

.tmp_perf: .tmp_filelist
	$(call cmd,stage_perf_src)

filechk_perf_head = \
	if test -z "$(git -C $(srctree) rev-parse --show-cdup 2>/dev/null)" && \
	       head=$$(git -C $(srctree) rev-parse --verify HEAD 2>/dev/null); then \
		echo $$head; \
	else \
		echo "not a git tree"; \
	fi
.tmp_perf:
	$(Q)mkdir .tmp_perf

.tmp_perf/HEAD: .tmp_perf FORCE
	$(call filechk,perf_head)
.tmp_perf/HEAD: .tmp_HEAD | .tmp_perf
	$(call cmd,copy)

quiet_cmd_perf_version_file = GEN     $@
      cmd_perf_version_file = cd $(srctree)/tools/perf; util/PERF-VERSION-GEN $(dir $(abspath $@))

# PERF-VERSION-FILE and HEAD are independent, but this avoids updating the
# PERF-VERSION-FILE and .tmp_HEAD are independent, but this avoids updating the
# timestamp of PERF-VERSION-FILE.
# The best is to fix tools/perf/util/PERF-VERSION-GEN.
.tmp_perf/PERF-VERSION-FILE: .tmp_perf/HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN
.tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf
	$(call cmd,perf_version_file)

define perf-tar-src-pkg-rule
PHONY += $(perf-tar-src-pkg-phony)
$(perf-tar-src-pkg-phony): $(perf-tar-src-pkg-tarball)
	@:
quiet_cmd_archive_perf = ARCHIVE $@
      cmd_archive_perf = \
	git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ \
	--add-file=$$(realpath $(word 2, $^)) \
	--add-file=$$(realpath $(word 3, $^)) \
	$$(cat $(word 2, $^))^{tree} $$(cat $<)

$(perf-tar-src-pkg-tarball): private tar-rootdir := .tmp_perf
$(perf-tar-src-pkg-tarball): .tmp_filelist .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE
endef
targets += perf-$(KERNELVERSION).tar
perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE
	$(call if_changed,archive_perf)

PHONY += perf-tar-src-pkg
perf-tar-src-pkg: perf-$(KERNELVERSION).tar
	@:

$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call perf-tar-src-pkg-rule,$(x))))
perf-tar%-src-pkg: perf-$(KERNELVERSION).tar.% FORCE
	@:

# Help text displayed when executing 'make help'
# ---------------------------------------------------------------------------
@@ -243,4 +224,13 @@ help:
PHONY += FORCE
FORCE:

# Read all saved command lines and dependencies for the $(targets) we
# may be building above, using $(if_changed{,_dep}). As an
# optimization, we don't need to read them if the target does not
# exist, we will rebuild anyway in that case.

existing-targets := $(wildcard $(sort $(targets)))

-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)

.PHONY: $(PHONY)
Loading