History

Merge tag 'kbuild-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada: - Add new kconfig target 'make mod2noconfig', which will be useful to speed up the build and test iteration. - Raise the minimum supported version of LLVM to 11.0.0 - Refactor certs/Makefile - Change the format of include/config/auto.conf to stop double-quoting string type CONFIG options. - Fix ARCH=sh builds in dash - Separate compression macros for general purposes (cmd_bzip2 etc.) and the ones for decompressors (cmd_bzip2_with_size etc.) - Misc Makefile cleanups * tag 'kbuild-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits) kbuild: add cmd_file_size arch: decompressor: remove useless vmlinux.bin.all-y kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22} kbuild: drop $(size_append) from cmd_zstd sh: rename suffix-y to suffix_y doc: kbuild: fix default in `imply` table microblaze: use built-in function to get CPU_{MAJOR,MINOR,REV} certs: move scripts/extract-cert to certs/ kbuild: do not quote string values in include/config/auto.conf kbuild: do not include include/config/auto.conf from shell scripts certs: simplify $(srctree)/ handling and remove config_filename macro kbuild: stop using config_filename in scripts/Makefile.modsign certs: remove misleading comments about GCC PR certs: refactor file cleaning certs: remove unneeded -I$(srctree) option for system_certificates.o certs: unify duplicated cmd_extract_certs and improve the log certs: use $< and $@ to simplify the key generation rule kbuild: remove headers_check stub kbuild: move headers_check.pl to usr/include/ certs: use if_changed to re-generate the key when the key type is changed ...

Linus Torvalds committed 4 years ago

Commit fd6f57b2 parents 0ed9059 c4d7f4057 files · +243 −367Browse files

Showing the changes to scripts (16 of 57 files). Show all

Unified · Split

16 files
  1. scripts/.gitignore +0 −1
  2. scripts/Kbuild.include +0 −47
  3. scripts/Makefile +2 −9
  4. scripts/Makefile.lib +28 −7
  5. scripts/Makefile.modinst +2 −2
  6. scripts/extract-cert.c +0 −162
  7. scripts/gen_autoksyms.sh +3 −8
  8. scripts/headers_check.pl +0 −171
  9. scripts/kconfig/Makefile +2 −1
  10. scripts/kconfig/conf.c +10 −7
  11. scripts/kconfig/confdata.c +13 −11
  12. scripts/kconfig/streamline_config.pl +1 −1
  13. scripts/link-vmlinux.sh +25 −24
  14. scripts/min-tool-version.sh +1 −1
  15. scripts/remove-stale-files +2 −0
  16. scripts/setlocalversion +4 −5
scripts/.gitignore+0−1
@@ -1,7 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22 /asn1_compiler
33 /bin2c
4−/extract-cert
54 /insert-sys-cert
65 /kallsyms
76 /module.lds
scripts/Kbuild.include+0−47
@@ -195,53 +195,6 @@ why = \ · 194 unmodified lines
195195 echo-why = $(call escsq, $(strip $(why)))
196196 endif
197197
198−###############################################################################
199−#
200−# When a Kconfig string contains a filename, it is suitable for
201−# passing to shell commands. It is surrounded by double-quotes, and
202−# any double-quotes or backslashes within it are escaped by
203−# backslashes.
204−#
205−# This is no use for dependencies or $(wildcard). We need to strip the
206−# surrounding quotes and the escaping from quotes and backslashes, and
207−# we *do* need to escape any spaces in the string. So, for example:
208−#
209−# Usage: $(eval $(call config_filename,FOO))
210−#
211−# Defines FOO_FILENAME based on the contents of the CONFIG_FOO option,
212−# transformed as described above to be suitable for use within the
213−# makefile.
214−#
215−# Also, if the filename is a relative filename and exists in the source
216−# tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to
217−# be prefixed to *both* command invocation and dependencies.
218−#
219−# Note: We also print the filenames in the quiet_cmd_foo text, and
220−# perhaps ought to have a version specially escaped for that purpose.
221−# But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good
222−# enough. It'll strip the quotes in the common case where there's no
223−# space and it's a simple filename, and it'll retain the quotes when
224−# there's a space. There are some esoteric cases in which it'll print
225−# the wrong thing, but we don't really care. The actual dependencies
226−# and commands *do* get it right, with various combinations of single
227−# and double quotes, backslashes and spaces in the filenames.
228−#
229−###############################################################################
230−#
231−define config_filename
232−ifneq ($$(CONFIG_$(1)),"")
233−$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
234−ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
235−else
236−ifeq ($$(wildcard $$($(1)_FILENAME)),)
237−ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
238−$(1)_SRCPREFIX := $(srctree)/
239−endif
240−endif
241−endif
242−endif
243−endef
244−#
245198 ###############################################################################
246199
247200 # delete partially updated (i.e. corrupted) files on error
scripts/Makefile+2−9
@@ -3,26 +3,19 @@ · 2 unmodified lines
33 # scripts contains sources for various helper programs used throughout
44 # the kernel for the build process.
55
6−CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
7−CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
8−
96 hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c
107 hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
118 hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
129 hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
1310 hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
1411 hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
15−hostprogs-always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
1612 hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
17−hostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST) += extract-cert
1813
1914 HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
2015 HOSTLDLIBS_sorttable = -lpthread
2116 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
22−HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)
23−HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
24−HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
25−HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
17+HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
18+HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
2619
2720 ifdef CONFIG_UNWINDER_ORC
2821 ifeq ($(ARCH),x86_64)
scripts/Makefile.lib+28−7
@@ -399,20 +399,35 @@ printf "%08x\n" $$dec_size | \ · 398 unmodified lines
399399 } \
400400 )
401401
402+quiet_cmd_file_size = GEN $@
403+ cmd_file_size = $(size_append) > $@
404+
402405 quiet_cmd_bzip2 = BZIP2 $@
403− cmd_bzip2 = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@
406+ cmd_bzip2 = cat $(real-prereqs) | $(KBZIP2) -9 > $@
407+
408+quiet_cmd_bzip2_with_size = BZIP2 $@
409+ cmd_bzip2_with_size = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@
404410
405411 # Lzma
406412 # ---------------------------------------------------------------------------
407413
408414 quiet_cmd_lzma = LZMA $@
409− cmd_lzma = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
415+ cmd_lzma = cat $(real-prereqs) | $(LZMA) -9 > $@
416+
417+quiet_cmd_lzma_with_size = LZMA $@
418+ cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
410419
411420 quiet_cmd_lzo = LZO $@
412− cmd_lzo = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@
421+ cmd_lzo = cat $(real-prereqs) | $(KLZOP) -9 > $@
422+
423+quiet_cmd_lzo_with_size = LZO $@
424+ cmd_lzo_with_size = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@
413425
414426 quiet_cmd_lz4 = LZ4 $@
415− cmd_lz4 = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
427+ cmd_lz4 = cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout > $@
428+
429+quiet_cmd_lz4_with_size = LZ4 $@
430+ cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
416431 $(size_append); } > $@
417432
418433 # U-Boot mkimage
@@ -455,7 +470,10 @@ quiet_cmd_uimage = UIMAGE $@ · 36 unmodified lines
455470 # big dictionary would increase the memory usage too much in the multi-call
456471 # decompression mode. A BCJ filter isn't used either.
457472 quiet_cmd_xzkern = XZKERN $@
458− cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
473+ cmd_xzkern = cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh > $@
474+
475+quiet_cmd_xzkern_with_size = XZKERN $@
476+ cmd_xzkern_with_size = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
459477 $(size_append); } > $@
460478
461479 quiet_cmd_xzmisc = XZMISC $@
@@ -478,10 +496,13 @@ quiet_cmd_xzmisc = XZMISC $@ · 16 unmodified lines
478496 # be used because it would require zstd to allocate a 128 MB buffer.
479497
480498 quiet_cmd_zstd = ZSTD $@
481− cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@
499+ cmd_zstd = cat $(real-prereqs) | $(ZSTD) -19 > $@
482500
483501 quiet_cmd_zstd22 = ZSTD22 $@
484− cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
502+ cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
503+
504+quiet_cmd_zstd22_with_size = ZSTD22 $@
505+ cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
485506
486507 # ASM offsets
487508 # ---------------------------------------------------------------------------
scripts/Makefile.modinst+2−2
@@ -66,9 +66,9 @@ endif · 65 unmodified lines
6666 # Don't stop modules_install even if we can't sign external modules.
6767 #
6868 ifeq ($(CONFIG_MODULE_SIG_ALL),y)
69+sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
6970 quiet_cmd_sign = SIGN $@
70−$(eval $(call config_filename,MODULE_SIG_KEY))
71− cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \
71+ cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(sig-key) certs/signing_key.x509 $@ \
7272 $(if $(KBUILD_EXTMOD),|| true)
7373 else
7474 quiet_cmd_sign :=
scripts/extract-cert.c+0−162
@@ -1,162 +0,0 @@
1−/* Extract X.509 certificate in DER form from PKCS#11 or PEM.
2− *
3− * Copyright © 2014-2015 Red Hat, Inc. All Rights Reserved.
4− * Copyright © 2015 Intel Corporation.
5− *
6− * Authors: David Howells <dhowells@redhat.com>
7− * David Woodhouse <dwmw2@infradead.org>
8− *
9− * This program is free software; you can redistribute it and/or
10− * modify it under the terms of the GNU Lesser General Public License
11− * as published by the Free Software Foundation; either version 2.1
12− * of the licence, or (at your option) any later version.
13− */
14−#define _GNU_SOURCE
15−#include <stdio.h>
16−#include <stdlib.h>
17−#include <stdint.h>
18−#include <stdbool.h>
19−#include <string.h>
20−#include <err.h>
21−#include <openssl/bio.h>
22−#include <openssl/pem.h>
23−#include <openssl/err.h>
24−#include <openssl/engine.h>
25−
26−#define PKEY_ID_PKCS7 2
27−
28−static __attribute__((noreturn))
29−void format(void)
30−{
31− fprintf(stderr,
32− "Usage: scripts/extract-cert <source> <dest>\n");
33− exit(2);
34−}
35−
36−static void display_openssl_errors(int l)
37−{
38− const char *file;
39− char buf[120];
40− int e, line;
41−
42− if (ERR_peek_error() == 0)
43− return;
44− fprintf(stderr, "At main.c:%d:\n", l);
45−
46− while ((e = ERR_get_error_line(&file, &line))) {
47− ERR_error_string(e, buf);
48− fprintf(stderr, "- SSL %s: %s:%d\n", buf, file, line);
49− }
50−}
51−
52−static void drain_openssl_errors(void)
53−{
54− const char *file;
55− int line;
56−
57− if (ERR_peek_error() == 0)
58− return;
59− while (ERR_get_error_line(&file, &line)) {}
60−}
61−
62−#define ERR(cond, fmt, ...) \
63− do { \
64− bool __cond = (cond); \
65− display_openssl_errors(__LINE__); \
66− if (__cond) { \
67− err(1, fmt, ## __VA_ARGS__); \
68− } \
69− } while(0)
70−
71−static const char *key_pass;
72−static BIO *wb;
73−static char *cert_dst;
74−static int kbuild_verbose;
75−
76−static void write_cert(X509 *x509)
77−{
78− char buf[200];
79−
80− if (!wb) {
81− wb = BIO_new_file(cert_dst, "wb");
82− ERR(!wb, "%s", cert_dst);
83− }
84− X509_NAME_oneline(X509_get_subject_name(x509), buf, sizeof(buf));
85− ERR(!i2d_X509_bio(wb, x509), "%s", cert_dst);
86− if (kbuild_verbose)
87− fprintf(stderr, "Extracted cert: %s\n", buf);
88−}
89−
90−int main(int argc, char **argv)
91−{
92− char *cert_src;
93−
94− OpenSSL_add_all_algorithms();
95− ERR_load_crypto_strings();
96− ERR_clear_error();
97−
98− kbuild_verbose = atoi(getenv("KBUILD_VERBOSE")?:"0");
99−
100− key_pass = getenv("KBUILD_SIGN_PIN");
101−
102− if (argc != 3)
103− format();
104−
105− cert_src = argv[1];
106− cert_dst = argv[2];
107−
108− if (!cert_src[0]) {
109− /* Invoked with no input; create empty file */
110− FILE *f = fopen(cert_dst, "wb");
111− ERR(!f, "%s", cert_dst);
112− fclose(f);
113− exit(0);
114− } else if (!strncmp(cert_src, "pkcs11:", 7)) {
115− ENGINE *e;
116− struct {
117− const char *cert_id;
118− X509 *cert;
119− } parms;
120−
121− parms.cert_id = cert_src;
122− parms.cert = NULL;
123−
124− ENGINE_load_builtin_engines();
125− drain_openssl_errors();
126− e = ENGINE_by_id("pkcs11");
127− ERR(!e, "Load PKCS#11 ENGINE");
128− if (ENGINE_init(e))
129− drain_openssl_errors();
130− else
131− ERR(1, "ENGINE_init");
132− if (key_pass)
133− ERR(!ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0), "Set PKCS#11 PIN");
134− ENGINE_ctrl_cmd(e, "LOAD_CERT_CTRL", 0, &parms, NULL, 1);
135− ERR(!parms.cert, "Get X.509 from PKCS#11");
136− write_cert(parms.cert);
137− } else {
138− BIO *b;
139− X509 *x509;
140−
141− b = BIO_new_file(cert_src, "rb");
142− ERR(!b, "%s", cert_src);
143−
144− while (1) {
145− x509 = PEM_read_bio_X509(b, NULL, NULL, NULL);
146− if (wb && !x509) {
147− unsigned long err = ERR_peek_last_error();
148− if (ERR_GET_LIB(err) == ERR_LIB_PEM &&
149− ERR_GET_REASON(err) == PEM_R_NO_START_LINE) {
150− ERR_clear_error();
151− break;
152− }
153− }
154− ERR(!x509, "%s", cert_src);
155− write_cert(x509);
156− }
157− }
158−
159− BIO_free(wb);
160−
161− return 0;
162−}
scripts/gen_autoksyms.sh+3−8
@@ -16,20 +16,15 @@ case "$KBUILD_VERBOSE" in · 15 unmodified lines
1616 ;;
1717 esac
1818
19−# We need access to CONFIG_ symbols
20−. include/config/auto.conf
21−
2219 needed_symbols=
2320
2421 # Special case for modversions (see modpost.c)
25−if [ -n "$CONFIG_MODVERSIONS" ]; then
22+if grep -q "^CONFIG_MODVERSIONS=y$" include/config/auto.conf; then
2623 needed_symbols="$needed_symbols module_layout"
2724 fi
2825
29−ksym_wl=
30−if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then
31− # Use 'eval' to expand the whitelist path and check if it is relative
32− eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST"
26+ksym_wl=$(sed -n 's/^CONFIG_UNUSED_KSYMS_WHITELIST=\(.*\)$/\1/p' include/config/auto.conf)
27+if [ -n "$ksym_wl" ]; then
3328 [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"
3429 if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then
3530 echo "ERROR: '$ksym_wl' whitelist file not found" >&2
scripts/headers_check.pl+0−171
@@ -1,171 +0,0 @@
1−#!/usr/bin/env perl
2−# SPDX-License-Identifier: GPL-2.0
3−#
4−# headers_check.pl execute a number of trivial consistency checks
5−#
6−# Usage: headers_check.pl dir arch [files...]
7−# dir: dir to look for included files
8−# arch: architecture
9−# files: list of files to check
10−#
11−# The script reads the supplied files line by line and:
12−#
13−# 1) for each include statement it checks if the
14−# included file actually exists.
15−# Only include files located in asm* and linux* are checked.
16−# The rest are assumed to be system include files.
17−#
18−# 2) It is checked that prototypes does not use "extern"
19−#
20−# 3) Check for leaked CONFIG_ symbols
21−
22−use warnings;
23−use strict;
24−use File::Basename;
25−
26−my ($dir, $arch, @files) = @ARGV;
27−
28−my $ret = 0;
29−my $line;
30−my $lineno = 0;
31−my $filename;
32−
33−foreach my $file (@files) {
34− $filename = $file;
35−
36− open(my $fh, '<', $filename)
37− or die "$filename: $!\n";
38− $lineno = 0;
39− while ($line = <$fh>) {
40− $lineno++;
41− &check_include();
42− &check_asm_types();
43− &check_sizetypes();
44− &check_declarations();
45− # Dropped for now. Too much noise &check_config();
46− }
47− close $fh;
48−}
49−exit $ret;
50−
51−sub check_include
52−{
53− if ($line =~ m/^\s*#\s*include\s+<((asm|linux).*)>/) {
54− my $inc = $1;
55− my $found;
56− $found = stat($dir . "/" . $inc);
57− if (!$found) {
58− $inc =~ s#asm/#asm-$arch/#;
59− $found = stat($dir . "/" . $inc);
60− }
61− if (!$found) {
62− printf STDERR "$filename:$lineno: included file '$inc' is not exported\n";
63− $ret = 1;
64− }
65− }
66−}
67−
68−sub check_declarations
69−{
70− # soundcard.h is what it is
71− if ($line =~ m/^void seqbuf_dump\(void\);/) {
72− return;
73− }
74− # drm headers are being C++ friendly
75− if ($line =~ m/^extern "C"/) {
76− return;
77− }
78− if ($line =~ m/^(\s*extern|unsigned|char|short|int|long|void)\b/) {
79− printf STDERR "$filename:$lineno: " .
80− "userspace cannot reference function or " .
81− "variable defined in the kernel\n";
82− }
83−}
84−
85−sub check_config
86−{
87− if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) {
88− printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n";
89− }
90−}
91−
92−my $linux_asm_types;
93−sub check_asm_types
94−{
95− if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
96− return;
97− }
98− if ($lineno == 1) {
99− $linux_asm_types = 0;
100− } elsif ($linux_asm_types >= 1) {
101− return;
102− }
103− if ($line =~ m/^\s*#\s*include\s+<asm\/types.h>/) {
104− $linux_asm_types = 1;
105− printf STDERR "$filename:$lineno: " .
106− "include of <linux/types.h> is preferred over <asm/types.h>\n"
107− # Warn until headers are all fixed
108− #$ret = 1;
109− }
110−}
111−
112−my $linux_types;
113−my %import_stack = ();
114−sub check_include_typesh
115−{
116− my $path = $_[0];
117− my $import_path;
118−
119− my $fh;
120− my @file_paths = ($path, $dir . "/" . $path, dirname($filename) . "/" . $path);
121− for my $possible ( @file_paths ) {
122− if (not $import_stack{$possible} and open($fh, '<', $possible)) {
123− $import_path = $possible;
124− $import_stack{$import_path} = 1;
125− last;
126− }
127− }
128− if (eof $fh) {
129− return;
130− }
131−
132− my $line;
133− while ($line = <$fh>) {
134− if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) {
135− $linux_types = 1;
136− last;
137− }
138− if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
139− check_include_typesh($included);
140− }
141− }
142− close $fh;
143− delete $import_stack{$import_path};
144−}
145−
146−sub check_sizetypes
147−{
148− if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
149− return;
150− }
151− if ($lineno == 1) {
152− $linux_types = 0;
153− } elsif ($linux_types >= 1) {
154− return;
155− }
156− if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) {
157− $linux_types = 1;
158− return;
159− }
160− if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
161− check_include_typesh($included);
162− }
163− if ($line =~ m/__[us](8|16|32|64)\b/) {
164− printf STDERR "$filename:$lineno: " .
165− "found __[us]{8,16,32,64} type " .
166− "without #include <linux/types.h>\n";
167− $linux_types = 2;
168− # Warn until headers are all fixed
169− #$ret = 1;
170− }
171−}
scripts/kconfig/Makefile+2−1
@@ -69,7 +69,7 @@ localyesconfig localmodconfig: $(obj)/conf · 68 unmodified lines
6969 # deprecated for external use
7070 simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
7171 alldefconfig randconfig listnewconfig olddefconfig syncconfig \
72− helpnewconfig yes2modconfig mod2yesconfig
72+ helpnewconfig yes2modconfig mod2yesconfig mod2noconfig
7373
7474 PHONY += $(simple-targets)
7575
@@ -134,6 +134,7 @@ help: · 58 unmodified lines
134134 @echo ' randconfig - New config with random answer to all options'
135135 @echo ' yes2modconfig - Change answers from yes to mod if possible'
136136 @echo ' mod2yesconfig - Change answers from mod to yes if possible'
137+ @echo ' mod2noconfig - Change answers from mod to no if possible'
137138 @echo ' listnewconfig - List new options'
138139 @echo ' helpnewconfig - List new options and help text'
139140 @echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
scripts/kconfig/conf.c+10−7
@@ -35,6 +35,7 @@ enum input_mode { · 34 unmodified lines
3535 olddefconfig,
3636 yes2modconfig,
3737 mod2yesconfig,
38+ mod2noconfig,
3839 };
3940 static enum input_mode input_mode = oldaskconfig;
4041 static int input_mode_opt;
@@ -163,8 +164,6 @@ enum conf_def_mode { · 122 unmodified lines
163164 def_default,
164165 def_yes,
165166 def_mod,
166− def_y2m,
167− def_m2y,
168167 def_no,
169168 def_random
170169 };
@@ -302,12 +301,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 131 unmodified lines
302301 return has_changed;
303302 }
304303
305−static void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
304+static void conf_rewrite_tristates(tristate old_val, tristate new_val)
306305 {
307306 struct symbol *sym;
308307 int i;
309− tristate old_val = (mode == def_y2m) ? yes : mod;
310− tristate new_val = (mode == def_y2m) ? mod : yes;
311308
312309 for_all_symbols(i, sym) {
313310 if (sym_get_type(sym) == S_TRISTATE &&
@@ -685,6 +682,7 @@ static const struct option long_opts[] = { · 371 unmodified lines
685682 {"olddefconfig", no_argument, &input_mode_opt, olddefconfig},
686683 {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},
687684 {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig},
685+ {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig},
688686 {NULL, 0, NULL, 0}
689687 };
690688
@@ -713,6 +711,7 @@ static void conf_usage(const char *progname) · 22 unmodified lines
713711 printf(" --randconfig New config with random answer to all options\n");
714712 printf(" --yes2modconfig Change answers from yes to mod if possible\n");
715713 printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
714+ printf(" --mod2noconfig Change answers from mod to no if possible\n");
716715 printf(" (If none of the above is given, --oldaskconfig is the default)\n");
717716 }
718717
@@ -788,6 +787,7 @@ int main(int ac, char **av) · 69 unmodified lines
788787 case olddefconfig:
789788 case yes2modconfig:
790789 case mod2yesconfig:
790+ case mod2noconfig:
791791 conf_read(NULL);
792792 break;
793793 case allnoconfig:
@@ -862,10 +862,13 @@ int main(int ac, char **av) · 68 unmodified lines
862862 case savedefconfig:
863863 break;
864864 case yes2modconfig:
865− conf_rewrite_mod_or_yes(def_y2m);
865+ conf_rewrite_tristates(yes, mod);
866866 break;
867867 case mod2yesconfig:
868− conf_rewrite_mod_or_yes(def_m2y);
868+ conf_rewrite_tristates(mod, yes);
869+ break;
870+ case mod2noconfig:
871+ conf_rewrite_tristates(mod, no);
869872 break;
870873 case oldaskconfig:
871874 rootEntry = &rootmenu;
scripts/kconfig/confdata.c+13−11
@@ -244,19 +244,21 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 243 unmodified lines
244244 p, sym->name);
245245 return 1;
246246 case S_STRING:
247− if (*p++ != '"')
248− break;
249− for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
250− if (*p2 == '"') {
251− *p2 = 0;
247+ /* No escaping for S_DEF_AUTO (include/config/auto.conf) */
248+ if (def != S_DEF_AUTO) {
249+ if (*p++ != '"')
252250 break;
251+ for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
252+ if (*p2 == '"') {
253+ *p2 = 0;
254+ break;
255+ }
256+ memmove(p2, p2 + 1, strlen(p2));
253257 }
254− memmove(p2, p2 + 1, strlen(p2));
255− }
256− if (!p2) {
257− if (def != S_DEF_AUTO)
258+ if (!p2) {
258259 conf_warning("invalid string found");
259− return 1;
260+ return 1;
261+ }
260262 }
261263 /* fall through */
262264 case S_INT:
@@ -700,7 +702,7 @@ static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) · 437 unmodified lines
700702
701703 static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
702704 {
703− __print_symbol(fp, sym, OUTPUT_N_NONE, true);
705+ __print_symbol(fp, sym, OUTPUT_N_NONE, false);
704706 }
705707
706708 void print_symbol_for_listconfig(struct symbol *sym)
scripts/kconfig/streamline_config.pl+1−1
@@ -170,7 +170,7 @@ sub read_kconfig { · 169 unmodified lines
170170 $source =~ s/\$\($env\)/$ENV{$env}/;
171171 }
172172
173− open(my $kinfile, '<', $source) || die "Can't open $kconfig";
173+ open(my $kinfile, '<', $source) || die "Can't open $source";
174174 while (<$kinfile>) {
175175 chomp;
176176
scripts/link-vmlinux.sh+25−24
@@ -34,6 +34,10 @@ LD="$1" · 33 unmodified lines
3434 KBUILD_LDFLAGS="$2"
3535 LDFLAGS_vmlinux="$3"
3636
37+is_enabled() {
38+ grep -q "^$1=y" include/config/auto.conf
39+}
40+
3741 # Nice output in kbuild format
3842 # Will be supressed by "make -s"
3943 info()
@@ -80,11 +84,11 @@ modpost_link() · 40 unmodified lines
8084 ${KBUILD_VMLINUX_LIBS} \
8185 --end-group"
8286
83− if [ -n "${CONFIG_LTO_CLANG}" ]; then
87+ if is_enabled CONFIG_LTO_CLANG; then
8488 gen_initcalls
8589 lds="-T .tmp_initcalls.lds"
8690
87− if [ -n "${CONFIG_MODVERSIONS}" ]; then
91+ if is_enabled CONFIG_MODVERSIONS; then
8892 gen_symversions
8993 lds="${lds} -T .tmp_symversions.lds"
9094 fi
@@ -104,21 +108,21 @@ objtool_link() · 13 unmodified lines
104108 local objtoolcmd;
105109 local objtoolopt;
106110
107− if [ "${CONFIG_LTO_CLANG} ${CONFIG_STACK_VALIDATION}" = "y y" ]; then
111+ if is_enabled CONFIG_LTO_CLANG && is_enabled CONFIG_STACK_VALIDATION; then
108112 # Don't perform vmlinux validation unless explicitly requested,
109113 # but run objtool on vmlinux.o now that we have an object file.
110− if [ -n "${CONFIG_UNWINDER_ORC}" ]; then
114+ if is_enabled CONFIG_UNWINDER_ORC; then
111115 objtoolcmd="orc generate"
112116 fi
113117
114118 objtoolopt="${objtoolopt} --duplicate"
115119
116− if [ -n "${CONFIG_FTRACE_MCOUNT_USE_OBJTOOL}" ]; then
120+ if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
117121 objtoolopt="${objtoolopt} --mcount"
118122 fi
119123 fi
120124
121− if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then
125+ if is_enabled CONFIG_VMLINUX_VALIDATION; then
122126 objtoolopt="${objtoolopt} --noinstr"
123127 fi
124128
@@ -127,19 +131,19 @@ objtool_link() · 2 unmodified lines
127131 objtoolcmd="check"
128132 fi
129133 objtoolopt="${objtoolopt} --vmlinux"
130− if [ -z "${CONFIG_FRAME_POINTER}" ]; then
134+ if ! is_enabled CONFIG_FRAME_POINTER; then
131135 objtoolopt="${objtoolopt} --no-fp"
132136 fi
133− if [ -n "${CONFIG_GCOV_KERNEL}" ] || [ -n "${CONFIG_LTO_CLANG}" ]; then
137+ if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then
134138 objtoolopt="${objtoolopt} --no-unreachable"
135139 fi
136− if [ -n "${CONFIG_RETPOLINE}" ]; then
140+ if is_enabled CONFIG_RETPOLINE; then
137141 objtoolopt="${objtoolopt} --retpoline"
138142 fi
139− if [ -n "${CONFIG_X86_SMAP}" ]; then
143+ if is_enabled CONFIG_X86_SMAP; then
140144 objtoolopt="${objtoolopt} --uaccess"
141145 fi
142− if [ -n "${CONFIG_SLS}" ]; then
146+ if is_enabled CONFIG_SLS; then
143147 objtoolopt="${objtoolopt} --sls"
144148 fi
145149 info OBJTOOL ${1}
@@ -164,7 +168,7 @@ vmlinux_link() · 18 unmodified lines
164168 # skip output file argument
165169 shift
166170
167− if [ -n "${CONFIG_LTO_CLANG}" ]; then
171+ if is_enabled CONFIG_LTO_CLANG; then
168172 # Use vmlinux.o instead of performing the slow LTO link again.
169173 objs=vmlinux.o
170174 libs=
@@ -192,7 +196,7 @@ vmlinux_link() · 21 unmodified lines
192196 ldflags="${ldflags} ${wl}--strip-debug"
193197 fi
194198
195− if [ -n "${CONFIG_VMLINUX_MAP}" ]; then
199+ if is_enabled CONFIG_VMLINUX_MAP; then
196200 ldflags="${ldflags} ${wl}-Map=${output}.map"
197201 fi
198202
@@ -242,15 +246,15 @@ kallsyms() · 43 unmodified lines
242246 {
243247 local kallsymopt;
244248
245− if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
249+ if is_enabled CONFIG_KALLSYMS_ALL; then
246250 kallsymopt="${kallsymopt} --all-symbols"
247251 fi
248252
249− if [ -n "${CONFIG_KALLSYMS_ABSOLUTE_PERCPU}" ]; then
253+ if is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU; then
250254 kallsymopt="${kallsymopt} --absolute-percpu"
251255 fi
252256
253− if [ -n "${CONFIG_KALLSYMS_BASE_RELATIVE}" ]; then
257+ if is_enabled CONFIG_KALLSYMS_BASE_RELATIVE; then
254258 kallsymopt="${kallsymopt} --base-relative"
255259 fi
256260
@@ -315,9 +319,6 @@ if [ "$1" = "clean" ]; then · 58 unmodified lines
315319 exit 0
316320 fi
317321
318−# We need access to CONFIG_ symbols
319−. include/config/auto.conf
320−
321322 # Update version
322323 info GEN .version
323324 if [ -r .version ]; then
@@ -346,7 +347,7 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | · 22 unmodified lines
346347 tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin
347348
348349 btf_vmlinux_bin_o=""
349−if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
350+if is_enabled CONFIG_DEBUG_INFO_BTF; then
350351 btf_vmlinux_bin_o=.btf.vmlinux.bin.o
351352 if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then
352353 echo >&2 "Failed to generate BTF for vmlinux"
@@ -358,7 +359,7 @@ fi · 5 unmodified lines
358359 kallsymso=""
359360 kallsymso_prev=""
360361 kallsyms_vmlinux=""
361−if [ -n "${CONFIG_KALLSYMS}" ]; then
362+if is_enabled CONFIG_KALLSYMS; then
362363
363364 # kallsyms support
364365 # Generate section listing all symbols and add it into vmlinux
@@ -398,7 +399,7 @@ fi · 33 unmodified lines
398399 vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
399400
400401 # fill in BTF IDs
401−if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then
402+if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
402403 info BTFIDS vmlinux
403404 ${RESOLVE_BTFIDS} vmlinux
404405 fi
@@ -406,7 +407,7 @@ fi · 1 unmodified line
406407 info SYSMAP System.map
407408 mksysmap vmlinux System.map
408409
409−if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
410+if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
410411 info SORTTAB vmlinux
411412 if ! sorttable vmlinux; then
412413 echo >&2 Failed to sort kernel tables
@@ -415,7 +416,7 @@ if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then · 2 unmodified lines
415416 fi
416417
417418 # step a (see comment above)
418−if [ -n "${CONFIG_KALLSYMS}" ]; then
419+if is_enabled CONFIG_KALLSYMS; then
419420 mksysmap ${kallsyms_vmlinux} .tmp_System.map
420421
421422 if ! cmp -s System.map .tmp_System.map; then
scripts/min-tool-version.sh+1−1
@@ -28,7 +28,7 @@ llvm) · 27 unmodified lines
2828 if [ "$SRCARCH" = s390 ]; then
2929 echo 13.0.0
3030 else
31− echo 10.0.1
31+ echo 11.0.0
3232 fi
3333 ;;
3434 *)
scripts/remove-stale-files+2−0
@@ -39,3 +39,5 @@ if [ -n "${building_out_of_srctree}" ]; then · 38 unmodified lines
3939 rm -f arch/parisc/boot/compressed/${f}
4040 done
4141 fi
42+
43+rm -f scripts/extract-cert
scripts/setlocalversion+4−5
@@ -111,9 +111,7 @@ if $scm_only; then · 110 unmodified lines
111111 exit
112112 fi
113113
114−if test -e include/config/auto.conf; then
115− . include/config/auto.conf
116−else
114+if ! test -e include/config/auto.conf; then
117115 echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
118116 exit 1
119117 fi
@@ -125,10 +123,11 @@ if test ! "$srctree" -ef .; then · 5 unmodified lines
125123 fi
126124
127125 # CONFIG_LOCALVERSION and LOCALVERSION (if set)
128−res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
126+config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
127+res="${res}${config_localversion}${LOCALVERSION}"
129128
130129 # scm version string if not at a tagged commit
131−if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
130+if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
132131 # full scm version string
133132 res="$res$(scm_version)"
134133 elif [ "${LOCALVERSION+set}" != "set" ]; then

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t