Skip to content

Commit df202b4

Browse files
committed
Merge tag 'kbuild-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Add HOSTPKG_CONFIG env variable to allow users to override pkg-config - Support W=e as a shorthand for KCFLAGS=-Werror - Fix CONFIG_IKHEADERS build to support toybox cpio - Add scripts/dummy-tools/pahole to ease distro packagers' life - Suppress false-positive warnings from checksyscalls.sh for W=2 build - Factor out the common code of arch/*/boot/install.sh into scripts/install.sh - Support 'kernel-install' tool in scripts/prune-kernel - Refactor module-versioning to link the symbol versions at the final link of vmlinux and modules - Remove CONFIG_MODULE_REL_CRCS because module-versioning now works in an arch-agnostic way - Refactor modpost, Makefiles * tag 'kbuild-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (56 commits) genksyms: adjust the output format to modpost kbuild: stop merging *.symversions kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS modpost: extract symbol versions from *.cmd files modpost: add sym_find_with_module() helper modpost: change the license of EXPORT_SYMBOL to bool type modpost: remove left-over cross_compile declaration kbuild: record symbol versions in *.cmd files kbuild: generate a list of objects in vmlinux modpost: move *.mod.c generation to write_mod_c_files() modpost: merge add_{intree_flag,retpoline,staging_flag} to add_header scripts/prune-kernel: Use kernel-install if available kbuild: factor out the common installation code into scripts/install.sh modpost: split new_symbol() to symbol allocation and hash table addition modpost: make sym_add_exported() always allocate a new symbol modpost: make multiple export error modpost: dump Module.symvers in the same order of modules.order modpost: traverse the namespace_list in order modpost: use doubly linked list for dump_lists modpost: traverse unresolved symbols in order ...
2 parents 16477cd + 5ce2176 commit df202b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+874
-844
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
*.symversions
4646
*.tab.[ch]
4747
*.tar
48+
*.usyms
4849
*.xz
4950
*.zst
5051
Module.symvers

Documentation/kbuild/kconfig-language.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,17 @@ in documenting basic Kconfig syntax a more precise definition of Kconfig
693693
semantics is welcomed. One project deduced Kconfig semantics through
694694
the use of the xconfig configurator [1]_. Work should be done to confirm if
695695
the deduced semantics matches our intended Kconfig design goals.
696+
Another project formalized a denotational semantics of a core subset of
697+
the Kconfig language [10]_.
696698

697699
Having well defined semantics can be useful for tools for practical
698700
evaluation of dependencies, for instance one such case was work to
699701
express in boolean abstraction of the inferred semantics of Kconfig to
700702
translate Kconfig logic into boolean formulas and run a SAT solver on this to
701703
find dead code / features (always inactive), 114 dead features were found in
702704
Linux using this methodology [1]_ (Section 8: Threats to validity).
705+
The kismet tool, based on the semantics in [10]_, finds abuses of reverse
706+
dependencies and has led to dozens of committed fixes to Linux Kconfig files [11]_.
703707

704708
Confirming this could prove useful as Kconfig stands as one of the leading
705709
industrial variability modeling languages [1]_ [2]_. Its study would help
@@ -738,3 +742,5 @@ https://kernelnewbies.org/KernelProjects/kconfig-sat
738742
.. [7] https://vamos.cs.fau.de
739743
.. [8] https://undertaker.cs.fau.de
740744
.. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
745+
.. [10] https://paulgazzillo.com/papers/esecfse21.pdf
746+
.. [11] https://github.com/paulgazz/kmax

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ else
436436
HOSTCC = gcc
437437
HOSTCXX = g++
438438
endif
439+
HOSTPKG_CONFIG = pkg-config
439440

440441
KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
441442
-O2 -fomit-frame-pointer -std=gnu11 \
@@ -533,7 +534,7 @@ KBUILD_LDFLAGS_MODULE :=
533534
KBUILD_LDFLAGS :=
534535
CLANG_FLAGS :=
535536

536-
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
537+
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
537538
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
538539
export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
539540
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
@@ -1294,11 +1295,12 @@ scripts_unifdef: scripts_basic
12941295
# Install
12951296

12961297
# Many distributions have the custom install script, /sbin/installkernel.
1297-
# If DKMS is installed, 'make install' will eventually recuses back
1298-
# to the this Makefile to build and install external modules.
1298+
# If DKMS is installed, 'make install' will eventually recurse back
1299+
# to this Makefile to build and install external modules.
12991300
# Cancel sub_make_done so that options such as M=, V=, etc. are parsed.
13001301

1301-
install: sub_make_done :=
1302+
quiet_cmd_install = INSTALL $(INSTALL_PATH)
1303+
cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh
13021304

13031305
# ---------------------------------------------------------------------------
13041306
# Tools
@@ -1650,6 +1652,7 @@ help:
16501652
@echo ' 1: warnings which may be relevant and do not occur too often'
16511653
@echo ' 2: warnings which occur quite often but may still be relevant'
16521654
@echo ' 3: more obscure warnings, can most likely be ignored'
1655+
@echo ' e: warnings are being treated as errors'
16531656
@echo ' Multiple levels can be combined with W=12 or W=123'
16541657
@echo ''
16551658
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@@ -1792,7 +1795,8 @@ ifdef single-build
17921795

17931796
# .ko is special because modpost is needed
17941797
single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
1795-
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
1798+
single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS)) \
1799+
$(foreach x, o mod, $(patsubst %.ko, %.$x, $(single-ko)))
17961800

17971801
$(single-ko): single_modpost
17981802
@:
@@ -1848,7 +1852,7 @@ clean: $(clean-dirs)
18481852
-o -name '*.ko.*' \
18491853
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
18501854
-o -name '*.dwo' -o -name '*.lst' \
1851-
-o -name '*.su' -o -name '*.mod' \
1855+
-o -name '*.su' -o -name '*.mod' -o -name '*.usyms' \
18521856
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
18531857
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
18541858
-o -name '*.asn1.[ch]' \

arch/arm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ $(BOOT_TARGETS): vmlinux
312312
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
313313
@$(kecho) ' Kernel: $(boot)/$@ is ready'
314314

315+
$(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@)
315316
$(INSTALL_TARGETS):
316-
$(CONFIG_SHELL) $(srctree)/$(boot)/install.sh "$(KERNELRELEASE)" \
317-
$(boot)/$(patsubst %install,%Image,$@) System.map "$(INSTALL_PATH)"
317+
$(call cmd,install)
318318

319319
PHONY += vdso_install
320320
vdso_install:

arch/arm/boot/install.sh

100644100755
Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/sh
22
#
3-
# arch/arm/boot/install.sh
4-
#
53
# This file is subject to the terms and conditions of the GNU General Public
64
# License. See the file "COPYING" in the main directory of this archive
75
# for more details.
@@ -18,25 +16,6 @@
1816
# $2 - kernel image file
1917
# $3 - kernel map file
2018
# $4 - default install path (blank if root directory)
21-
#
22-
23-
verify () {
24-
if [ ! -f "$1" ]; then
25-
echo "" 1>&2
26-
echo " *** Missing file: $1" 1>&2
27-
echo ' *** You need to run "make" before "make install".' 1>&2
28-
echo "" 1>&2
29-
exit 1
30-
fi
31-
}
32-
33-
# Make sure the files actually exist
34-
verify "$2"
35-
verify "$3"
36-
37-
# User may have a custom install script
38-
if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
39-
if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
4019

4120
if [ "$(basename $2)" = "zImage" ]; then
4221
# Compressed install

arch/arm64/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,9 @@ Image: vmlinux
162162
Image.%: Image
163163
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
164164

165-
install: install-image := Image
166-
zinstall: install-image := Image.gz
165+
install: KBUILD_IMAGE := $(boot)/Image
167166
install zinstall:
168-
$(CONFIG_SHELL) $(srctree)/$(boot)/install.sh $(KERNELRELEASE) \
169-
$(boot)/$(install-image) System.map "$(INSTALL_PATH)"
167+
$(call cmd,install)
170168

171169
PHONY += vdso_install
172170
vdso_install:

arch/arm64/boot/install.sh

100644100755
Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/sh
22
#
3-
# arch/arm64/boot/install.sh
4-
#
53
# This file is subject to the terms and conditions of the GNU General Public
64
# License. See the file "COPYING" in the main directory of this archive
75
# for more details.
@@ -18,25 +16,6 @@
1816
# $2 - kernel image file
1917
# $3 - kernel map file
2018
# $4 - default install path (blank if root directory)
21-
#
22-
23-
verify () {
24-
if [ ! -f "$1" ]; then
25-
echo "" 1>&2
26-
echo " *** Missing file: $1" 1>&2
27-
echo ' *** You need to run "make" before "make install".' 1>&2
28-
echo "" 1>&2
29-
exit 1
30-
fi
31-
}
32-
33-
# Make sure the files actually exist
34-
verify "$2"
35-
verify "$3"
36-
37-
# User may have a custom install script
38-
if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
39-
if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
4019

4120
if [ "$(basename $2)" = "Image.gz" ]; then
4221
# Compressed install

arch/ia64/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ archheaders:
7272

7373
CLEAN_FILES += vmlinux.gz
7474

75-
install: vmlinux.gz
76-
sh $(srctree)/arch/ia64/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
75+
install: KBUILD_IMAGE := vmlinux.gz
76+
install:
77+
$(call cmd,install)
7778

7879
define archhelp
7980
echo '* compressed - Build compressed kernel image'

arch/ia64/install.sh

100644100755
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/sh
22
#
3-
# arch/ia64/install.sh
4-
#
53
# This file is subject to the terms and conditions of the GNU General Public
64
# License. See the file "COPYING" in the main directory of this archive
75
# for more details.
@@ -17,14 +15,6 @@
1715
# $2 - kernel image file
1816
# $3 - kernel map file
1917
# $4 - default install path (blank if root directory)
20-
#
21-
22-
# User may have a custom install script
23-
24-
if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
25-
if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
26-
27-
# Default install - same as make zlilo
2818

2919
if [ -f $4/vmlinuz ]; then
3020
mv $4/vmlinuz $4/vmlinuz.old

arch/m68k/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,6 @@ CLEAN_FILES += vmlinux.gz vmlinux.bz2
138138
archheaders:
139139
$(Q)$(MAKE) $(build)=arch/m68k/kernel/syscalls all
140140

141+
install: KBUILD_IMAGE := vmlinux.gz
141142
install:
142-
sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
143+
$(call cmd,install)

0 commit comments

Comments
 (0)