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 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2/asn1_compiler2/asn1_compiler
3/bin2c3/bin2c
4/extract-cert
5/insert-sys-cert4/insert-sys-cert
6/kallsyms5/kallsyms
7/module.lds6/module.lds
scripts/Kbuild.include+0−47
@@ -195,53 +195,6 @@ why = \ · 194 unmodified lines
195echo-why = $(call escsq, $(strip $(why)))195echo-why = $(call escsq, $(strip $(why)))
196endif196endif
197 197
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#
231define config_filename
232ifneq ($$(CONFIG_$(1)),"")
233$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
234ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
235else
236ifeq ($$(wildcard $$($(1)_FILENAME)),)
237ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
238$(1)_SRCPREFIX := $(srctree)/
239endif
240endif
241endif
242endif
243endef
244#
245###############################################################################198###############################################################################
246 199
247# delete partially updated (i.e. corrupted) files on error200# delete partially updated (i.e. corrupted) files on error
scripts/Makefile+2−9
@@ -3,26 +3,19 @@ · 2 unmodified lines
3# scripts contains sources for various helper programs used throughout3# scripts contains sources for various helper programs used throughout
4# the kernel for the build process.4# the kernel for the build process.
5 5
6CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
7CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
8
9hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c6hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c
10hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms7hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
11hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount8hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
12hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable9hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
13hostprogs-always-$(CONFIG_ASN1) += asn1_compiler10hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
14hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file11hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
15hostprogs-always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
16hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert12hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
17hostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST) += extract-cert
18 13
19HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include14HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
20HOSTLDLIBS_sorttable = -lpthread15HOSTLDLIBS_sorttable = -lpthread
21HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include16HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
22HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)17HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
23HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)18HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
24HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
25HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
26 19
27ifdef CONFIG_UNWINDER_ORC20ifdef CONFIG_UNWINDER_ORC
28ifeq ($(ARCH),x86_64)21ifeq ($(ARCH),x86_64)
scripts/Makefile.lib+28−7
@@ -399,20 +399,35 @@ printf "%08x\n" $$dec_size | \ · 398 unmodified lines
399 } \399 } \
400)400)
401 401
402quiet_cmd_file_size = GEN $@
403 cmd_file_size = $(size_append) > $@
404
402quiet_cmd_bzip2 = BZIP2 $@405quiet_cmd_bzip2 = BZIP2 $@
403 cmd_bzip2 = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@406 cmd_bzip2 = cat $(real-prereqs) | $(KBZIP2) -9 > $@
407
408quiet_cmd_bzip2_with_size = BZIP2 $@
409 cmd_bzip2_with_size = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@
404 410
405# Lzma411# Lzma
406# ---------------------------------------------------------------------------412# ---------------------------------------------------------------------------
407 413
408quiet_cmd_lzma = LZMA $@414quiet_cmd_lzma = LZMA $@
409 cmd_lzma = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@415 cmd_lzma = cat $(real-prereqs) | $(LZMA) -9 > $@
416
417quiet_cmd_lzma_with_size = LZMA $@
418 cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
410 419
411quiet_cmd_lzo = LZO $@420quiet_cmd_lzo = LZO $@
412 cmd_lzo = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@421 cmd_lzo = cat $(real-prereqs) | $(KLZOP) -9 > $@
422
423quiet_cmd_lzo_with_size = LZO $@
424 cmd_lzo_with_size = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@
413 425
414quiet_cmd_lz4 = LZ4 $@426quiet_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
429quiet_cmd_lz4_with_size = LZ4 $@
430 cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
416 $(size_append); } > $@431 $(size_append); } > $@
417 432
418# U-Boot mkimage433# U-Boot mkimage
@@ -455,7 +470,10 @@ quiet_cmd_uimage = UIMAGE $@ · 36 unmodified lines
455# big dictionary would increase the memory usage too much in the multi-call470# big dictionary would increase the memory usage too much in the multi-call
456# decompression mode. A BCJ filter isn't used either.471# decompression mode. A BCJ filter isn't used either.
457quiet_cmd_xzkern = XZKERN $@472quiet_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
475quiet_cmd_xzkern_with_size = XZKERN $@
476 cmd_xzkern_with_size = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
459 $(size_append); } > $@477 $(size_append); } > $@
460 478
461quiet_cmd_xzmisc = XZMISC $@479quiet_cmd_xzmisc = XZMISC $@
@@ -478,10 +496,13 @@ quiet_cmd_xzmisc = XZMISC $@ · 16 unmodified lines
478# be used because it would require zstd to allocate a 128 MB buffer.496# be used because it would require zstd to allocate a 128 MB buffer.
479 497
480quiet_cmd_zstd = ZSTD $@498quiet_cmd_zstd = ZSTD $@
481 cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@499 cmd_zstd = cat $(real-prereqs) | $(ZSTD) -19 > $@
482 500
483quiet_cmd_zstd22 = ZSTD22 $@501quiet_cmd_zstd22 = ZSTD22 $@
484 cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@502 cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
503
504quiet_cmd_zstd22_with_size = ZSTD22 $@
505 cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
485 506
486# ASM offsets507# ASM offsets
487# ---------------------------------------------------------------------------508# ---------------------------------------------------------------------------
scripts/Makefile.modinst+2−2
@@ -66,9 +66,9 @@ endif · 65 unmodified lines
66# Don't stop modules_install even if we can't sign external modules.66# Don't stop modules_install even if we can't sign external modules.
67#67#
68ifeq ($(CONFIG_MODULE_SIG_ALL),y)68ifeq ($(CONFIG_MODULE_SIG_ALL),y)
69sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
69quiet_cmd_sign = SIGN $@70quiet_cmd_sign = SIGN $@
70$(eval $(call config_filename,MODULE_SIG_KEY))71 cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(sig-key) certs/signing_key.x509 $@ \
71 cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \
72 $(if $(KBUILD_EXTMOD),|| true)72 $(if $(KBUILD_EXTMOD),|| true)
73else73else
74quiet_cmd_sign :=74quiet_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
28static __attribute__((noreturn))
29void format(void)
30{
31 fprintf(stderr,
32 "Usage: scripts/extract-cert <source> <dest>\n");
33 exit(2);
34}
35
36static 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
52static 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
71static const char *key_pass;
72static BIO *wb;
73static char *cert_dst;
74static int kbuild_verbose;
75
76static 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
90int 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
16 ;;16 ;;
17esac17esac
18 18
19# We need access to CONFIG_ symbols
20. include/config/auto.conf
21
22needed_symbols=19needed_symbols=
23 20
24# Special case for modversions (see modpost.c)21# Special case for modversions (see modpost.c)
25if [ -n "$CONFIG_MODVERSIONS" ]; then22if grep -q "^CONFIG_MODVERSIONS=y$" include/config/auto.conf; then
26 needed_symbols="$needed_symbols module_layout"23 needed_symbols="$needed_symbols module_layout"
27fi24fi
28 25
29ksym_wl=26ksym_wl=$(sed -n 's/^CONFIG_UNUSED_KSYMS_WHITELIST=\(.*\)$/\1/p' include/config/auto.conf)
30if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then27if [ -n "$ksym_wl" ]; then
31 # Use 'eval' to expand the whitelist path and check if it is relative
32 eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST"
33 [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"28 [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"
34 if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then29 if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then
35 echo "ERROR: '$ksym_wl' whitelist file not found" >&230 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
22use warnings;
23use strict;
24use File::Basename;
25
26my ($dir, $arch, @files) = @ARGV;
27
28my $ret = 0;
29my $line;
30my $lineno = 0;
31my $filename;
32
33foreach 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}
49exit $ret;
50
51sub 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
68sub 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
85sub 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
92my $linux_asm_types;
93sub 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
112my $linux_types;
113my %import_stack = ();
114sub 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
146sub 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
69# deprecated for external use69# deprecated for external use
70simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \70simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
71 alldefconfig randconfig listnewconfig olddefconfig syncconfig \71 alldefconfig randconfig listnewconfig olddefconfig syncconfig \
72 helpnewconfig yes2modconfig mod2yesconfig72 helpnewconfig yes2modconfig mod2yesconfig mod2noconfig
73 73
74PHONY += $(simple-targets)74PHONY += $(simple-targets)
75 75
@@ -134,6 +134,7 @@ help: · 58 unmodified lines
134 @echo ' randconfig - New config with random answer to all options'134 @echo ' randconfig - New config with random answer to all options'
135 @echo ' yes2modconfig - Change answers from yes to mod if possible'135 @echo ' yes2modconfig - Change answers from yes to mod if possible'
136 @echo ' mod2yesconfig - Change answers from mod to yes if possible'136 @echo ' mod2yesconfig - Change answers from mod to yes if possible'
137 @echo ' mod2noconfig - Change answers from mod to no if possible'
137 @echo ' listnewconfig - List new options'138 @echo ' listnewconfig - List new options'
138 @echo ' helpnewconfig - List new options and help text'139 @echo ' helpnewconfig - List new options and help text'
139 @echo ' olddefconfig - Same as oldconfig but sets new symbols to their'140 @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
35 olddefconfig,35 olddefconfig,
36 yes2modconfig,36 yes2modconfig,
37 mod2yesconfig,37 mod2yesconfig,
38 mod2noconfig,
38};39};
39static enum input_mode input_mode = oldaskconfig;40static enum input_mode input_mode = oldaskconfig;
40static int input_mode_opt;41static int input_mode_opt;
@@ -163,8 +164,6 @@ enum conf_def_mode { · 122 unmodified lines
163 def_default,164 def_default,
164 def_yes,165 def_yes,
165 def_mod,166 def_mod,
166 def_y2m,
167 def_m2y,
168 def_no,167 def_no,
169 def_random168 def_random
170};169};
@@ -302,12 +301,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 131 unmodified lines
302 return has_changed;301 return has_changed;
303}302}
304 303
305static void conf_rewrite_mod_or_yes(enum conf_def_mode mode)304static void conf_rewrite_tristates(tristate old_val, tristate new_val)
306{305{
307 struct symbol *sym;306 struct symbol *sym;
308 int i;307 int i;
309 tristate old_val = (mode == def_y2m) ? yes : mod;
310 tristate new_val = (mode == def_y2m) ? mod : yes;
311 308
312 for_all_symbols(i, sym) {309 for_all_symbols(i, sym) {
313 if (sym_get_type(sym) == S_TRISTATE &&310 if (sym_get_type(sym) == S_TRISTATE &&
@@ -685,6 +682,7 @@ static const struct option long_opts[] = { · 371 unmodified lines
685 {"olddefconfig", no_argument, &input_mode_opt, olddefconfig},682 {"olddefconfig", no_argument, &input_mode_opt, olddefconfig},
686 {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},683 {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},
687 {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig},684 {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig},
685 {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig},
688 {NULL, 0, NULL, 0}686 {NULL, 0, NULL, 0}
689};687};
690 688
@@ -713,6 +711,7 @@ static void conf_usage(const char *progname) · 22 unmodified lines
713 printf(" --randconfig New config with random answer to all options\n");711 printf(" --randconfig New config with random answer to all options\n");
714 printf(" --yes2modconfig Change answers from yes to mod if possible\n");712 printf(" --yes2modconfig Change answers from yes to mod if possible\n");
715 printf(" --mod2yesconfig Change answers from mod to yes if possible\n");713 printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
714 printf(" --mod2noconfig Change answers from mod to no if possible\n");
716 printf(" (If none of the above is given, --oldaskconfig is the default)\n");715 printf(" (If none of the above is given, --oldaskconfig is the default)\n");
717}716}
718 717
@@ -788,6 +787,7 @@ int main(int ac, char **av) · 69 unmodified lines
788 case olddefconfig:787 case olddefconfig:
789 case yes2modconfig:788 case yes2modconfig:
790 case mod2yesconfig:789 case mod2yesconfig:
790 case mod2noconfig:
791 conf_read(NULL);791 conf_read(NULL);
792 break;792 break;
793 case allnoconfig:793 case allnoconfig:
@@ -862,10 +862,13 @@ int main(int ac, char **av) · 68 unmodified lines
862 case savedefconfig:862 case savedefconfig:
863 break;863 break;
864 case yes2modconfig:864 case yes2modconfig:
865 conf_rewrite_mod_or_yes(def_y2m);865 conf_rewrite_tristates(yes, mod);
866 break;866 break;
867 case mod2yesconfig:867 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);
869 break;872 break;
870 case oldaskconfig:873 case oldaskconfig:
871 rootEntry = &rootmenu;874 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
244 p, sym->name);244 p, sym->name);
245 return 1;245 return 1;
246 case S_STRING:246 case S_STRING:
247 if (*p++ != '"')247 /* No escaping for S_DEF_AUTO (include/config/auto.conf) */
248 break;248 if (def != S_DEF_AUTO) {
249 for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {249 if (*p++ != '"')
250 if (*p2 == '"') {
251 *p2 = 0;
252 break;250 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));
253 }257 }
254 memmove(p2, p2 + 1, strlen(p2));258 if (!p2) {
255 }
256 if (!p2) {
257 if (def != S_DEF_AUTO)
258 conf_warning("invalid string found");259 conf_warning("invalid string found");
259 return 1;260 return 1;
261 }
260 }262 }
261 /* fall through */263 /* fall through */
262 case S_INT:264 case S_INT:
@@ -700,7 +702,7 @@ static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) · 437 unmodified lines
700 702
701static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)703static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
702{704{
703 __print_symbol(fp, sym, OUTPUT_N_NONE, true);705 __print_symbol(fp, sym, OUTPUT_N_NONE, false);
704}706}
705 707
706void print_symbol_for_listconfig(struct symbol *sym)708void print_symbol_for_listconfig(struct symbol *sym)
scripts/kconfig/streamline_config.pl+1−1
@@ -170,7 +170,7 @@ sub read_kconfig { · 169 unmodified lines
170 $source =~ s/\$\($env\)/$ENV{$env}/;170 $source =~ s/\$\($env\)/$ENV{$env}/;
171 }171 }
172 172
173 open(my $kinfile, '<', $source) || die "Can't open $kconfig";173 open(my $kinfile, '<', $source) || die "Can't open $source";
174 while (<$kinfile>) {174 while (<$kinfile>) {
175 chomp;175 chomp;
176 176
scripts/link-vmlinux.sh+25−24
@@ -34,6 +34,10 @@ LD="$1" · 33 unmodified lines
34KBUILD_LDFLAGS="$2"34KBUILD_LDFLAGS="$2"
35LDFLAGS_vmlinux="$3"35LDFLAGS_vmlinux="$3"
36 36
37is_enabled() {
38 grep -q "^$1=y" include/config/auto.conf
39}
40
37# Nice output in kbuild format41# Nice output in kbuild format
38# Will be supressed by "make -s"42# Will be supressed by "make -s"
39info()43info()
@@ -80,11 +84,11 @@ modpost_link() · 40 unmodified lines
80 ${KBUILD_VMLINUX_LIBS} \84 ${KBUILD_VMLINUX_LIBS} \
81 --end-group"85 --end-group"
82 86
83 if [ -n "${CONFIG_LTO_CLANG}" ]; then87 if is_enabled CONFIG_LTO_CLANG; then
84 gen_initcalls88 gen_initcalls
85 lds="-T .tmp_initcalls.lds"89 lds="-T .tmp_initcalls.lds"
86 90
87 if [ -n "${CONFIG_MODVERSIONS}" ]; then91 if is_enabled CONFIG_MODVERSIONS; then
88 gen_symversions92 gen_symversions
89 lds="${lds} -T .tmp_symversions.lds"93 lds="${lds} -T .tmp_symversions.lds"
90 fi94 fi
@@ -104,21 +108,21 @@ objtool_link() · 13 unmodified lines
104 local objtoolcmd;108 local objtoolcmd;
105 local objtoolopt;109 local objtoolopt;
106 110
107 if [ "${CONFIG_LTO_CLANG} ${CONFIG_STACK_VALIDATION}" = "y y" ]; then111 if is_enabled CONFIG_LTO_CLANG && is_enabled CONFIG_STACK_VALIDATION; then
108 # Don't perform vmlinux validation unless explicitly requested,112 # Don't perform vmlinux validation unless explicitly requested,
109 # but run objtool on vmlinux.o now that we have an object file.113 # but run objtool on vmlinux.o now that we have an object file.
110 if [ -n "${CONFIG_UNWINDER_ORC}" ]; then114 if is_enabled CONFIG_UNWINDER_ORC; then
111 objtoolcmd="orc generate"115 objtoolcmd="orc generate"
112 fi116 fi
113 117
114 objtoolopt="${objtoolopt} --duplicate"118 objtoolopt="${objtoolopt} --duplicate"
115 119
116 if [ -n "${CONFIG_FTRACE_MCOUNT_USE_OBJTOOL}" ]; then120 if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
117 objtoolopt="${objtoolopt} --mcount"121 objtoolopt="${objtoolopt} --mcount"
118 fi122 fi
119 fi123 fi
120 124
121 if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then125 if is_enabled CONFIG_VMLINUX_VALIDATION; then
122 objtoolopt="${objtoolopt} --noinstr"126 objtoolopt="${objtoolopt} --noinstr"
123 fi127 fi
124 128
@@ -127,19 +131,19 @@ objtool_link() · 2 unmodified lines
127 objtoolcmd="check"131 objtoolcmd="check"
128 fi132 fi
129 objtoolopt="${objtoolopt} --vmlinux"133 objtoolopt="${objtoolopt} --vmlinux"
130 if [ -z "${CONFIG_FRAME_POINTER}" ]; then134 if ! is_enabled CONFIG_FRAME_POINTER; then
131 objtoolopt="${objtoolopt} --no-fp"135 objtoolopt="${objtoolopt} --no-fp"
132 fi136 fi
133 if [ -n "${CONFIG_GCOV_KERNEL}" ] || [ -n "${CONFIG_LTO_CLANG}" ]; then137 if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then
134 objtoolopt="${objtoolopt} --no-unreachable"138 objtoolopt="${objtoolopt} --no-unreachable"
135 fi139 fi
136 if [ -n "${CONFIG_RETPOLINE}" ]; then140 if is_enabled CONFIG_RETPOLINE; then
137 objtoolopt="${objtoolopt} --retpoline"141 objtoolopt="${objtoolopt} --retpoline"
138 fi142 fi
139 if [ -n "${CONFIG_X86_SMAP}" ]; then143 if is_enabled CONFIG_X86_SMAP; then
140 objtoolopt="${objtoolopt} --uaccess"144 objtoolopt="${objtoolopt} --uaccess"
141 fi145 fi
142 if [ -n "${CONFIG_SLS}" ]; then146 if is_enabled CONFIG_SLS; then
143 objtoolopt="${objtoolopt} --sls"147 objtoolopt="${objtoolopt} --sls"
144 fi148 fi
145 info OBJTOOL ${1}149 info OBJTOOL ${1}
@@ -164,7 +168,7 @@ vmlinux_link() · 18 unmodified lines
164 # skip output file argument168 # skip output file argument
165 shift169 shift
166 170
167 if [ -n "${CONFIG_LTO_CLANG}" ]; then171 if is_enabled CONFIG_LTO_CLANG; then
168 # Use vmlinux.o instead of performing the slow LTO link again.172 # Use vmlinux.o instead of performing the slow LTO link again.
169 objs=vmlinux.o173 objs=vmlinux.o
170 libs=174 libs=
@@ -192,7 +196,7 @@ vmlinux_link() · 21 unmodified lines
192 ldflags="${ldflags} ${wl}--strip-debug"196 ldflags="${ldflags} ${wl}--strip-debug"
193 fi197 fi
194 198
195 if [ -n "${CONFIG_VMLINUX_MAP}" ]; then199 if is_enabled CONFIG_VMLINUX_MAP; then
196 ldflags="${ldflags} ${wl}-Map=${output}.map"200 ldflags="${ldflags} ${wl}-Map=${output}.map"
197 fi201 fi
198 202
@@ -242,15 +246,15 @@ kallsyms() · 43 unmodified lines
242{246{
243 local kallsymopt;247 local kallsymopt;
244 248
245 if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then249 if is_enabled CONFIG_KALLSYMS_ALL; then
246 kallsymopt="${kallsymopt} --all-symbols"250 kallsymopt="${kallsymopt} --all-symbols"
247 fi251 fi
248 252
249 if [ -n "${CONFIG_KALLSYMS_ABSOLUTE_PERCPU}" ]; then253 if is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU; then
250 kallsymopt="${kallsymopt} --absolute-percpu"254 kallsymopt="${kallsymopt} --absolute-percpu"
251 fi255 fi
252 256
253 if [ -n "${CONFIG_KALLSYMS_BASE_RELATIVE}" ]; then257 if is_enabled CONFIG_KALLSYMS_BASE_RELATIVE; then
254 kallsymopt="${kallsymopt} --base-relative"258 kallsymopt="${kallsymopt} --base-relative"
255 fi259 fi
256 260
@@ -315,9 +319,6 @@ if [ "$1" = "clean" ]; then · 58 unmodified lines
315 exit 0319 exit 0
316fi320fi
317 321
318# We need access to CONFIG_ symbols
319. include/config/auto.conf
320
321# Update version322# Update version
322info GEN .version323info GEN .version
323if [ -r .version ]; then324if [ -r .version ]; then
@@ -346,7 +347,7 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | · 22 unmodified lines
346 tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin347 tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin
347 348
348btf_vmlinux_bin_o=""349btf_vmlinux_bin_o=""
349if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then350if is_enabled CONFIG_DEBUG_INFO_BTF; then
350 btf_vmlinux_bin_o=.btf.vmlinux.bin.o351 btf_vmlinux_bin_o=.btf.vmlinux.bin.o
351 if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then352 if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then
352 echo >&2 "Failed to generate BTF for vmlinux"353 echo >&2 "Failed to generate BTF for vmlinux"
@@ -358,7 +359,7 @@ fi · 5 unmodified lines
358kallsymso=""359kallsymso=""
359kallsymso_prev=""360kallsymso_prev=""
360kallsyms_vmlinux=""361kallsyms_vmlinux=""
361if [ -n "${CONFIG_KALLSYMS}" ]; then362if is_enabled CONFIG_KALLSYMS; then
362 363
363 # kallsyms support364 # kallsyms support
364 # Generate section listing all symbols and add it into vmlinux365 # Generate section listing all symbols and add it into vmlinux
@@ -398,7 +399,7 @@ fi · 33 unmodified lines
398vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}399vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
399 400
400# fill in BTF IDs401# fill in BTF IDs
401if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then402if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
402 info BTFIDS vmlinux403 info BTFIDS vmlinux
403 ${RESOLVE_BTFIDS} vmlinux404 ${RESOLVE_BTFIDS} vmlinux
404fi405fi
@@ -406,7 +407,7 @@ fi · 1 unmodified line
406info SYSMAP System.map407info SYSMAP System.map
407mksysmap vmlinux System.map408mksysmap vmlinux System.map
408 409
409if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then410if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
410 info SORTTAB vmlinux411 info SORTTAB vmlinux
411 if ! sorttable vmlinux; then412 if ! sorttable vmlinux; then
412 echo >&2 Failed to sort kernel tables413 echo >&2 Failed to sort kernel tables
@@ -415,7 +416,7 @@ if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then · 2 unmodified lines
415fi416fi
416 417
417# step a (see comment above)418# step a (see comment above)
418if [ -n "${CONFIG_KALLSYMS}" ]; then419if is_enabled CONFIG_KALLSYMS; then
419 mksysmap ${kallsyms_vmlinux} .tmp_System.map420 mksysmap ${kallsyms_vmlinux} .tmp_System.map
420 421
421 if ! cmp -s System.map .tmp_System.map; then422 if ! cmp -s System.map .tmp_System.map; then
scripts/min-tool-version.sh+1−1
@@ -28,7 +28,7 @@ llvm) · 27 unmodified lines
28 if [ "$SRCARCH" = s390 ]; then28 if [ "$SRCARCH" = s390 ]; then
29 echo 13.0.029 echo 13.0.0
30 else30 else
31 echo 10.0.131 echo 11.0.0
32 fi32 fi
33 ;;33 ;;
34*)34*)
scripts/remove-stale-files+2−0
@@ -39,3 +39,5 @@ if [ -n "${building_out_of_srctree}" ]; then · 38 unmodified lines
39 rm -f arch/parisc/boot/compressed/${f}39 rm -f arch/parisc/boot/compressed/${f}
40 done40 done
41fi41fi
42
43rm -f scripts/extract-cert
scripts/setlocalversion+4−5
@@ -111,9 +111,7 @@ if $scm_only; then · 110 unmodified lines
111 exit111 exit
112fi112fi
113 113
114if test -e include/config/auto.conf; then114if ! test -e include/config/auto.conf; then
115 . include/config/auto.conf
116else
117 echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2115 echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
118 exit 1116 exit 1
119fi117fi
@@ -125,10 +123,11 @@ if test ! "$srctree" -ef .; then · 5 unmodified lines
125fi123fi
126 124
127# CONFIG_LOCALVERSION and LOCALVERSION (if set)125# CONFIG_LOCALVERSION and LOCALVERSION (if set)
128res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"126config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
127res="${res}${config_localversion}${LOCALVERSION}"
129 128
130# scm version string if not at a tagged commit129# scm version string if not at a tagged commit
131if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then130if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
132 # full scm version string131 # full scm version string
133 res="$res$(scm_version)"132 res="$res$(scm_version)"
134elif [ "${LOCALVERSION+set}" != "set" ]; then133elif [ "${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