Skip to content

Commit

Permalink
Merge tag 'kbuild-fixes-v6.3' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/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
  • Loading branch information
torvalds committed Mar 18, 2023
2 parents 2a3e75a + 05e96e9 commit 5342933
Show file tree
Hide file tree
Showing 15 changed files with 358 additions and 1,300 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ modules.order
# RPM spec file (make rpm-pkg)
#
/*.spec
/rpmbuild/

#
# Debian directory (make deb-pkg)
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
# ---------------------------------------------------------------------------

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion scripts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/generate_rust_target
/insert-sys-cert
/kallsyms
/list-gitignored
/module.lds
/recordmcount
/sign-file
Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
148 changes: 69 additions & 79 deletions scripts/Makefile.package
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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-rootdir := $(srctree)
%.tar.zst: %.tar
$(call cmd,zstd)

%.tar:
$(call cmd,tar)

%.tar.gz: private tar-compress-opt := -I $(KGZIP)
%.tar.gz:
$(call cmd,tar)
# Git
# ---------------------------------------------------------------------------

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

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

%.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
# ---------------------------------------------------------------------------
Expand All @@ -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
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -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'
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -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)
14 changes: 14 additions & 0 deletions scripts/check-git
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
#
# succeed if we are in a git repository

srctree="$(dirname $0)/.."

if ! git -C "${srctree}" rev-parse --verify HEAD >/dev/null 2>/dev/null; then
exit 1
fi

if ! test -z $(git -C "${srctree}" rev-parse --show-cdup 2>/dev/null); then
exit 1
fi
1 change: 1 addition & 0 deletions scripts/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static bool is_ignored_symbol(const char *name, char type)
"kallsyms_markers",
"kallsyms_token_table",
"kallsyms_token_index",
"kallsyms_seqs_of_names",
/* Exclude linker generated symbols which vary between passes */
"_SDA_BASE_", /* ppc */
"_SDA2_BASE_", /* ppc */
Expand Down
6 changes: 4 additions & 2 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,12 @@ static void (*conf_changed_callback)(void);

void conf_set_changed(bool val)
{
if (conf_changed_callback && conf_changed != val)
conf_changed_callback();
bool changed = conf_changed != val;

conf_changed = val;

if (conf_changed_callback && changed)
conf_changed_callback();
}

bool conf_get_changed(void)
Expand Down
Loading

0 comments on commit 5342933

Please sign in to comment.