From f84fdf8df1c15f1e66478340bf0da5449f30a0af Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 15 Feb 2020 16:50:20 +0900 Subject: [PATCH 01/34] kbuild: remove the owner check in mkcompile_h This reverts a very old commit, which dates back to the pre-git era: |commit 5d1cfb5b12f72145d30ba0f53c9f238144b122b8 |Author: Kai Germaschewski |Date: Sat Jul 27 02:53:19 2002 -0500 | | kbuild: Fix compiling/installing as different users | | "make bzImage && sudo make install" had the problem that during | the "sudo make install" the build system would notice that the information | in include/linux/compile.h is not accurate (it says "compiled by ", | but we are root), thus causing compile.h to be updated and leading to | some recompiles. | | We now only update "compile.h" if the current user is the owner of | include/linux/autoconf.h, i.e. the user who did the "make *config". So the | above sequence will correctly state "compiled by ". | |diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h |index 6313db96172..cd956380978 100755 |--- a/scripts/mkcompile_h |+++ b/scripts/mkcompile_h |@@ -3,6 +3,17 @@ ARCH=$2 | SMP=$3 | CC=$4 | |+# If compile.h exists already and we don't own autoconf.h |+# (i.e. we're not the same user who did make *config), don't |+# modify compile.h |+# So "sudo make install" won't change the "compiled by " |+# do "compiled by root" |+ |+if [ -r $TARGET -a ! -O ../include/linux/autoconf.h ]; then |+ echo ' (not modified)' |+ exit 0 |+fi |+ | if [ -r ../.version ]; then | VERSION=`cat ../.version` | else The 'make bzImage && sudo make install' problem no longer happens because commit 1648e4f80506 ("x86, kbuild: make "make install" not depend on vmlinux") fixed the root cause. Commit 19514fc665ff ("arm, kbuild: make "make install" not depend on vmlinux") fixed the similar issue on ARM, with detailed explanation. So, the rule is that the installation targets should never trigger the builds of any build artifact. By following it, this check is unneeded. Signed-off-by: Masahiro Yamada --- scripts/mkcompile_h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 3a5a4b210c86..3ff26e5b2eac 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -10,17 +10,6 @@ CC=$6 vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } -# If compile.h exists already and we don't own autoconf.h -# (i.e. we're not the same user who did make *config), don't -# modify compile.h -# So "sudo make install" won't change the "compiled by " -# do "compiled by root" - -if [ -r $TARGET -a ! -O include/generated/autoconf.h ]; then - vecho " SKIPPED $TARGET" - exit 0 -fi - # Do not expand names set -f From a83e4ca26af8fcf1e0d1a3fb681732e239ef5496 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 17 Feb 2020 00:19:36 +0900 Subject: [PATCH 02/34] kbuild: remove cc-option switch from -Wframe-larger-than= This CONFIG option was added by commit 35bb5b1e0e84 ("Add option to enable -Wframe-larger-than= on gcc 4.4"). At that time, the cc-option check was needed. According to Documentation/process/changes.rst, the current minimal supported version of GCC is 4.6, so you can assume GCC supports it. Clang supports it as well. Remove the cc-option switch and redundant comments. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- Makefile | 2 +- lib/Kconfig.debug | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 86035d866f2c..22bc7cc4b157 100644 --- a/Makefile +++ b/Makefile @@ -729,7 +729,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \ endif ifneq ($(CONFIG_FRAME_WARN),0) -KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) +KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN) endif stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 69def4a9df00..fb6b93ffdf77 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -266,7 +266,7 @@ config ENABLE_MUST_CHECK attribute warn_unused_result" messages. config FRAME_WARN - int "Warn for stack frames larger than (needs gcc 4.4)" + int "Warn for stack frames larger than" range 0 8192 default 2048 if GCC_PLUGIN_LATENT_ENTROPY default 1280 if (!64BIT && PARISC) @@ -276,7 +276,6 @@ config FRAME_WARN Tell gcc to warn at build time for stack frames larger than this. Setting this too low will cause a lot of warnings. Setting it to 0 disables the warning. - Requires gcc 4.4 config STRIP_ASM_SYMS bool "Strip assembler-generated symbols during link" From 87d660f08520ccde8569a2202ff346b376011663 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 18 Feb 2020 18:58:59 +0900 Subject: [PATCH 03/34] fixdep: remove unneeded code and comments about *.ver files This is probably stale code. In old days (~ Linux 2.5.59), Kbuild made genksyms generate include/linux/modules/*.ver files. The currenct Kbuild does not generate *.ver files at all. Signed-off-by: Masahiro Yamada --- scripts/basic/fixdep.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 9ba47b0a47b9..ad2041817985 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -77,11 +77,6 @@ * dependencies on include/config/my/option.h for every * CONFIG_MY_OPTION encountered in any of the prerequisites. * - * It will also filter out all the dependencies on *.ver. We need - * to make sure that the generated version checksum are globally up - * to date before even starting the recursive build, so it's too late - * at this point anyway. - * * We don't even try to really parse the header files, but * merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will * be picked up as well. It's not a problem with respect to @@ -299,8 +294,7 @@ static void *read_file(const char *filename) static int is_ignored_file(const char *s, int len) { return str_ends_with(s, len, "include/generated/autoconf.h") || - str_ends_with(s, len, "include/generated/autoksyms.h") || - str_ends_with(s, len, ".ver"); + str_ends_with(s, len, "include/generated/autoksyms.h"); } /* From 3f9070a67a94a2765e99adf0913c30b683a1b840 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 18 Feb 2020 19:00:31 +0900 Subject: [PATCH 04/34] fixdep: remove redundant null character check If *q is '\0', the condition (isalnum(*q) || *q == '_') is false anyway. It is redundant to ensure non-zero *q. Signed-off-by: Masahiro Yamada --- scripts/basic/fixdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index ad2041817985..877ca2c88246 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -246,7 +246,7 @@ static void parse_config_file(const char *p) } p += 7; q = p; - while (*q && (isalnum(*q) || *q == '_')) + while (isalnum(*q) || *q == '_') q++; if (str_ends_with(p, q - p, "_MODULE")) r = q - 7; From a1af8d71f0e4c6c23eb809de559150bbff296f4d Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 27 Feb 2020 02:53:25 +0900 Subject: [PATCH 05/34] kbuild: remove trailing slash from devicetree/binding/ for descending obj-* needs a trailing slash for a directory, but subdir-* does not because it already implies a directory. Also, change subdir-y to subdir- to ensure this is effective only for cleaning targets. This makes the cleaning log consistent. (no trailing slash) Before: $ make clean CLEAN Documentation/devicetree/bindings/ After: $ make clean CLEAN Documentation/devicetree/bindings Signed-off-by: Masahiro Yamada --- Documentation/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index d77bb607aea4..39569a2e1953 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -2,7 +2,8 @@ # Makefile for Sphinx documentation # -subdir-y := devicetree/bindings/ +# for cleaning +subdir- := devicetree/bindings # Check for broken documentation file references ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y) From fcf1b6a35c16ac500fa908a4022238e5d666eabf Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Wed, 26 Feb 2020 15:23:36 -0800 Subject: [PATCH 06/34] Documentation/llvm: add documentation on building w/ Clang/LLVM Added to kbuild documentation. Provides more official info on building kernels with Clang and LLVM than our wiki. Suggested-by: Kees Cook Reviewed-by: Kees Cook Reviewed-by: Nathan Chancellor Reviewed-by: Sedat Dilek Signed-off-by: Nick Desaulniers Signed-off-by: Masahiro Yamada --- Documentation/kbuild/index.rst | 1 + Documentation/kbuild/llvm.rst | 80 ++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + 3 files changed, 82 insertions(+) create mode 100644 Documentation/kbuild/llvm.rst diff --git a/Documentation/kbuild/index.rst b/Documentation/kbuild/index.rst index 0f144fad99a6..3882bd5f7728 100644 --- a/Documentation/kbuild/index.rst +++ b/Documentation/kbuild/index.rst @@ -19,6 +19,7 @@ Kernel Build System issues reproducible-builds + llvm .. only:: subproject and html diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst new file mode 100644 index 000000000000..d6c79eb4e23e --- /dev/null +++ b/Documentation/kbuild/llvm.rst @@ -0,0 +1,80 @@ +============================== +Building Linux with Clang/LLVM +============================== + +This document covers how to build the Linux kernel with Clang and LLVM +utilities. + +About +----- + +The Linux kernel has always traditionally been compiled with GNU toolchains +such as GCC and binutils. Ongoing work has allowed for `Clang +`_ and `LLVM `_ utilities to be +used as viable substitutes. Distributions such as `Android +`_, `ChromeOS +`_, and `OpenMandriva +`_ use Clang built kernels. `LLVM is a +collection of toolchain components implemented in terms of C++ objects +`_. Clang is a front-end to LLVM that +supports C and the GNU C extensions required by the kernel, and is pronounced +"klang," not "see-lang." + +Clang +----- + +The compiler used can be swapped out via `CC=` command line argument to `make`. +`CC=` should be set when selecting a config and during a build. + + make CC=clang defconfig + + make CC=clang + +Cross Compiling +--------------- + +A single Clang compiler binary will typically contain all supported backends, +which can help simplify cross compiling. + + ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang + +`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead +`CROSS_COMPILE` is used to set a command line flag: `--target `. For +example: + + clang --target aarch64-linux-gnu foo.c + +LLVM Utilities +-------------- + +LLVM has substitutes for GNU binutils utilities. These can be invoked as +additional parameters to `make`. + + make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\ + OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\ + READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\ + HOSTLD=ld.lld + +Getting Help +------------ + +- `Website `_ +- `Mailing List `_: +- `Issue Tracker `_ +- IRC: #clangbuiltlinux on chat.freenode.net +- `Telegram `_: @ClangBuiltLinux +- `Wiki `_ +- `Beginner Bugs `_ + +Getting LLVM +------------- + +- http://releases.llvm.org/download.html +- https://github.com/llvm/llvm-project +- https://llvm.org/docs/GettingStarted.html +- https://llvm.org/docs/CMake.html +- https://apt.llvm.org/ +- https://www.archlinux.org/packages/extra/x86_64/llvm/ +- https://github.com/ClangBuiltLinux/tc-build +- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source +- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/ diff --git a/MAINTAINERS b/MAINTAINERS index 6158a143a13e..b6c6f3eee93c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4119,6 +4119,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues C: irc://chat.freenode.net/clangbuiltlinux S: Supported K: \b(?i:clang|llvm)\b +F: Documentation/kbuild/llvm.rst CLEANCACHE API M: Konrad Rzeszutek Wilk From 2a86f6612164a10a3cdb6a499bddf329c4d69f84 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 28 Feb 2020 12:46:40 +0900 Subject: [PATCH 07/34] kbuild: use KBUILD_DEFCONFIG as the fallback for DEFCONFIG_LIST Most of the Kconfig commands (except defconfig and all*config) read the .config file as a base set of CONFIG options. When it does not exist, the files in DEFCONFIG_LIST are searched in this order and loaded if found. I do not see much sense in the last two lines in DEFCONFIG_LIST. [1] ARCH_DEFCONFIG The entry for DEFCONFIG_LIST is guarded by 'depends on !UML'. So, the ARCH_DEFCONFIG definition in arch/x86/um/Kconfig is meaningless. arch/{sh,sparc,x86}/Kconfig define ARCH_DEFCONFIG depending on 32 or 64 bit variant symbols. This is a little bit strange; ARCH_DEFCONFIG should be a fixed string because the base config file is loaded before the symbol evaluation stage. Using KBUILD_DEFCONFIG makes more sense because it is fixed before Kconfig is invoked. Fortunately, arch/{sh,sparc,x86}/Makefile define it in the same way, and it works as expected. Hence, replace ARCH_DEFCONFIG with "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". [2] arch/$(ARCH)/defconfig This file path is no longer valid. The defconfig files are always located in the arch configs/ directories. $ find arch -name defconfig | sort arch/alpha/configs/defconfig arch/arm64/configs/defconfig arch/csky/configs/defconfig arch/nds32/configs/defconfig arch/riscv/configs/defconfig arch/s390/configs/defconfig arch/unicore32/configs/defconfig The path arch/*/configs/defconfig is already covered by "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is not necessary. I moved the default KBUILD_DEFCONFIG to the top Makefile. Otherwise, the 7 architectures listed above would end up with endless loop of syncconfig. Signed-off-by: Masahiro Yamada --- Makefile | 3 +++ arch/sh/Kconfig | 5 ----- arch/sparc/Kconfig | 5 ----- arch/x86/Kconfig | 5 ----- arch/x86/um/Kconfig | 5 ----- init/Kconfig | 3 +-- scripts/kconfig/Makefile | 4 ---- 7 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 22bc7cc4b157..5435d11d8276 100644 --- a/Makefile +++ b/Makefile @@ -388,6 +388,9 @@ endif KCONFIG_CONFIG ?= .config export KCONFIG_CONFIG +# Default file for 'make defconfig'. This may be overridden by arch-Makefile. +export KBUILD_DEFCONFIG := defconfig + # SHELL used by kbuild CONFIG_SHELL := sh diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 9ece111b0254..b4f0e37b83eb 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -87,11 +87,6 @@ config SUPERH64 select HAVE_EXIT_THREAD select KALLSYMS -config ARCH_DEFCONFIG - string - default "arch/sh/configs/shx3_defconfig" if SUPERH32 - default "arch/sh/configs/cayman_defconfig" if SUPERH64 - config GENERIC_BUG def_bool y depends on BUG && SUPERH32 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index c1dd6dd642f4..0de15380d1fc 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -95,11 +95,6 @@ config SPARC64 select PCI_DOMAINS if PCI select ARCH_HAS_GIGANTIC_PAGE -config ARCH_DEFCONFIG - string - default "arch/sparc/configs/sparc32_defconfig" if SPARC32 - default "arch/sparc/configs/sparc64_defconfig" if SPARC64 - config ARCH_PROC_KCORE_TEXT def_bool y diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index beea77046f9b..98935f4387f9 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -240,11 +240,6 @@ config OUTPUT_FORMAT default "elf32-i386" if X86_32 default "elf64-x86-64" if X86_64 -config ARCH_DEFCONFIG - string - default "arch/x86/configs/i386_defconfig" if X86_32 - default "arch/x86/configs/x86_64_defconfig" if X86_64 - config LOCKDEP_SUPPORT def_bool y diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig index a8985e1f7432..95d26a69088b 100644 --- a/arch/x86/um/Kconfig +++ b/arch/x86/um/Kconfig @@ -27,11 +27,6 @@ config X86_64 def_bool 64BIT select MODULES_USE_ELF_RELA -config ARCH_DEFCONFIG - string - default "arch/um/configs/i386_defconfig" if X86_32 - default "arch/um/configs/x86_64_defconfig" if X86_64 - config 3_LEVEL_PGTABLES bool "Three-level pagetables" if !64BIT default 64BIT diff --git a/init/Kconfig b/init/Kconfig index 20a6ac33761c..240c1ed15c69 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -6,8 +6,7 @@ config DEFCONFIG_LIST default "/lib/modules/$(shell,uname -r)/.config" default "/etc/kernel-config" default "/boot/config-$(shell,uname -r)" - default ARCH_DEFCONFIG - default "arch/$(ARCH)/defconfig" + default "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)" config CC_IS_GCC def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5887ceb6229e..c9d0a4a8efb3 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -12,10 +12,6 @@ else Kconfig := Kconfig endif -ifndef KBUILD_DEFCONFIG -KBUILD_DEFCONFIG := defconfig -endif - ifeq ($(quiet),silent_) silent := -s endif From 1518c633df78185f5cbd7322b52ef06358febac3 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Fri, 28 Feb 2020 17:20:13 +0000 Subject: [PATCH 08/34] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS CONFIG_TRIM_UNUSED_KSYMS currently removes all unused exported symbols from ksymtab. This works really well when using in-tree drivers, but cannot be used in its current form if some of them are out-of-tree. Indeed, even if the list of symbols required by out-of-tree drivers is known at compile time, the only solution today to guarantee these don't get trimmed is to set CONFIG_TRIM_UNUSED_KSYMS=n. This not only wastes space, but also makes it difficult to control the ABI usable by vendor modules in distribution kernels such as Android. Being able to control the kernel ABI surface is particularly useful to ship a unique Generic Kernel Image (GKI) for all vendors, which is a first step in the direction of getting all vendors to contribute their code upstream. As such, attempt to improve the situation by enabling users to specify a symbol 'whitelist' at compile time. Any symbol specified in this whitelist will be kept exported when CONFIG_TRIM_UNUSED_KSYMS is set, even if it has no in-tree user. The whitelist is defined as a simple text file, listing symbols, one per line. Acked-by: Jessica Yu Acked-by: Nicolas Pitre Tested-by: Matthias Maennich Reviewed-by: Matthias Maennich Signed-off-by: Quentin Perret Signed-off-by: Masahiro Yamada --- init/Kconfig | 13 +++++++++++++ scripts/adjust_autoksyms.sh | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 240c1ed15c69..9f2f10cfb097 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2207,6 +2207,19 @@ config TRIM_UNUSED_KSYMS If unsure, or if you need to build out-of-tree modules, say N. +config UNUSED_KSYMS_WHITELIST + string "Whitelist of symbols to keep in ksymtab" + depends on TRIM_UNUSED_KSYMS + help + By default, all unused exported symbols will be un-exported from the + build when TRIM_UNUSED_KSYMS is selected. + + UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept + exported at all times, even in absence of in-tree users. The value to + set here is the path to a text file containing the list of symbols, + one per line. The path can be absolute, or relative to the kernel + source tree. + endif # MODULES config MODULES_TREE_LOOKUP diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index a904bf1f5e67..212ba45595d3 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -38,6 +38,17 @@ esac # We need access to CONFIG_ symbols . include/config/auto.conf +ksym_wl=/dev/null +if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then + # Use 'eval' to expand the whitelist path and check if it is relative + eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST" + [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl" + if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then + echo "ERROR: '$ksym_wl' whitelist file not found" >&2 + exit 1 + fi +fi + # Generate a new ksym list file with symbols needed by the current # set of modules. cat > "$new_ksyms_file" << EOT @@ -48,6 +59,7 @@ cat > "$new_ksyms_file" << EOT EOT sed 's/ko$/mod/' modules.order | xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | +cat - "$ksym_wl" | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" From cd195bc4775a5c07620bbb6fc19c4fa254b62b19 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Fri, 28 Feb 2020 17:20:14 +0000 Subject: [PATCH 09/34] kbuild: split adjust_autoksyms.sh in two parts In order to prepare the ground for a build-time optimization, split adjust_autoksyms.sh into two scripts: one that generates autoksyms.h based on all currently available information (whitelist, and .mod files), and the other to inspect the diff between two versions of autoksyms.h and trigger appropriate rebuilds. Acked-by: Nicolas Pitre Tested-by: Matthias Maennich Reviewed-by: Matthias Maennich Signed-off-by: Quentin Perret Signed-off-by: Masahiro Yamada --- scripts/adjust_autoksyms.sh | 36 +++----------------------- scripts/gen_autoksyms.sh | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 32 deletions(-) create mode 100755 scripts/gen_autoksyms.sh diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 212ba45595d3..2b366d945ccb 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -1,14 +1,13 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only -# Script to create/update include/generated/autoksyms.h and dependency files +# Script to update include/generated/autoksyms.h and dependency files # # Copyright: (C) 2016 Linaro Limited # Created by: Nicolas Pitre, January 2016 # -# Create/update the include/generated/autoksyms.h file from the list -# of all module's needed symbols as recorded on the second line of *.mod files. +# Update the include/generated/autoksyms.h file. # # For each symbol being added or removed, the corresponding dependency # file's timestamp is updated to force a rebuild of the affected source @@ -38,35 +37,8 @@ esac # We need access to CONFIG_ symbols . include/config/auto.conf -ksym_wl=/dev/null -if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then - # Use 'eval' to expand the whitelist path and check if it is relative - eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST" - [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl" - if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then - echo "ERROR: '$ksym_wl' whitelist file not found" >&2 - exit 1 - fi -fi - -# Generate a new ksym list file with symbols needed by the current -# set of modules. -cat > "$new_ksyms_file" << EOT -/* - * Automatically generated file; DO NOT EDIT. - */ - -EOT -sed 's/ko$/mod/' modules.order | -xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | -cat - "$ksym_wl" | -sort -u | -sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" - -# Special case for modversions (see modpost.c) -if [ -n "$CONFIG_MODVERSIONS" ]; then - echo "#define __KSYM_module_layout 1" >> "$new_ksyms_file" -fi +# Generate a new symbol list file +$CONFIG_SHELL $srctree/scripts/gen_autoksyms.sh "$new_ksyms_file" # Extract changes between old and new list and touch corresponding # dependency files. diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh new file mode 100755 index 000000000000..ef46200c366b --- /dev/null +++ b/scripts/gen_autoksyms.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only + +# Create an autoksyms.h header file from the list of all module's needed symbols +# as recorded on the second line of *.mod files and the user-provided symbol +# whitelist. + +set -e + +output_file="$1" + +# Use "make V=1" to debug this script. +case "$KBUILD_VERBOSE" in +*1*) + set -x + ;; +esac + +# We need access to CONFIG_ symbols +. include/config/auto.conf + +ksym_wl=/dev/null +if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then + # Use 'eval' to expand the whitelist path and check if it is relative + eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST" + [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl" + if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then + echo "ERROR: '$ksym_wl' whitelist file not found" >&2 + exit 1 + fi +fi + +# Generate a new ksym list file with symbols needed by the current +# set of modules. +cat > "$output_file" << EOT +/* + * Automatically generated file; DO NOT EDIT. + */ + +EOT + +sed 's/ko$/mod/' modules.order | +xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | +cat - "$ksym_wl" | +sort -u | +sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$output_file" + +# Special case for modversions (see modpost.c) +if [ -n "$CONFIG_MODVERSIONS" ]; then + echo "#define __KSYM_module_layout 1" >> "$output_file" +fi From 88694cff4952dba60227f421884ff4140d296900 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Fri, 28 Feb 2020 17:20:15 +0000 Subject: [PATCH 10/34] kbuild: generate autoksyms.h early When doing a cold build, autoksyms.h starts empty, and is updated late in the build process to have visibility over the symbols used by in-tree drivers. But since the symbol whitelist is known upfront, it can be used to pre-populate autoksyms.h and maximize the amount of code that can be compiled to its final state in a single pass, hence reducing build time. Do this by using gen_autoksyms.sh to initialize autoksyms.h instead of creating an empty file. Acked-by: Nicolas Pitre Tested-by: Matthias Maennich Reviewed-by: Matthias Maennich Signed-off-by: Quentin Perret Signed-off-by: Masahiro Yamada --- Makefile | 7 +++++-- scripts/gen_autoksyms.sh | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5435d11d8276..f8b70cf80d79 100644 --- a/Makefile +++ b/Makefile @@ -1066,9 +1066,12 @@ endif autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) +quiet_cmd_autoksyms_h = GEN $@ + cmd_autoksyms_h = mkdir -p $(dir $@); \ + $(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@ + $(autoksyms_h): - $(Q)mkdir -p $(dir $@) - $(Q)touch $@ + $(call cmd,autoksyms_h) ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh index ef46200c366b..16c0b2ddaa4c 100755 --- a/scripts/gen_autoksyms.sh +++ b/scripts/gen_autoksyms.sh @@ -39,7 +39,8 @@ cat > "$output_file" << EOT EOT -sed 's/ko$/mod/' modules.order | +[ -f modules.order ] && modlist=modules.order || modlist=/dev/null +sed 's/ko$/mod/' $modlist | xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | cat - "$ksym_wl" | sort -u | From 2ba06cd8565b5b3dee33a9ca24cf86a906d051d1 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 28 Feb 2020 18:37:30 -0600 Subject: [PATCH 11/34] kbuild: Always validate DT binding examples Most folks only run dt_binding_check on the single schema they care about by setting DT_SCHEMA_FILES. That means example is only checked against that one schema which is not always sufficient. Let's address this by splitting processed-schema.yaml into 2 files: one that's always all schemas for the examples and one that's just the schema in DT_SCHEMA_FILES for dtbs. Co-developed-by: Masahiro Yamada Signed-off-by: Rob Herring Signed-off-by: Masahiro Yamada --- Documentation/devicetree/bindings/.gitignore | 2 +- Documentation/devicetree/bindings/Makefile | 22 +++++++++++++------- scripts/Makefile.lib | 3 ++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/.gitignore b/Documentation/devicetree/bindings/.gitignore index ef82fcfcccab..57afa1533a5f 100644 --- a/Documentation/devicetree/bindings/.gitignore +++ b/Documentation/devicetree/bindings/.gitignore @@ -1,2 +1,2 @@ *.example.dts -processed-schema.yaml +processed-schema*.yaml diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index 646cb3525373..7c40d5ba1b51 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -2,7 +2,6 @@ DT_DOC_CHECKER ?= dt-doc-validate DT_EXTRACT_EX ?= dt-extract-example DT_MK_SCHEMA ?= dt-mk-schema -DT_MK_SCHEMA_FLAGS := $(if $(DT_SCHEMA_FILES), -u) quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ @@ -11,26 +10,33 @@ quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) $(obj)/%.example.dts: $(src)/%.yaml FORCE $(call if_changed,chk_binding) -DT_TMP_SCHEMA := processed-schema.yaml +# Use full schemas when checking %.example.dts +DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml quiet_cmd_mk_schema = SCHEMA $@ cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) -DT_DOCS = $(shell \ +DT_DOCS = $(addprefix $(src)/, \ + $(shell \ cd $(srctree)/$(src) && \ find * \( -name '*.yaml' ! \ - -name $(DT_TMP_SCHEMA) ! \ + -name 'processed-schema*' ! \ -name '*.example.dt.yaml' \) \ - ) + )) -DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) +DT_SCHEMA_FILES ?= $(DT_DOCS) ifeq ($(CHECK_DTBS),) extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) +extra-y += processed-schema-examples.yaml + +$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE + $(call if_changed,mk_schema) endif -$(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE +$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u +$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE $(call if_changed,mk_schema) -extra-y += $(DT_TMP_SCHEMA) +extra-y += processed-schema.yaml diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 752ff0a225a9..97547108ee7f 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -297,7 +297,8 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE DT_CHECKER ?= dt-validate DT_BINDING_DIR := Documentation/devicetree/bindings -DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml +# DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile +DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml quiet_cmd_dtb_check = CHECK $@ cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ From 65220630bb1766227c29a7774b95af3916f1564b Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 28 Feb 2020 18:37:31 -0600 Subject: [PATCH 12/34] kbuild: Build DT binding examples with dtc warnings enabled Now that we have a separate rule for DT binding examples, we can customize the dtc options. Let's adjust the dtc warnings to me more strict by default so the examples get cleaned up as they get converted to schema. Leaving 'avoid_unnecessary_addr_size' and 'graph_child_address' warnings disabled as examples tend to be incomplete and they generates a lot of warnings. Co-developed-by: Masahiro Yamada Signed-off-by: Rob Herring Signed-off-by: Masahiro Yamada --- Documentation/devicetree/bindings/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index 7c40d5ba1b51..b62c0470f122 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -31,6 +31,10 @@ extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) extra-y += processed-schema-examples.yaml +override DTC_FLAGS := \ + -Wno-avoid_unnecessary_addr_size \ + -Wno-graph_child_address + $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE $(call if_changed,mk_schema) endif From b5154bf63e5577faaaca1d942df274f7de91dd2a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 4 Mar 2020 12:20:36 +0900 Subject: [PATCH 13/34] kbuild: avoid concurrency issue in parallel building dtbs and dtbs_check 'make dtbs_check' checks the shecma in addition to building *.dtb files, in other words, 'make dtbs_check' is a super-set of 'make dtbs'. So, you do not have to do 'make dtbs dtbs_check', but I want to keep the build system as robust as possible in any use. Currently, 'dtbs' and 'dtbs_check' are independent of each other. In parallel building, two threads descend into arch/*/boot/dts/, one for dtbs and the other for dtbs_check, then end up with building the same DTB simultaneously. This commit fixes the concurrency issue. Otherwise, I see build errors like follows: $ make ARCH=arm64 defconfig $ make -j16 ARCH=arm64 DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/psci.yaml dtbs dtbs_check DTC arch/arm64/boot/dts/qcom/sdm845-cheza-r2.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-evk.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb DTC arch/arm64/boot/dts/zte/zx296718-pcbox.dtb DTC arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1254-revA.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dtb DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-inx.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb CHECK arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml fixdep: error opening file: arch/arm64/boot/dts/allwinner/.sun50i-h6-orangepi-lite2.dtb.d: No such file or directory make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb] Error 2 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb' make[2]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-kd.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p231.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1275-revA.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dtb fixdep: parse error; no targets found make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb] Error 1 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb' make[1]: *** [scripts/Makefile.build:505: arch/arm64/boot/dts/allwinner] Error 2 make[1]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb Signed-off-by: Masahiro Yamada Reviewed-by: Rob Herring --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f8b70cf80d79..da1966eacdce 100644 --- a/Makefile +++ b/Makefile @@ -1246,11 +1246,15 @@ ifneq ($(dtstree),) $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ PHONY += dtbs dtbs_install dtbs_check -dtbs dtbs_check: include/config/kernel.release scripts_dtc +dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) +ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) +dtbs: dt_binding_check +endif + dtbs_check: export CHECK_DTBS=1 -dtbs_check: dt_binding_check +dtbs_check: dtbs dtbs_install: $(Q)$(MAKE) $(dtbinst)=$(dtstree) From e10c4321dc1e017e472c3fa40bb4e93355921e67 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 4 Mar 2020 12:20:37 +0900 Subject: [PATCH 14/34] kbuild: allow to run dt_binding_check and dtbs_check in a single command Since commit 93512dad334d ("dt-bindings: Improve validation build error handling"), 'make dtbs_check' does not validate the schema fully. If you want to check everything, you need to run two commands separately. $ make ARCH=arm dt_binding_check $ make ARCH=arm dtbs_check They are exclusive each other, so you cannot do like this: $ make ARCH=arm dt_binding_check dtbs_check In this case, dt-doc-validate and dt-extract-example are skipped because CHECK_DTBS is set. Let's make it possible to run these two targets in a single command. It will be useful for schema writers. Signed-off-by: Masahiro Yamada Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/Makefile | 8 +++----- Documentation/devicetree/writing-schema.rst | 4 ++++ Makefile | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index b62c0470f122..1df680d07461 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -26,10 +26,9 @@ DT_DOCS = $(addprefix $(src)/, \ DT_SCHEMA_FILES ?= $(DT_DOCS) -ifeq ($(CHECK_DTBS),) -extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) -extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) -extra-y += processed-schema-examples.yaml +extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) +extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) +extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml override DTC_FLAGS := \ -Wno-avoid_unnecessary_addr_size \ @@ -37,7 +36,6 @@ override DTC_FLAGS := \ $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE $(call if_changed,mk_schema) -endif $(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE diff --git a/Documentation/devicetree/writing-schema.rst b/Documentation/devicetree/writing-schema.rst index 7635ab230456..220cf464ed77 100644 --- a/Documentation/devicetree/writing-schema.rst +++ b/Documentation/devicetree/writing-schema.rst @@ -147,6 +147,10 @@ Note that ``dtbs_check`` will skip any binding schema files with errors. It is necessary to use ``dt_binding_check`` to get all the validation errors in the binding schema files. +It is possible to run both in a single command:: + + make dt_binding_check dtbs_check + It is also possible to run checks with a single schema file by setting the ``DT_SCHEMA_FILES`` variable to a specific schema file. diff --git a/Makefile b/Makefile index da1966eacdce..9387c96ec874 100644 --- a/Makefile +++ b/Makefile @@ -1250,10 +1250,10 @@ dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) +export CHECK_DTBS=y dtbs: dt_binding_check endif -dtbs_check: export CHECK_DTBS=1 dtbs_check: dtbs dtbs_install: @@ -1269,6 +1269,10 @@ PHONY += scripts_dtc scripts_dtc: scripts_basic $(Q)$(MAKE) $(build)=scripts/dtc +ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),) +export CHECK_DT_BINDING=y +endif + PHONY += dt_binding_check dt_binding_check: scripts_dtc $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings From 9dffecc1339b1f446213a9ba2f19579d9db4d7c7 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 4 Mar 2020 12:20:38 +0900 Subject: [PATCH 15/34] kbuild: allow to run dt_binding_check without kernel configuration The dt_binding_check target is located outside of the 'ifneq ($(dtstree),) ... endif' block. So, you can run 'make dt_binding_check' on any architecture. This makes a perfect sense because the dt-schema is arch-agnostic. The only one problem I see is that scripts/dtc/dtc is not always built. For example, ARCH=x86 defconfig does not define CONFIG_DTC. Kbuild descends into scripts/dtc/ with doing nothing. Then, it fails to build *.example.dt.yaml files. Let's build scripts/dtc/dtc forcibly when running dt_binding_check. The dt-schema does not depend on any CONFIG option either, so you should be able to run dt_binding_check without the .config file. Going forward, you can directly run 'make dt_binding_check' in a pristine source tree. Signed-off-by: Masahiro Yamada Reviewed-by: Rob Herring --- Makefile | 2 +- scripts/dtc/Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9387c96ec874..96f6ca3004cf 100644 --- a/Makefile +++ b/Makefile @@ -255,7 +255,7 @@ clean-targets := %clean mrproper cleandocs 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 + %asm-generic kernelversion %src-pkg dt_binding_check no-sync-config-targets := $(no-dot-config-targets) install %install \ kernelrelease single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/ diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 3acbb410904c..2f3c3a7e1620 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -1,8 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # scripts/dtc makefile -hostprogs := dtc -always-$(CONFIG_DTC) := $(hostprogs) +hostprogs := dtc +always-$(CONFIG_DTC) += $(hostprogs) +always-$(CHECK_DT_BINDING) += $(hostprogs) dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ srcpos.o checks.o util.o From 93c95e526a4ef00eb3d5a1e0920ba5a22f32e40d Mon Sep 17 00:00:00 2001 From: Jessica Yu Date: Fri, 6 Mar 2020 17:02:05 +0100 Subject: [PATCH 16/34] modpost: rework and consolidate logging interface Rework modpost's logging interface by consolidating merror(), warn(), and fatal() to use a single function, modpost_log(). Introduce different logging levels (WARN, ERROR, FATAL) as well. The purpose of this cleanup is to reduce code duplication when deciding whether or not to warn or error out based on a condition. Signed-off-by: Jessica Yu Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 71 ++++++++++++++++++------------------------- scripts/mod/modpost.h | 14 +++++++-- 2 files changed, 41 insertions(+), 44 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 7edfdb2f4497..a6f7b309ac45 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -51,41 +51,33 @@ enum export { #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr)) -#define PRINTF __attribute__ ((format (printf, 1, 2))) - -PRINTF void fatal(const char *fmt, ...) +void __attribute__((format(printf, 2, 3))) +modpost_log(enum loglevel loglevel, const char *fmt, ...) { va_list arglist; - fprintf(stderr, "FATAL: "); + switch (loglevel) { + case LOG_WARN: + fprintf(stderr, "WARNING: "); + break; + case LOG_ERROR: + fprintf(stderr, "ERROR: "); + break; + case LOG_FATAL: + fprintf(stderr, "FATAL: "); + break; + default: /* invalid loglevel, ignore */ + break; + } + + fprintf(stderr, "modpost: "); va_start(arglist, fmt); vfprintf(stderr, fmt, arglist); va_end(arglist); - exit(1); -} - -PRINTF void warn(const char *fmt, ...) -{ - va_list arglist; - - fprintf(stderr, "WARNING: "); - - va_start(arglist, fmt); - vfprintf(stderr, fmt, arglist); - va_end(arglist); -} - -PRINTF void merror(const char *fmt, ...) -{ - va_list arglist; - - fprintf(stderr, "ERROR: "); - - va_start(arglist, fmt); - vfprintf(stderr, fmt, arglist); - va_end(arglist); + if (loglevel == LOG_FATAL) + exit(1); } static inline bool strends(const char *str, const char *postfix) @@ -113,7 +105,7 @@ static int is_vmlinux(const char *modname) void *do_nofail(void *ptr, const char *expr) { if (!ptr) - fatal("modpost: Memory allocation failure: %s.\n", expr); + fatal("Memory allocation failure: %s.\n", expr); return ptr; } @@ -2021,7 +2013,7 @@ static void read_symbols(const char *modname) license = get_modinfo(&info, "license"); if (!license && !is_vmlinux(modname)) - warn("modpost: missing MODULE_LICENSE() in %s\n" + warn("missing MODULE_LICENSE() in %s\n" "see include/linux/module.h for " "more information\n", modname); while (license) { @@ -2152,15 +2144,15 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s) switch (exp) { case export_gpl: - fatal("modpost: GPL-incompatible module %s%s " + fatal("GPL-incompatible module %s%s " "uses GPL-only symbol '%s'\n", m, e, s); break; case export_unused_gpl: - fatal("modpost: GPL-incompatible module %s%s " + fatal("GPL-incompatible module %s%s " "uses GPL-only symbol marked UNUSED '%s'\n", m, e, s); break; case export_gpl_future: - warn("modpost: GPL-incompatible module %s%s " + warn("GPL-incompatible module %s%s " "uses future GPL-only symbol '%s'\n", m, e, s); break; case export_plain: @@ -2178,7 +2170,7 @@ static void check_for_unused(enum export exp, const char *m, const char *s) switch (exp) { case export_unused: case export_unused_gpl: - warn("modpost: module %s%s " + warn("module %s%s " "uses symbol '%s' marked UNUSED\n", m, e, s); break; default: @@ -2197,14 +2189,11 @@ static int check_exports(struct module *mod) exp = find_symbol(s->name); if (!exp || exp->module == mod) { if (have_vmlinux && !s->weak) { - if (warn_unresolved) { - warn("\"%s\" [%s.ko] undefined!\n", - s->name, mod->name); - } else { - merror("\"%s\" [%s.ko] undefined!\n", - s->name, mod->name); + modpost_log(warn_unresolved ? LOG_WARN : LOG_ERROR, + "\"%s\" [%s.ko] undefined!\n", + s->name, mod->name); + if (!warn_unresolved) err = 1; - } } continue; } @@ -2653,7 +2642,7 @@ int main(int argc, char **argv) if (dump_write) write_dump(dump_write); if (sec_mismatch_count && sec_mismatch_fatal) - fatal("modpost: Section mismatches detected.\n" + fatal("Section mismatches detected.\n" "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); for (n = 0; n < SYMBOL_HASH_SIZE; n++) { struct symbol *s; diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 64a82d2d85f6..60dca9b7106b 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -198,6 +198,14 @@ void *grab_file(const char *filename, unsigned long *size); char* get_next_line(unsigned long *pos, void *file, unsigned long size); void release_file(void *file, unsigned long size); -void fatal(const char *fmt, ...); -void warn(const char *fmt, ...); -void merror(const char *fmt, ...); +enum loglevel { + LOG_WARN, + LOG_ERROR, + LOG_FATAL +}; + +void modpost_log(enum loglevel loglevel, const char *fmt, ...); + +#define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args) +#define merror(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args) +#define fatal(fmt, args...) modpost_log(LOG_FATAL, fmt, ##args) From 54b778476941c768ef749803167dd21385c01038 Mon Sep 17 00:00:00 2001 From: Jessica Yu Date: Fri, 6 Mar 2020 17:02:06 +0100 Subject: [PATCH 17/34] modpost: return error if module is missing ns imports and MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n Currently when CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n, modpost only warns when a module is missing namespace imports. Under this configuration, such a module cannot be loaded into the kernel anyway, as the module loader would reject it. We might as well return a build error when a module is missing namespace imports under CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n, so that the build warning does not go ignored/unnoticed. Signed-off-by: Jessica Yu Signed-off-by: Masahiro Yamada --- scripts/Makefile.modpost | 15 ++++++++------- scripts/mod/modpost.c | 14 +++++++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index b4d3f2d122ac..957eed6a17a5 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -46,13 +46,14 @@ include scripts/Kbuild.include kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers -MODPOST = scripts/mod/modpost \ - $(if $(CONFIG_MODVERSIONS),-m) \ - $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \ - $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ - $(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \ - $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ - $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ +MODPOST = scripts/mod/modpost \ + $(if $(CONFIG_MODVERSIONS),-m) \ + $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \ + $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ + $(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \ + $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ + $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ + $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \ $(if $(KBUILD_MODPOST_WARN),-w) ifdef MODPOST_VMLINUX diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a6f7b309ac45..a3d8370f9544 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -39,6 +39,8 @@ static int sec_mismatch_count = 0; static int sec_mismatch_fatal = 0; /* ignore missing files */ static int ignore_missing_files; +/* If set to 1, only warn (instead of error) about missing ns imports */ +static int allow_missing_ns_imports; enum export { export_plain, export_unused, export_gpl, @@ -2205,8 +2207,11 @@ static int check_exports(struct module *mod) if (exp->namespace && !module_imports_namespace(mod, exp->namespace)) { - warn("module %s uses symbol %s from namespace %s, but does not import it.\n", - basename, exp->name, exp->namespace); + modpost_log(allow_missing_ns_imports ? LOG_WARN : LOG_ERROR, + "module %s uses symbol %s from namespace %s, but does not import it.\n", + basename, exp->name, exp->namespace); + if (!allow_missing_ns_imports) + err = 1; add_namespace(&mod->missing_namespaces, exp->namespace); } @@ -2549,7 +2554,7 @@ int main(int argc, char **argv) struct ext_sym_list *extsym_iter; struct ext_sym_list *extsym_start = NULL; - while ((opt = getopt(argc, argv, "i:e:mnsT:o:awEd:")) != -1) { + while ((opt = getopt(argc, argv, "i:e:mnsT:o:awENd:")) != -1) { switch (opt) { case 'i': kernel_read = optarg; @@ -2587,6 +2592,9 @@ int main(int argc, char **argv) case 'E': sec_mismatch_fatal = 1; break; + case 'N': + allow_missing_ns_imports = 1; + break; case 'd': missing_namespace_deps = optarg; break; From 1cd9b3abf5332102d4d967555e7ed861a75094bf Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 11 Mar 2020 15:29:25 +0900 Subject: [PATCH 18/34] net: drop_monitor: use IS_REACHABLE() to guard net_dm_hw_report() In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR. The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR from being 'm' when NET_DEVLINK=y. With the planned Kconfig change that relaxes the 'imply', the combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed. Use IS_REACHABLE() to avoid the vmlinux link error for this case. Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada Acked-by: Neil Horman --- include/net/drop_monitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/drop_monitor.h b/include/net/drop_monitor.h index 2ab668461463..f68bc373544a 100644 --- a/include/net/drop_monitor.h +++ b/include/net/drop_monitor.h @@ -19,7 +19,7 @@ struct net_dm_hw_metadata { struct net_device *input_dev; }; -#if IS_ENABLED(CONFIG_NET_DROP_MONITOR) +#if IS_REACHABLE(CONFIG_NET_DROP_MONITOR) void net_dm_hw_report(struct sk_buff *skb, const struct net_dm_hw_metadata *hw_metadata); #else From def2fbffe62c00c330c7f41584a356001179c59c Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 2 Mar 2020 15:23:39 +0900 Subject: [PATCH 19/34] kconfig: allow symbols implied by y to become m The 'imply' keyword restricts a symbol to y or n, excluding m when it is implied by y. This is the original behavior since commit 237e3ad0f195 ("Kconfig: Introduce the "imply" keyword"). However, the author of this feature, Nicolas Pitre, stated that the 'imply' keyword should not impose any restrictions. (https://lkml.org/lkml/2020/2/19/714) I agree, and want to get rid of this tricky behavior. Suggested-by: Nicolas Pitre Signed-off-by: Masahiro Yamada Acked-by: Nicolas Pitre --- Documentation/kbuild/kconfig-language.rst | 12 +++++++++++- scripts/kconfig/symbol.c | 5 +---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst index d0111dd26410..d4d988aea679 100644 --- a/Documentation/kbuild/kconfig-language.rst +++ b/Documentation/kbuild/kconfig-language.rst @@ -173,7 +173,7 @@ applicable everywhere (see syntax). === === ============= ============== n y n N/m/y m y m M/y/n - y y y Y/n + y y y Y/m/n y n * N === === ============= ============== @@ -181,6 +181,16 @@ applicable everywhere (see syntax). ability to hook into a secondary subsystem while allowing the user to configure that subsystem out without also having to unset these drivers. + Note: If the combination of FOO=y and BAR=m causes a link error, + you can guard the function call with IS_REACHABLE():: + + foo_init() + { + if (IS_REACHABLE(CONFIG_BAZ)) + baz_register(&foo); + ... + } + - limiting menu display: "visible if" This attribute is only applicable to menu blocks, if the condition is diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 8d38b700b314..b101ef3c377a 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -401,8 +401,7 @@ void sym_calc_value(struct symbol *sym) sym_warn_unmet_dep(sym); newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); } - if (newval.tri == mod && - (sym_get_type(sym) == S_BOOLEAN || sym->implied.tri == yes)) + if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) newval.tri = yes; break; case S_STRING: @@ -484,8 +483,6 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val) return false; if (sym->visible <= sym->rev_dep.tri) return false; - if (sym->implied.tri == yes && val == mod) - return false; if (sym_is_choice_value(sym) && sym->visible == yes) return val == yes; return val >= sym->rev_dep.tri && val <= sym->visible; From 3a9dd3ecb207b2cb8a4aabd12d20e43fa360b66d Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 2 Mar 2020 15:23:40 +0900 Subject: [PATCH 20/34] kconfig: make 'imply' obey the direct dependency The 'imply' statement may create unmet direct dependency when the implied symbol depends on m. [Test Code] config FOO tristate "foo" imply BAZ config BAZ tristate "baz" depends on BAR config BAR def_tristate m config MODULES def_bool y option modules If you set FOO=y, BAZ is also promoted to y, which results in the following .config file: CONFIG_FOO=y CONFIG_BAZ=y CONFIG_BAR=m CONFIG_MODULES=y This does not meet the dependency 'BAZ depends on BAR'. Unlike 'select', what is worse, Kconfig never shows the 'WARNING: unmet direct dependencies detected for ...' for this case. Because 'imply' is considered to be weaker than 'depends on', Kconfig should take the direct dependency into account. For clarification, describe this case in kconfig-language.rst too. Signed-off-by: Masahiro Yamada Acked-by: Nicolas Pitre Tested-by: Geert Uytterhoeven --- Documentation/kbuild/kconfig-language.rst | 15 +++++++++++++-- scripts/kconfig/symbol.c | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst index d4d988aea679..a1601ec3317b 100644 --- a/Documentation/kbuild/kconfig-language.rst +++ b/Documentation/kbuild/kconfig-language.rst @@ -159,11 +159,11 @@ applicable everywhere (see syntax). Given the following example:: config FOO - tristate + tristate "foo" imply BAZ config BAZ - tristate + tristate "baz" depends on BAR The following values are possible: @@ -174,6 +174,9 @@ applicable everywhere (see syntax). n y n N/m/y m y m M/y/n y y y Y/m/n + n m n N/m + m m m M/n + y m n M/n y n * N === === ============= ============== @@ -191,6 +194,14 @@ applicable everywhere (see syntax). ... } + Note: If the feature provided by BAZ is highly desirable for FOO, + FOO should imply not only BAZ, but also its dependency BAR:: + + config FOO + tristate "foo" + imply BAR + imply BAZ + - limiting menu display: "visible if" This attribute is only applicable to menu blocks, if the condition is diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index b101ef3c377a..3dc81397d003 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -221,7 +221,7 @@ static void sym_calc_visibility(struct symbol *sym) sym_set_changed(sym); } tri = no; - if (sym->implied.expr && sym->dir_dep.tri != no) + if (sym->implied.expr) tri = expr_calc_value(sym->implied.expr); if (tri == mod && sym_get_type(sym) == S_BOOLEAN) tri = yes; @@ -394,6 +394,8 @@ void sym_calc_value(struct symbol *sym) if (sym->implied.tri != no) { sym->flags |= SYMBOL_WRITE; newval.tri = EXPR_OR(newval.tri, sym->implied.tri); + newval.tri = EXPR_AND(newval.tri, + sym->dir_dep.tri); } } calc_newval: From b1112139a103b4b1101d0d2d72931f2d33d8c978 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Tue, 17 Mar 2020 00:07:18 +0000 Subject: [PATCH 21/34] Makefile: disallow data races on gcc-10 as well gcc-10 will rename --param=allow-store-data-races=0 to -fno-allow-store-data-races. The flag change happened at https://gcc.gnu.org/PR92046. Signed-off-by: Sergei Trofimovich Acked-by: Jiri Kosina Signed-off-by: Masahiro Yamada --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 96f6ca3004cf..8533bb68d69b 100644 --- a/Makefile +++ b/Makefile @@ -717,6 +717,7 @@ endif # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) include scripts/Makefile.kcov include scripts/Makefile.gcc-plugins From 2431f22a911a6130a10b4a0c6f13d10ede007d39 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 7 Mar 2020 02:08:51 +0900 Subject: [PATCH 22/34] kbuild: compute the dtbs_install destination more simply The 'dtbinst_root' is used to remember the root of the in-kernel dts directory (i.e. arch/*/boot/dts), but it looks clumsy. I prefer using two variables 'obj' and 'dst' to track the in-kernel directory and the install destination, respectively. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- scripts/Makefile.dtbinst | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8533bb68d69b..d32e8c86f09c 100644 --- a/Makefile +++ b/Makefile @@ -1258,7 +1258,7 @@ endif dtbs_check: dtbs dtbs_install: - $(Q)$(MAKE) $(dtbinst)=$(dtstree) + $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH) ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 7301ab5e2e06..fcd5f2eaaad1 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -13,8 +13,6 @@ src := $(obj) PHONY := __dtbs_install __dtbs_install: -export dtbinst_root ?= $(obj) - include include/config/auto.conf include scripts/Kbuild.include include $(src)/Makefile @@ -26,13 +24,11 @@ dtbinst-dirs := $(subdir-y) $(subdir-m) quiet_cmd_dtb_install = INSTALL $< cmd_dtb_install = mkdir -p $(2); cp $< $(2) -install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj)) - $(dtbinst-files): %.dtb: $(obj)/%.dtb - $(call cmd,dtb_install,$(install-dir)) + $(call cmd,dtb_install,$(dst)) $(dtbinst-dirs): - $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ + $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ dst=$(dst)/$@ PHONY += $(dtbinst-files) $(dtbinst-dirs) __dtbs_install: $(dtbinst-files) $(dtbinst-dirs) From aefd80307a05e529b3bcd28f96a7b49528697f60 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 7 Mar 2020 02:08:52 +0900 Subject: [PATCH 23/34] kbuild: refactor Makefile.dtbinst more Refactor Makefile.dtbinst so it looks similar to other Makefiles. *.dtb should not be a phony target. Copy files based on the timestamps. Print installed dtb paths instead of in-kernel dtb paths. Signed-off-by: Masahiro Yamada --- scripts/Makefile.dtbinst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index fcd5f2eaaad1..50d580d77ae9 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -17,20 +17,20 @@ include include/config/auto.conf include scripts/Kbuild.include include $(src)/Makefile -dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-))) -dtbinst-dirs := $(subdir-y) $(subdir-m) +dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) +subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m)) -# Helper targets for Installing DTBs into the boot directory -quiet_cmd_dtb_install = INSTALL $< - cmd_dtb_install = mkdir -p $(2); cp $< $(2) +__dtbs_install: $(dtbs) $(subdirs) + @: -$(dtbinst-files): %.dtb: $(obj)/%.dtb - $(call cmd,dtb_install,$(dst)) +quiet_cmd_dtb_install = INSTALL $@ + cmd_dtb_install = install -D $< $@ -$(dtbinst-dirs): - $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ dst=$(dst)/$@ +$(dst)/%.dtb: $(obj)/%.dtb + $(call cmd,dtb_install) -PHONY += $(dtbinst-files) $(dtbinst-dirs) -__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) +PHONY += $(subdirs) +$(subdirs): + $(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@) .PHONY: $(PHONY) From 51e406417950d9a614ddbb1d7769ea210b8717b0 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Mar 2020 07:37:24 +0900 Subject: [PATCH 24/34] sparc: revive __HAVE_ARCH_STRLEN for 32bit sparc Prior to commit 70a6fcf3283a ("[sparc] unify 32bit and 64bit string.h"), __HAVE_ARCH_STRLEN was defined in both of string_32.h and string_64.h It did not unify __HAVE_ARCH_STRLEN, but deleted it from string_32.h This issue was reported by the kbuild test robot in the trial of forcible linking of $(lib-y) to vmlinux. Fixes: 70a6fcf3283a ("[sparc] unify 32bit and 64bit string.h") Reported-by: kbuild test robot Suggested-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers Acked-by: David S. Miller --- arch/sparc/include/asm/string.h | 4 ++++ arch/sparc/include/asm/string_64.h | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc/include/asm/string.h b/arch/sparc/include/asm/string.h index 3d9cd082716b..001a17baf2d5 100644 --- a/arch/sparc/include/asm/string.h +++ b/arch/sparc/include/asm/string.h @@ -37,6 +37,10 @@ void *memmove(void *, const void *, __kernel_size_t); #define __HAVE_ARCH_MEMCMP int memcmp(const void *,const void *,__kernel_size_t); +/* Now the str*() stuff... */ +#define __HAVE_ARCH_STRLEN +__kernel_size_t strlen(const char *); + #define __HAVE_ARCH_STRNCMP int strncmp(const char *, const char *, __kernel_size_t); diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h index ee9ba67321bd..d5c563058a5b 100644 --- a/arch/sparc/include/asm/string_64.h +++ b/arch/sparc/include/asm/string_64.h @@ -12,8 +12,4 @@ #include -/* Now the str*() stuff... */ -#define __HAVE_ARCH_STRLEN -__kernel_size_t strlen(const char *); - #endif /* !(__SPARC64_STRING_H__) */ From dbd35860122b91a34b79162d1d1bed98b15c7e91 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 25 Mar 2020 12:14:31 +0900 Subject: [PATCH 25/34] kconfig: remove unused variable in qconf.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If this file were compiled with -Wall, the following warning would be reported: scripts/kconfig/qconf.cc:312:6: warning: unused variable ā€˜iā€™ [-Wunused-variable] int i; ^ The commit prepares to turn on -Wall for C++ host programs. Signed-off-by: Masahiro Yamada Reviewed-by: Kees Cook --- scripts/kconfig/qconf.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 82773cc35d35..50a5245d87bb 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -309,8 +309,6 @@ ConfigList::ConfigList(ConfigView* p, const char *name) showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), rootEntry(0), headerPopup(0) { - int i; - setObjectName(name); setSortingEnabled(false); setRootIsDecorated(true); From 735aab1e008b6d9ba8057caa647b6619bf73460f Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 25 Mar 2020 12:14:32 +0900 Subject: [PATCH 26/34] kbuild: add -Wall to KBUILD_HOSTCXXFLAGS Add -Wall to catch more warnings for C++ host programs. When I submitted the previous version, the 0-day bot reported -Wc++11-compat warnings for old GCC: HOSTCXX -fPIC scripts/gcc-plugins/latent_entropy_plugin.o In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/tm.h:28:0, from scripts/gcc-plugins/gcc-common.h:15, from scripts/gcc-plugins/latent_entropy_plugin.c:78: /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/config/elfos.h:102:21: warning: C++11 requires a space between string literal and macro [-Wc++11-compat] fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\ ^ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/config/elfos.h:170:24: warning: C++11 requires a space between string literal and macro [-Wc++11-compat] fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/tm.h:42:0, from scripts/gcc-plugins/gcc-common.h:15, from scripts/gcc-plugins/latent_entropy_plugin.c:78: /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/defaults.h:126:24: warning: C++11 requires a space between string literal and macro [-Wc++11-compat] fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ ^ The source of the warnings is in the plugin headers, so we have no control of it. I just suppressed them by adding -Wno-c++11-compat to scripts/gcc-plugins/Makefile. Signed-off-by: Masahiro Yamada Acked-by: Kees Cook --- Makefile | 2 +- scripts/gcc-plugins/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d32e8c86f09c..4697d7ce15f2 100644 --- a/Makefile +++ b/Makefile @@ -403,7 +403,7 @@ HOSTCXX = g++ KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \ $(HOSTCFLAGS) -KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) +KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile index f2ee8bd7abc6..efff00959a9c 100644 --- a/scripts/gcc-plugins/Makefile +++ b/scripts/gcc-plugins/Makefile @@ -10,7 +10,7 @@ else HOSTLIBS := hostcxxlibs HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb - HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable + HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable -Wno-c++11-compat export HOST_EXTRACXXFLAGS endif From f463c3510d44ab11da607d7c3b289f90ea467d1b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 25 Mar 2020 12:16:30 +0900 Subject: [PATCH 27/34] kbuild: add comment about grouped target GNU Make commit 8c888d95f618 ("[SV 8297] Implement "grouped targets" for explicit rules.") added the '&:' syntax. I think '&:' is a perfect fit here, but we cannot use it any time soon. Just add a TODO comment. Signed-off-by: Masahiro Yamada --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4697d7ce15f2..7863d2a8de6c 100644 --- a/Makefile +++ b/Makefile @@ -677,6 +677,7 @@ $(KCONFIG_CONFIG): # # This exploits the 'multi-target pattern rule' trick. # The syncconfig should be executed only once to make all the targets. +# (Note: use the grouped target '&:' when we bump to GNU Make 4.3) %/auto.conf %/auto.conf.cmd: $(KCONFIG_CONFIG) $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else # !may-sync-config From 63b903dfebdea92aa92ad337d8451a6fbfeabf9d Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Mar 2020 14:57:15 +0900 Subject: [PATCH 28/34] net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware As far as I understood from the Kconfig help text, this build rule is used to rebuild the driver firmware, which runs on an old m68k-based chip. So, you need m68k tools for the firmware rebuild. wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI. So, you cannot enable CONFIG_WANXL_BUILD_FIRMWARE for ARCH=m68k. In other words, ifeq ($(ARCH),m68k) is false here. I am keeping the dead code for now, but rebuilding the firmware requires 'as68k' and 'ld68k', which I do not have in hand. Instead, the kernel.org m68k GCC [1] successfully built it. Allowing a user to pass in CROSS_COMPILE_M68K= is handier. [1] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/9.2.0/x86_64-gcc-9.2.0-nolibc-m68k-linux.tar.xz Suggested-by: Geert Uytterhoeven Signed-off-by: Masahiro Yamada --- drivers/net/wan/Kconfig | 2 +- drivers/net/wan/Makefile | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig index 4530840e15ef..dbc0e3f7a3e2 100644 --- a/drivers/net/wan/Kconfig +++ b/drivers/net/wan/Kconfig @@ -200,7 +200,7 @@ config WANXL_BUILD_FIRMWARE depends on WANXL && !PREVENT_FIRMWARE_BUILD help Allows you to rebuild firmware run by the QUICC processor. - It requires as68k, ld68k and hexdump programs. + It requires m68k toolchains and hexdump programs. You should never need this option, say N. diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile index 701f5d2fe3b6..995277c657a1 100644 --- a/drivers/net/wan/Makefile +++ b/drivers/net/wan/Makefile @@ -40,17 +40,17 @@ $(obj)/wanxl.o: $(obj)/wanxlfw.inc ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y) ifeq ($(ARCH),m68k) - AS68K = $(AS) - LD68K = $(LD) + M68KAS = $(AS) + M68KLD = $(LD) else - AS68K = as68k - LD68K = ld68k + M68KAS = $(CROSS_COMPILE_M68K)as + M68KLD = $(CROSS_COMPILE_M68K)ld endif quiet_cmd_build_wanxlfw = BLD FW $@ cmd_build_wanxlfw = \ - $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \ - $(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \ + $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(M68KAS) -m68360 -o $(obj)/wanxlfw.o; \ + $(M68KLD) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \ hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \ rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o From 734f3719d3438f9cc181d674c33ca9762e9148a1 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Mar 2020 14:57:16 +0900 Subject: [PATCH 29/34] net: wan: wanxl: use $(M68KCC) instead of $(M68KAS) for rebuilding firmware The firmware source, wanxlfw.S, is currently compiled by the combo of $(CPP) and $(M68KAS). This is not what we usually do for compiling *.S files. In fact, this Makefile is the only user of $(AS) in the kernel build. Instead of combining $(CPP) and (AS) from different tool sets, using $(M68KCC) as an assembler driver is simpler, and saner. Signed-off-by: Masahiro Yamada --- drivers/net/wan/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile index 995277c657a1..cf7a0a65aae8 100644 --- a/drivers/net/wan/Makefile +++ b/drivers/net/wan/Makefile @@ -40,16 +40,16 @@ $(obj)/wanxl.o: $(obj)/wanxlfw.inc ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y) ifeq ($(ARCH),m68k) - M68KAS = $(AS) + M68KCC = $(CC) M68KLD = $(LD) else - M68KAS = $(CROSS_COMPILE_M68K)as + M68KCC = $(CROSS_COMPILE_M68K)gcc M68KLD = $(CROSS_COMPILE_M68K)ld endif quiet_cmd_build_wanxlfw = BLD FW $@ cmd_build_wanxlfw = \ - $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(M68KAS) -m68360 -o $(obj)/wanxlfw.o; \ + $(M68KCC) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \ $(M68KLD) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \ hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \ rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o From 7d7df745b0a63af33415ec234b29b9d6ed59ad8c Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Mar 2020 14:57:17 +0900 Subject: [PATCH 30/34] net: wan: wanxl: refactor the firmware rebuild rule Split the big recipe into 3 stages: compile, link, and hexdump. After this commit, the build log with CONFIG_WANXL_BUILD_FIRMWARE will look like this: M68KAS drivers/net/wan/wanxlfw.o M68KLD drivers/net/wan/wanxlfw.bin BLDFW drivers/net/wan/wanxlfw.inc CC [M] drivers/net/wan/wanxl.o Signed-off-by: Masahiro Yamada --- drivers/net/wan/Makefile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile index cf7a0a65aae8..380271a011e4 100644 --- a/drivers/net/wan/Makefile +++ b/drivers/net/wan/Makefile @@ -47,14 +47,23 @@ else M68KLD = $(CROSS_COMPILE_M68K)ld endif -quiet_cmd_build_wanxlfw = BLD FW $@ - cmd_build_wanxlfw = \ - $(M68KCC) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \ - $(M68KLD) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \ - hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \ - rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o +quiet_cmd_build_wanxlfw = BLDFW $@ + cmd_build_wanxlfw = hexdump -ve '"\n" 16/1 "0x%02X,"' $< | \ + sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' > $@ -$(obj)/wanxlfw.inc: $(src)/wanxlfw.S - $(call if_changed_dep,build_wanxlfw) -targets += wanxlfw.inc +$(obj)/wanxlfw.inc: $(obj)/wanxlfw.bin FORCE + $(call if_changed,build_wanxlfw) + +quiet_cmd_m68kld_bin_o = M68KLD $@ + cmd_m68kld_bin_o = $(M68KLD) --oformat binary -Ttext 0x1000 $< -o $@ + +$(obj)/wanxlfw.bin: $(obj)/wanxlfw.o FORCE + $(call if_changed,m68kld_bin_o) + +quiet_cmd_m68kas_o_S = M68KAS $@ + cmd_m68kas_o_S = $(M68KCC) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $@ $< + +$(obj)/wanxlfw.o: $(src)/wanxlfw.S FORCE + $(call if_changed_dep,m68kas_o_S) endif +targets += wanxlfw.inc wanxlfw.bin wanxlfw.o From aa824e0c962b532d5073cbb41b2efcd6f5e72bae Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Mar 2020 14:57:18 +0900 Subject: [PATCH 31/34] kbuild: remove AS variable As commit 5ef872636ca7 ("kbuild: get rid of misleading $(AS) from documents") noted, we rarely use $(AS) directly in the kernel build. Now that the only/last user of $(AS) in drivers/net/wan/Makefile was converted to $(CC), $(AS) is no longer used in the build process. You can still pass in AS=clang, which is just a switch to turn on the LLVM integrated assembler. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Reviewed-by: Nathan Chancellor --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7863d2a8de6c..89e1eb75c819 100644 --- a/Makefile +++ b/Makefile @@ -408,7 +408,6 @@ KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) # Make variables (CC, etc...) -AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld CC = $(CROSS_COMPILE)gcc CPP = $(CC) -E @@ -475,7 +474,7 @@ KBUILD_LDFLAGS := GCC_PLUGINS_CFLAGS := 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 LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE @@ -538,7 +537,7 @@ endif ifneq ($(GCC_TOOLCHAIN),) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif -ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),) +ifeq ($(if $(AS),$(shell $(AS) --version 2>&1 | head -n 1 | grep clang)),) CLANG_FLAGS += -no-integrated-as endif CLANG_FLAGS += -Werror=unknown-warning-option From 4623980dea7c688bd5fdce406e01726654b04104 Mon Sep 17 00:00:00 2001 From: David Engraf Date: Thu, 26 Mar 2020 20:29:33 +0100 Subject: [PATCH 32/34] kbuild: add outputmakefile to no-dot-config-targets The target outputmakefile is used to generate a Makefile for out-of-tree builds and does not depend on the kernel configuration. Signed-off-by: David Engraf Signed-off-by: Masahiro Yamada --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 89e1eb75c819..a74ba6f305b0 100644 --- a/Makefile +++ b/Makefile @@ -255,7 +255,8 @@ clean-targets := %clean mrproper cleandocs 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 + %asm-generic kernelversion %src-pkg dt_binding_check \ + outputmakefile no-sync-config-targets := $(no-dot-config-targets) install %install \ kernelrelease single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/ From d9dac147a2c370c188ef6251c7c6f42759f65eb0 Mon Sep 17 00:00:00 2001 From: Reinhard Karcher Date: Tue, 24 Mar 2020 11:24:47 +0100 Subject: [PATCH 33/34] kbuild: deb-pkg: fix warning when CONFIG_DEBUG_INFO is unset Creating a Debian package without CONFIG_DEBUG_INFO produces a warning that no debug package was created. This patch excludes the debug package from the control file, if no debug package is created by this configuration. Signed-off-by: Reinhard Karcher Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 357dc56bcf30..df1adbfb8ead 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -198,6 +198,10 @@ Description: Linux support headers for userspace development This package provides userspaces headers from the Linux kernel. These headers are used by the installed headers for GNU glibc and other system libraries. Multi-Arch: same +EOF + +if is_enabled CONFIG_DEBUG_INFO; then +cat <> debian/control Package: $dbg_packagename Section: debug @@ -206,6 +210,7 @@ Description: Linux kernel debugging symbols for $version This package will come in handy if you need to debug the kernel. It provides all the necessary debug symbols for the kernel and its modules. EOF +fi cat < debian/rules #!$(command -v $MAKE) -f From e51d8dacf2724ebb8eda8ec69dd81da4f70a4213 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Mon, 30 Mar 2020 12:07:11 -0600 Subject: [PATCH 34/34] Makefile: Update kselftest help information Update kselftest help information. Signed-off-by: Shuah Khan Signed-off-by: Masahiro Yamada --- Makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a74ba6f305b0..f3f971a500c8 100644 --- a/Makefile +++ b/Makefile @@ -1486,12 +1486,15 @@ help: @echo ' nsdeps - Generate missing symbol namespace dependencies' @echo '' @echo 'Kernel selftest:' - @echo ' kselftest - Build and run kernel selftest (run as root)' - @echo ' Build, install, and boot kernel before' - @echo ' running kselftest on it' - @echo ' kselftest-clean - Remove all generated kselftest files' - @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing' - @echo ' .config.' + @echo ' kselftest - Build and run kernel selftest' + @echo ' Build, install, and boot kernel before' + @echo ' running kselftest on it' + @echo ' Run as root for full coverage' + @echo ' kselftest-all - Build kernel selftest' + @echo ' kselftest-install - Build and install kernel selftest' + @echo ' kselftest-clean - Remove all generated kselftest files' + @echo ' kselftest-merge - Merge all the config dependencies of' + @echo ' kselftest to existing .config.' @echo '' @$(if $(dtstree), \ echo 'Devicetree:'; \