From 4ab3b80159d4db63b902ef635d4b5e882911b2da Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Thu, 28 Jun 2018 16:39:50 -0700 Subject: kconfig: check for pkg-config on make {menu,n,g,x}config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each of 'make {menu,n,g,x}config' uses (needs) pkg-config to make sure that other required files are present and to determine build flags settings, but none of these check that pkg-config itself is present. Add a check for all 4 of these targets and update Documentation/process/changes.rst to mention 'pkg-config'. Fixes kernel bugzilla #77511: https://bugzilla.kernel.org/show_bug.cgi?id=77511 Signed-off-by: Randy Dunlap Cc: Bjørn Forsman Signed-off-by: Masahiro Yamada --- Documentation/process/changes.rst | 8 ++++++++ scripts/kconfig/Makefile | 1 + scripts/kconfig/check-pkgconfig.sh | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100644 scripts/kconfig/check-pkgconfig.sh diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index ddc029734b25..81930fe75a53 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst @@ -81,6 +81,14 @@ The build system has, as of 4.13, switched to using thin archives (`ar T`) rather than incremental linking (`ld -r`) for built-in.a intermediate steps. This requires binutils 2.20 or newer. +pkg-config +---------- + +The build system, as of 4.18, requires pkg-config to check for installed +kconfig tools and to determine flags settings for use in +'make {menu,n,g,x}config'. Previously pkg-config was being used but not +verified or documented. + Flex ---- diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index a3ac2c91331c..49edb9cc9410 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -215,6 +215,7 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c # check if necessary packages are available, and configure build flags define filechk_conf_cfg + $(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \ $(CONFIG_SHELL) $< endef diff --git a/scripts/kconfig/check-pkgconfig.sh b/scripts/kconfig/check-pkgconfig.sh new file mode 100644 index 000000000000..7a1c40bfb58c --- /dev/null +++ b/scripts/kconfig/check-pkgconfig.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Check for pkg-config presence + +if [ -z $(command -v pkg-config) ]; then + echo "'make *config' requires 'pkg-config'. Please install it." 1>&2 + exit 1 +fi -- cgit v1.2.3 From 693359f7ac9012778590a370d076b13db704255e Mon Sep 17 00:00:00 2001 From: Dirk Gouders Date: Tue, 3 Jul 2018 14:43:31 +0200 Subject: kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE Over time, the use of the flag SYMBOL_AUTO changed from initially marking three automatically generated symbols ARCH, KERNELRELEASE and UNAME_RELEASE to today's effect of protecting symbols from being written out. Currently, only symbols of type CHOICE and those with option defconf_list set have that flag set. Reflect that change in semantics in the flag's name. Signed-off-by: Dirk Gouders Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 4 ++-- scripts/kconfig/expr.h | 2 +- scripts/kconfig/gconf.c | 4 ++-- scripts/kconfig/menu.c | 2 +- scripts/kconfig/symbol.c | 2 +- scripts/kconfig/zconf.y | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 39e20974f4a3..d1216e4ade2f 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -397,7 +397,7 @@ int conf_read(const char *name) for_all_symbols(i, sym) { sym_calc_value(sym); - if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) + if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE)) continue; if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { /* check that calculated value agrees with saved value */ @@ -832,7 +832,7 @@ static int conf_split_config(void) res = 0; for_all_symbols(i, sym) { sym_calc_value(sym); - if ((sym->flags & SYMBOL_AUTO) || !sym->name) + if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) continue; if (sym->flags & SYMBOL_WRITE) { if (sym->flags & SYMBOL_DEF_AUTO) { diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index f63b41b0dd49..84a5199bb46b 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -141,7 +141,7 @@ struct symbol { #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ #define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */ #define SYMBOL_CHANGED 0x0400 /* ? */ -#define SYMBOL_AUTO 0x1000 /* value from environment variable */ +#define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */ #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ #define SYMBOL_WARNED 0x8000 /* warning has been issued */ diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 610c4ab54d76..a9e48cc7b50a 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -101,8 +101,8 @@ const char *dbg_sym_flags(int val) strcat(buf, "write/"); if (val & SYMBOL_CHANGED) strcat(buf, "changed/"); - if (val & SYMBOL_AUTO) - strcat(buf, "auto/"); + if (val & SYMBOL_NO_WRITE) + strcat(buf, "no_write/"); buf[strlen(buf) - 1] = '\0'; diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 379a119dcd1e..4cf15d449c05 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -212,7 +212,7 @@ void menu_add_option(int token, char *arg) sym_defconfig_list = current_entry->sym; else if (sym_defconfig_list != current_entry->sym) zconf_error("trying to redefine defconfig symbol"); - sym_defconfig_list->flags |= SYMBOL_AUTO; + sym_defconfig_list->flags |= SYMBOL_NO_WRITE; break; case T_OPT_ALLNOCONFIG_Y: current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y; diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 7c9a88e91cfa..869a5e8e87a5 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -463,7 +463,7 @@ void sym_calc_value(struct symbol *sym) } } - if (sym->flags & SYMBOL_AUTO) + if (sym->flags & SYMBOL_NO_WRITE) sym->flags &= ~SYMBOL_WRITE; if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 4b68272ebdb9..96081aa0fef0 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -265,7 +265,7 @@ symbol_option_arg: choice: T_CHOICE word_opt T_EOL { struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE); - sym->flags |= SYMBOL_AUTO; + sym->flags |= SYMBOL_NO_WRITE; menu_add_entry(sym); menu_add_expr(P_CHOICE, NULL, NULL); free($2); -- cgit v1.2.3 From 5accd7f3360e891bd552312515387dbaa2bb4bf3 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 5 Jul 2018 11:46:12 +0900 Subject: kconfig: handle format string before calling conf_message_callback() As you see in mconf.c and nconf.c, conf_message_callback() hooks are likely to end up with the boilerplate of vsnprintf(). Process the string format before calling conf_message_callback() so that it receives a simple string. Signed-off-by: Masahiro Yamada Reviewed-by: Dirk Gouders --- scripts/kconfig/confdata.c | 17 +++++++++++------ scripts/kconfig/lkc_proto.h | 2 +- scripts/kconfig/mconf.c | 9 +++------ scripts/kconfig/nconf.c | 7 ++----- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index d1216e4ade2f..629ad32d4708 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -43,16 +43,16 @@ static void conf_warning(const char *fmt, ...) conf_warnings++; } -static void conf_default_message_callback(const char *fmt, va_list ap) +static void conf_default_message_callback(const char *s) { printf("#\n# "); - vprintf(fmt, ap); + printf("%s", s); printf("\n#\n"); } -static void (*conf_message_callback) (const char *fmt, va_list ap) = +static void (*conf_message_callback)(const char *s) = conf_default_message_callback; -void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) +void conf_set_message_callback(void (*fn)(const char *s)) { conf_message_callback = fn; } @@ -60,10 +60,15 @@ void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) static void conf_message(const char *fmt, ...) { va_list ap; + char buf[4096]; + + if (!conf_message_callback) + return; va_start(ap, fmt); - if (conf_message_callback) - conf_message_callback(fmt, ap); + + vsnprintf(buf, sizeof(buf), fmt, ap); + conf_message_callback(buf); va_end(ap); } diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index a8b7a330587e..cf4510a2bdc7 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -10,7 +10,7 @@ int conf_write(const char *name); int conf_write_autoconf(void); bool conf_get_changed(void); void conf_set_changed_callback(void (*fn)(void)); -void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap)); +void conf_set_message_callback(void (*fn)(const char *s)); /* menu.c */ extern struct menu rootmenu; diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 5294ed159b98..b8f3b607962a 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -772,16 +772,13 @@ static void show_helptext(const char *title, const char *text) show_textbox(title, text, 0, 0); } -static void conf_message_callback(const char *fmt, va_list ap) +static void conf_message_callback(const char *s) { - char buf[PATH_MAX+1]; - - vsnprintf(buf, sizeof(buf), fmt, ap); if (save_and_exit) { if (!silent) - printf("%s", buf); + printf("%s", s); } else { - show_textbox(NULL, buf, 6, 60); + show_textbox(NULL, s, 6, 60); } } diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 97b78445584b..5cbdb92e11b3 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -1210,12 +1210,9 @@ static void conf(struct menu *menu) } } -static void conf_message_callback(const char *fmt, va_list ap) +static void conf_message_callback(const char *s) { - char buf[1024]; - - vsnprintf(buf, sizeof(buf), fmt, ap); - btn_dialog(main_window, buf, 1, ""); + btn_dialog(main_window, s, 1, ""); } static void show_help(struct menu *menu) -- cgit v1.2.3 From 08b220b37ffe9ae8f2f0fe4618d03f7c25805fb3 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 18 Jul 2018 22:46:36 -0700 Subject: kconfig: fix typos in description of "choice" in kconfig-language.txt Fix a couple of punctuation "typos" in the description of the "choice" keyword. Signed-off-by: Randy Dunlap Signed-off-by: Masahiro Yamada --- Documentation/kbuild/kconfig-language.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 64e0775a62d4..c54cb7cb9ff4 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt @@ -370,7 +370,7 @@ choices: This defines a choice group and accepts any of the above attributes as options. A choice can only be of type bool or tristate. If no type is -specified for a choice, it's type will be determined by the type of +specified for a choice, its type will be determined by the type of the first choice element in the group or remain unknown if none of the choice elements have a type specified, as well. @@ -384,7 +384,7 @@ A choice accepts another option "optional", which allows to set the choice to 'n' and no entry needs to be selected. If no [symbol] is associated with a choice, then you can not have multiple definitions of that choice. If a [symbol] is associated to the choice, -then you may define the same choice (ie. with the same entries) in another +then you may define the same choice (i.e. with the same entries) in another place. comment: -- cgit v1.2.3 From a2ff4040151ace5be20e4de34220468b9e842e4d Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:26 +0900 Subject: kconfig: rename file_write_dep and move it to confdata.c file_write_dep() is called only from conf_write_autoconf(). Move it from util.c to confdata.c to make it static. Also, rename it to conf_write_dep() since it should belong to the group of conf_write* functions. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 31 ++++++++++++++++++++++++++++++- scripts/kconfig/lkc.h | 1 - scripts/kconfig/util.c | 30 ------------------------------ 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 629ad32d4708..c553f1f30c36 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -818,6 +818,35 @@ next: return 0; } +/* write a dependency file as used by kbuild to track dependencies */ +static int conf_write_dep(const char *name) +{ + struct file *file; + FILE *out; + + if (!name) + name = ".kconfig.d"; + out = fopen("..config.tmp", "w"); + if (!out) + return 1; + fprintf(out, "deps_config := \\\n"); + for (file = file_list; file; file = file->next) { + if (file->next) + fprintf(out, "\t%s \\\n", file->name); + else + fprintf(out, "\t%s\n", file->name); + } + fprintf(out, "\n%s: \\\n" + "\t$(deps_config)\n\n", conf_get_autoconfig_name()); + + env_write_dep(out, conf_get_autoconfig_name()); + + fprintf(out, "\n$(deps_config): ;\n"); + fclose(out); + rename("..config.tmp", name); + return 0; +} + static int conf_split_config(void) { const char *name; @@ -940,7 +969,7 @@ int conf_write_autoconf(void) sym_clear_all_valid(); - file_write_dep("include/config/auto.conf.cmd"); + conf_write_dep("include/config/auto.conf.cmd"); if (conf_split_config()) return 1; diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index ed3ff88e60ba..6b7bbc6238e3 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -97,7 +97,6 @@ void menu_set_type(int type); /* util.c */ struct file *file_lookup(const char *name); -int file_write_dep(const char *name); void *xmalloc(size_t size); void *xcalloc(size_t nmemb, size_t size); void *xrealloc(void *p, size_t size); diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index a365594770d9..d999683bb2a7 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -29,36 +29,6 @@ struct file *file_lookup(const char *name) return file; } -/* write a dependency file as used by kbuild to track dependencies */ -int file_write_dep(const char *name) -{ - struct file *file; - FILE *out; - - if (!name) - name = ".kconfig.d"; - out = fopen("..config.tmp", "w"); - if (!out) - return 1; - fprintf(out, "deps_config := \\\n"); - for (file = file_list; file; file = file->next) { - if (file->next) - fprintf(out, "\t%s \\\n", file->name); - else - fprintf(out, "\t%s\n", file->name); - } - fprintf(out, "\n%s: \\\n" - "\t$(deps_config)\n\n", conf_get_autoconfig_name()); - - env_write_dep(out, conf_get_autoconfig_name()); - - fprintf(out, "\n$(deps_config): ;\n"); - fclose(out); - rename("..config.tmp", name); - return 0; -} - - /* Allocate initial growable string */ struct gstr str_new(void) { -- cgit v1.2.3 From 0608182ad54293f6f617c1cc9fb34467db5515c7 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:27 +0900 Subject: kconfig: split out useful helpers in confdata.c Split out helpers: is_present() - check if the given path exists is_dir() - check if the given path exists and it is a directory make_parent_dir() - create the parent directories of the given path These helpers will be reused in later commits. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 81 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index c553f1f30c36..88429d723c9c 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -16,6 +16,64 @@ #include "lkc.h" +/* return true if 'path' exists, false otherwise */ +static bool is_present(const char *path) +{ + struct stat st; + + return !stat(path, &st); +} + +/* return true if 'path' exists and it is a directory, false otherwise */ +static bool is_dir(const char *path) +{ + struct stat st; + + if (stat(path, &st)) + return 0; + + return S_ISDIR(st.st_mode); +} + +/* + * Create the parent directory of the given path. + * + * For example, if 'include/config/auto.conf' is given, create 'include/config'. + */ +static int make_parent_dir(const char *path) +{ + char tmp[PATH_MAX + 1]; + char *p; + + strncpy(tmp, path, sizeof(tmp)); + tmp[sizeof(tmp) - 1] = 0; + + /* Remove the base name. Just return if nothing is left */ + p = strrchr(tmp, '/'); + if (!p) + return 0; + *(p + 1) = 0; + + /* Just in case it is an absolute path */ + p = tmp; + while (*p == '/') + p++; + + while ((p = strchr(p, '/'))) { + *p = 0; + + /* skip if the directory exists */ + if (!is_dir(tmp) && mkdir(tmp, 0755)) + return -1; + + *p = '/'; + while (*p == '/') + p++; + } + + return 0; +} + struct conf_printer { void (*print_symbol)(FILE *, struct symbol *, const char *, void *); void (*print_comment)(FILE *, const char *, void *); @@ -88,7 +146,6 @@ const char *conf_get_autoconfig_name(void) char *conf_get_default_confname(void) { - struct stat buf; static char fullname[PATH_MAX+1]; char *env, *name; @@ -96,7 +153,7 @@ char *conf_get_default_confname(void) env = getenv(SRCTREE); if (env) { sprintf(fullname, "%s/%s", env, name); - if (!stat(fullname, &buf)) + if (is_present(fullname)) return fullname; } return name; @@ -730,10 +787,9 @@ int conf_write(const char *name) dirname[0] = 0; if (name && name[0]) { - struct stat st; char *slash; - if (!stat(name, &st) && S_ISDIR(st.st_mode)) { + if (is_dir(name)) { strcpy(dirname, name); strcat(dirname, "/"); basename = conf_get_configname(); @@ -853,7 +909,6 @@ static int conf_split_config(void) char path[PATH_MAX+1]; char *s, *d, c; struct symbol *sym; - struct stat sb; int res, i, fd; name = conf_get_autoconfig_name(); @@ -931,18 +986,10 @@ static int conf_split_config(void) res = 1; break; } - /* - * Create directory components, - * unless they exist already. - */ - d = path; - while ((d = strchr(d, '/'))) { - *d = 0; - if (stat(path, &sb) && mkdir(path, 0755)) { - res = 1; - goto out; - } - *d++ = '/'; + + if (make_parent_dir(path)) { + res = 1; + goto out; } /* Try it again. */ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); -- cgit v1.2.3 From adc18acf42a1e738c4c58090e0efe7977e812779 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:28 +0900 Subject: kconfig: remove unneeded directory generation from local*config Commit 17263baf958b ("kconfig: Create include/generated for localmodconfig") added the 'mkdir' line because local{yes,mod}config ran streamline_config.pl followed by silentoldconfig at that time. Since commit 81d2bc227305 ("kconfig: invoke oldconfig instead of silentoldconfig from local*config"), no sub-directory is required. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 49edb9cc9410..bd8da651c814 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -41,7 +41,6 @@ syncconfig: $(obj)/conf $< $(silent) --$@ $(Kconfig) localyesconfig localmodconfig: $(obj)/conf - $(Q)mkdir -p include/config include/generated $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \ cmp -s .tmp.config .config || \ -- cgit v1.2.3 From 79123b1389cc775d8e60cb026256f79f0daef173 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:29 +0900 Subject: kconfig: create directories needed for syncconfig by itself 'make syncconfig' creates some files such as include/config/auto.conf, include/generate/autoconf.h, etc. but the necessary directory creation relies on scripts/kconfig/Makefile. To make Kconfig self-contained, create directories as needed in conf_write_autoconf(). This change allows scripts/kconfig/Makefile cleanups; syncconfig can be merged into simple-targets. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 15 ++++++--------- scripts/kconfig/confdata.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index bd8da651c814..7f3eeca27ed4 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -3,8 +3,7 @@ # Kernel configuration targets # These targets are used from top-level makefile -PHONY += xconfig gconfig menuconfig config syncconfig \ - localmodconfig localyesconfig +PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) @@ -34,12 +33,6 @@ config: $(obj)/conf nconfig: $(obj)/nconf $< $(silent) $(Kconfig) -# This has become an internal implementation detail and is now deprecated -# for external use. -syncconfig: $(obj)/conf - $(Q)mkdir -p include/config include/generated - $< $(silent) --$@ $(Kconfig) - localyesconfig localmodconfig: $(obj)/conf $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \ @@ -55,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf $(Q)rm -f .tmp.config # These targets map 1:1 to the commandline options of 'conf' +# +# Note: +# syncconfig has become an internal implementation detail and is now +# deprecated for external use simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ - alldefconfig randconfig listnewconfig olddefconfig + alldefconfig randconfig listnewconfig olddefconfig syncconfig PHONY += $(simple-targets) $(simple-targets): $(obj)/conf diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 88429d723c9c..fad403dfa508 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -899,6 +899,9 @@ static int conf_write_dep(const char *name) fprintf(out, "\n$(deps_config): ;\n"); fclose(out); + + if (make_parent_dir(name)) + return 1; rename("..config.tmp", name); return 0; } @@ -915,6 +918,8 @@ static int conf_split_config(void) conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); + if (make_parent_dir("include/config/foo.h")) + return 1; if (chdir("include/config")) return 1; @@ -991,6 +996,7 @@ static int conf_split_config(void) res = 1; goto out; } + /* Try it again. */ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd == -1) { @@ -1063,14 +1069,22 @@ int conf_write_autoconf(void) name = getenv("KCONFIG_AUTOHEADER"); if (!name) name = "include/generated/autoconf.h"; + if (make_parent_dir(name)) + return 1; if (rename(".tmpconfig.h", name)) return 1; + name = getenv("KCONFIG_TRISTATE"); if (!name) name = "include/config/tristate.conf"; + if (make_parent_dir(name)) + return 1; if (rename(".tmpconfig_tristate", name)) return 1; + name = conf_get_autoconfig_name(); + if (make_parent_dir(name)) + return 1; /* * This must be the last step, kbuild has a dependency on auto.conf * and this marks the successful completion of the previous steps. -- cgit v1.2.3 From 16952b77d8b542fe5f3d73065a50842885b2ba0b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:30 +0900 Subject: kconfig: make syncconfig update .config regardless of sym_change_count syncconfig updates the .config only when sym_change_count > 0, i.e. any change in config symbols has been detected. Not only symbols but also comments are contained in the .config file. If only comments are updated, they are not fed back to the .config, then the stale comments are left-over. Of course, this is just a matter of comments, but why not fix it. I see some scenarios where this happens. Scenario A: 1. You have a source tree that has already been configured. 2. Linus increments the version number in the top-level Makefile (i.e. he commits a new release) 3. You pull it, and run 'make' 4. syncconfig is invoked because the environment variable, KERNELVERSION is updated, but the .config is not updated since no config symbol is changed. 5. The .config file contains a kernel version in the top line: # Automatically generated file; DO NOT EDIT. # Linux/arm64 4.18.0-rc2 Kernel Configuration ... which points to a previous version. Scenario B: 1. You have a source tree that has already been configured. 2. You upgrade the compiler, but it still has the same version number. This may happen if you regularly build the latest compiler from the source code. 3. You run 'make' 4. syncconfig is invoked because the environment variable, CC_VERSION_TEXT is updated, but the .config is not updated since no config symbol is changed. 5. The .config file contains the version string of the compiler: # # Compiler: aarch64-linux-gcc (GCC) 9.0.0 20180628 (experimental) # ... which carries the information of the old compiler. If KCONFIG_NOSILENTUPDATE is set, syncconfig is not allowed to update the .config file. Otherwise, it is fine to update it regardless of sym_change_count. Signed-off-by: Masahiro Yamada --- scripts/kconfig/conf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 671ff5364497..5af899112cae 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -496,6 +496,7 @@ int main(int ac, char **av) int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; + int no_conf_write = 0; tty_stdio = isatty(0) && isatty(1); @@ -633,13 +634,14 @@ int main(int ac, char **av) } if (sync_kconfig) { - if (conf_get_changed()) { - name = getenv("KCONFIG_NOSILENTUPDATE"); - if (name && *name) { + name = getenv("KCONFIG_NOSILENTUPDATE"); + if (name && *name) { + if (conf_get_changed()) { fprintf(stderr, "\n*** The configuration requires explicit update.\n\n"); return 1; } + no_conf_write = 1; } } @@ -688,7 +690,7 @@ int main(int ac, char **av) /* syncconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ - if (conf_get_changed() && conf_write(NULL)) { + if (!no_conf_write && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } -- cgit v1.2.3 From 00c864f8903dd357471e8ee48f4d57aaa9a1a0de Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:31 +0900 Subject: kconfig: allow all config targets to write auto.conf if missing Currently, only syncconfig creates or updates include/config/auto.conf and some other files. Other config targets create or update only the .config file. When you configure and build the kernel from a pristine source tree, any config target is followed by syncconfig in the build stage since include/config/auto.conf is missing. We are moving compiler tests from Makefile to Kconfig. It means that parsing Kconfig files will be more costly since Kconfig invokes the compiler commands internally. Thus, we want to avoid invoking Kconfig twice (one for *config to create the .config, and one for syncconfig to synchronize the auto.conf). If auto.conf does not exist, we can generate all configuration files in the first configuration stage, which will save the syncconfig in the build stage. Please note this should be done only when auto.conf is missing. If *config blindly did this, time stamp files under include/config/ would be unnecessarily touched, triggering unneeded rebuild of objects. I assume a scenario like this: 1. You have a source tree that has already been built with CONFIG_FOO disabled 2. Run "make menuconfig" to enable CONFIG_FOO 3. CONFIG_FOO turns out to be unnecessary. Run "make menuconfig" again to disable CONFIG_FOO 4. Run "make" In this case, include/config/foo.h should not be touched since there is no change in CONFIG_FOO. The sync process should be delayed until the user really attempts to build the kernel. This commit has another motivation; I want to suppress the 'No such file or directory' warning from the 'include' directive. The top-level Makefile includes auto.conf with '-include' directive, like this: ifeq ($(dot-config),1) -include include/config/auto.conf endif This looks strange because auto.conf is mandatory when dot-config is 1. I guess only the reason of using '-include' is to suppress the warning 'include/config/auto.conf: No such file or directory' when building from a clean tree. However, this has a side-effect; Make considers the files included by '-include' are optional. Hence, Make continues to build even if it fails to generate include/config/auto.conf. I will change this in the next commit, but the warning message is annoying. (At least, kbuild test robot reports it as a regression.) With this commit, Kconfig will generate all configuration files together with the .config and I guess it is a solution good enough to suppress the warning. Note: GNU Make 4.2 or later does not display the warning from the 'include' directive if include files are successfully generated. See GNU Make commit 87a5f98d248f ("[SV 102] Don't show unnecessary include file errors.") However, older GNU Make versions are still widely used. Signed-off-by: Masahiro Yamada --- scripts/kconfig/conf.c | 31 +++++++++++++++++-------------- scripts/kconfig/confdata.c | 11 +++++++---- scripts/kconfig/gconf.c | 1 + scripts/kconfig/lkc_proto.h | 2 +- scripts/kconfig/mconf.c | 1 + scripts/kconfig/nconf.c | 1 + scripts/kconfig/qconf.cc | 2 ++ 7 files changed, 30 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 5af899112cae..b35cc9303979 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -686,29 +686,32 @@ int main(int ac, char **av) break; } - if (sync_kconfig) { - /* syncconfig is used during the build so we shall update autoconf. - * All other commands are only used to generate a config. - */ - if (!no_conf_write && conf_write(NULL)) { - fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); - exit(1); - } - if (conf_write_autoconf()) { - fprintf(stderr, "\n*** Error during update of the configuration.\n\n"); - return 1; - } - } else if (input_mode == savedefconfig) { + if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n", defconfig_file); return 1; } } else if (input_mode != listnewconfig) { - if (conf_write(NULL)) { + if (!no_conf_write && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } + + /* + * Create auto.conf if it does not exist. + * This prevents GNU Make 4.1 or older from emitting + * "include/config/auto.conf: No such file or directory" + * in the top-level Makefile + * + * syncconfig always creates or updates auto.conf because it is + * used during the build. + */ + if (conf_write_autoconf(sync_kconfig) && sync_kconfig) { + fprintf(stderr, + "\n*** Error during sync of the configuration.\n\n"); + return 1; + } } return 0; } diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index fad403dfa508..91d0a5c014ac 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -1013,13 +1013,17 @@ out: return res; } -int conf_write_autoconf(void) +int conf_write_autoconf(int overwrite) { struct symbol *sym; const char *name; + const char *autoconf_name = conf_get_autoconfig_name(); FILE *out, *tristate, *out_h; int i; + if (!overwrite && is_present(autoconf_name)) + return 0; + sym_clear_all_valid(); conf_write_dep("include/config/auto.conf.cmd"); @@ -1082,14 +1086,13 @@ int conf_write_autoconf(void) if (rename(".tmpconfig_tristate", name)) return 1; - name = conf_get_autoconfig_name(); - if (make_parent_dir(name)) + if (make_parent_dir(autoconf_name)) return 1; /* * This must be the last step, kbuild has a dependency on auto.conf * and this marks the successful completion of the previous steps. */ - if (rename(".tmpconfig", name)) + if (rename(".tmpconfig", autoconf_name)) return 1; return 0; diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index a9e48cc7b50a..36f578415c4a 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -525,6 +525,7 @@ void on_save_activate(GtkMenuItem * menuitem, gpointer user_data) { if (conf_write(NULL)) text_insert_msg("Error", "Unable to save configuration !"); + conf_write_autoconf(0); } diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index cf4510a2bdc7..86c267540ccc 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -7,7 +7,7 @@ int conf_read(const char *name); int conf_read_simple(const char *name, int); int conf_write_defconfig(const char *name); int conf_write(const char *name); -int conf_write_autoconf(void); +int conf_write_autoconf(int overwrite); bool conf_get_changed(void); void conf_set_changed_callback(void (*fn)(void)); void conf_set_message_callback(void (*fn)(const char *s)); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index b8f3b607962a..83b5836615fb 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -974,6 +974,7 @@ static int handle_exit(void) "\n\n"); return 1; } + conf_write_autoconf(0); /* fall through */ case -1: if (!silent) diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 5cbdb92e11b3..1ef232ae5ab9 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -674,6 +674,7 @@ static int do_exit(void) "Your configuration changes were NOT saved.", 1, ""); + conf_write_autoconf(0); break; default: btn_dialog( diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index ad9c22dd04f5..62261b3a13c7 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1535,6 +1535,8 @@ bool ConfigMainWindow::saveConfig(void) QMessageBox::information(this, "qconf", "Unable to save configuration!"); return false; } + conf_write_autoconf(0); + return true; } -- cgit v1.2.3 From 0a16d2e8cb7e6310debc208d42ff725361ae1911 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:32 +0900 Subject: kbuild: use 'include' directive to load auto.conf from top Makefile When you build targets that require the kernel configuration, dot-config is set to 1, then the top-level Makefile includes auto.conf. However, Make considers its inclusion is optional because the '-include' directive is used here. If a necessary configuration file is missing for the external module building, the following error message is displayed: ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it. However, Make still continues building; /bin/false let the creation of 'include/config/auto.config' fail, but Make can ignore the error since it is included by the '-include' directive. I guess the reason of using '-include' directive was to suppress the warning when you build the kernel from a pristine source tree: Makefile:605: include/config/auto.conf: No such file or directory The previous commit made sure include/config/auto.conf exists after the 'make *config' stage. Now, we can use the 'include' directive without showing the warning. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a89d8a0d3ee1..6a222e21ca6d 100644 --- a/Makefile +++ b/Makefile @@ -584,7 +584,7 @@ virt-y := virt/ endif # KBUILD_EXTMOD ifeq ($(dot-config),1) --include include/config/auto.conf +include include/config/auto.conf endif # The all: target is the default when no target is given on the -- cgit v1.2.3 From 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:33 +0900 Subject: kbuild: add .DELETE_ON_ERROR special target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If Make gets a fatal signal while a shell is executing, it may delete the target file that the recipe was supposed to update. This is needed to make sure that it is remade from scratch when Make is next run; if Make is interrupted after the recipe has begun to write the target file, it results in an incomplete file whose time stamp is newer than that of the prerequisites files. Make automatically deletes the incomplete file on interrupt unless the target is marked .PRECIOUS. The situation is just the same as when the shell fails for some reasons. Usually when a recipe line fails, if it has changed the target file at all, the file is corrupted, or at least it is not completely updated. Yet the file’s time stamp says that it is now up to date, so the next time Make runs, it will not try to update that file. However, Make does not cater to delete the incomplete target file in this case. We need to add .DELETE_ON_ERROR somewhere in the Makefile to request it. scripts/Kbuild.include seems a suitable place to add it because it is included from almost all sub-makes. Please note .DELETE_ON_ERROR is not effective for phony targets. The external module building should never ever touch the kernel tree. The following recipe fails if include/generated/autoconf.h is missing. However, include/config/auto.conf is not deleted since it is a phony target. PHONY += include/config/auto.conf include/config/auto.conf: $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or $@ are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 86321f06461e..ed303f552f9d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -400,3 +400,6 @@ endif endef # ############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: -- cgit v1.2.3 From d79424137a7312d381d131d707a462440c0e8df9 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:34 +0900 Subject: kbuild: do not update config when running install targets "make syncconfig" is automatically invoked when any of the following happens: - .config is updated - any of Kconfig files is updated - any of environment variables referenced in Kconfig is changed Then, it updates configuration files such as include/config/auto.conf include/generated/autoconf.h, etc. Even install targets (install, modules_install, etc.) are no exception. However, they should never ever modify the source tree. Install targets are often run with root privileges. Once those configuration files are owned by root, "make mrproper" would end up with permission error. Install targets should just copy things blindly. They should not care whether the configuration is up-to-date or not. This makes more sense because we are interested in the configuration that was used in the previous kernel building. This issue has existed since before, but rarely happened. I expect more chance where people are hit by this; with the new Kconfig syntax extension, the .config now contains the compiler information. If you cross-compile the kernel with CROSS_COMPILE, but forget to pass it for "make install", you meet "any of environment variables referenced in Kconfig is changed" because $(CC) is referenced in Kconfig. Another scenario is the compiler upgrade before the installation. Install targets need the configuration. "make modules_install" refer to CONFIG_MODULES etc. "make dtbs_install" also needs CONFIG_ARCH_* to decide which dtb files to install. However, the auto-update of the configuration files should be avoided. We already do this for external modules. Now, Make targets are categorized into 3 groups: [1] Do not need the kernel configuration at all help, coccicheck, headers_install etc. [2] Need the latest kernel configuration If new config options are added, Kconfig will show prompt to ask user's selection. Build targets such as vmlinux, in-kernel modules are the cases. [3] Need the kernel configuration, but do not want to update it Install targets except headers_install, and external modules are the cases. Signed-off-by: Masahiro Yamada --- Makefile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6a222e21ca6d..8ca9e0b114f1 100644 --- a/Makefile +++ b/Makefile @@ -225,10 +225,12 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg +no-sync-config-targets := $(no-dot-config-targets) install %install -config-targets := 0 -mixed-targets := 0 -dot-config := 1 +config-targets := 0 +mixed-targets := 0 +dot-config := 1 +may-sync-config := 1 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) @@ -236,6 +238,16 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) endif endif +ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) + may-sync-config := 0 + endif +endif + +ifneq ($(KBUILD_EXTMOD),) + may-sync-config := 0 +endif + ifeq ($(KBUILD_EXTMOD),) ifneq ($(filter config %config,$(MAKECMDGOALS)),) config-targets := 1 @@ -606,7 +618,7 @@ ARCH_CFLAGS := include arch/$(SRCARCH)/Makefile ifeq ($(dot-config),1) -ifeq ($(KBUILD_EXTMOD),) +ifeq ($(may-sync-config),1) # Read in dependencies to all Kconfig* files, make sure to run syncconfig if # changes are detected. This should be included after arch/$(SRCARCH)/Makefile # because some architectures define CROSS_COMPILE there. @@ -621,8 +633,9 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else -# external modules needs include/generated/autoconf.h and include/config/auto.conf -# but do not care if they are up-to-date. Use auto.conf to trigger the test +# External modules and some install targets need include/generated/autoconf.h +# and include/config/auto.conf but do not care if they are up-to-date. +# Use auto.conf to trigger the test PHONY += include/config/auto.conf include/config/auto.conf: @@ -634,7 +647,7 @@ include/config/auto.conf: echo >&2 ; \ /bin/false) -endif # KBUILD_EXTMOD +endif # may-sync-config else # Dummy target needed, because used as prerequisite -- cgit v1.2.3 From a29d4d8c5669a658b5a091b38205c13084967ce7 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:35 +0900 Subject: kbuild: do not update config for 'make kernelrelease' 'make kernelrelease' depends on CONFIG_LOCALVERSION(_AUTO), but for the same reason as install targets, we do not want to update the configuration just for printing the kernelrelease string. This is likely to happen when you compiled the kernel with CROSS_COMPILE, but forget to pass it to 'make kernelrelease'. Signed-off-by: Masahiro Yamada --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8ca9e0b114f1..060874d85e0d 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,8 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg -no-sync-config-targets := $(no-dot-config-targets) install %install +no-sync-config-targets := $(no-dot-config-targets) install %install \ + kernelrelease config-targets := 0 mixed-targets := 0 -- cgit v1.2.3 From 2063945fdc3d4c0ac8f9319d942eda720d02aabe Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 20 Jul 2018 16:46:36 +0900 Subject: kbuild: remove auto.conf from prerequisite of phony targets The top-level Makefile adds include/config/auto.conf as prerequisites of 'scripts', 'prepare1', etc. They were needed to terminate the build when include/config/auto.conf is missing. Now that the inclusion of include/config/auto.conf is mandatory in the top-level Makefile if dot-config is 1 (Note 'include' directive is used instead of '-include'). Make terminates the build by itself if it fails to create or update include/config/auto.conf so we are sure that include/config/auto.conf exists in the very first stage of make. I am still keeping include/config/auto.conf as the prerequisite of %/modules.builtin because modules.builtin is a real file. According to commit a6c366324cac ("kbuild: Do not unnecessarily regenerate modules.builtin"), it is intentional to compare time-stamps between %/modules.builtin and include/config/auto.conf . I moved tristate.conf here because it is only included from scripts/Makefile.modbuiltin. Signed-off-by: Masahiro Yamada --- Makefile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 060874d85e0d..f17dd994e01d 100644 --- a/Makefile +++ b/Makefile @@ -649,10 +649,6 @@ include/config/auto.conf: /bin/false) endif # may-sync-config - -else -# Dummy target needed, because used as prerequisite -include/config/auto.conf: ; endif # $(dot-config) KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) @@ -1047,15 +1043,14 @@ define filechk_kernel.release endef # Store (new) KERNELRELEASE string in include/config/kernel.release -include/config/kernel.release: include/config/auto.conf FORCE +include/config/kernel.release: $(srctree)/Makefile FORCE $(call filechk,kernel.release) # Additional helpers built in scripts/ # Carefully list dependencies so we do not try to build scripts twice # in parallel PHONY += scripts -scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ - asm-generic gcc-plugins $(autoksyms_h) +scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h) $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel @@ -1085,8 +1080,7 @@ endif # that need to depend on updated CONFIG_* values can be checked here. prepare2: prepare3 outputmakefile asm-generic -prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ - include/config/auto.conf +prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h $(cmd_crmodverdir) archprepare: archheaders archscripts prepare1 scripts_basic @@ -1224,7 +1218,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin -%/modules.builtin: include/config/auto.conf +%/modules.builtin: include/config/auto.conf include/config/tristate.conf $(Q)$(MAKE) $(modbuiltin)=$* -- cgit v1.2.3 From b5cdca7361d083638dc7f422fe8e1ae77860f6a6 Mon Sep 17 00:00:00 2001 From: Dirk Gouders Date: Thu, 2 Aug 2018 15:47:08 +0200 Subject: Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory The files auto.conf and tristate.conf are mandatory for building modules.builtin files, therefore include them as such. Usually, the top-level Makefile ensures that those files exist but we want to make sure we get noticed if they are missing for whatever reason. Signed-off-by: Dirk Gouders Signed-off-by: Masahiro Yamada --- scripts/Makefile.modbuiltin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index 40867a41615b..a072a4267746 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin @@ -8,10 +8,10 @@ src := $(obj) PHONY := __modbuiltin __modbuiltin: --include include/config/auto.conf +include include/config/auto.conf # tristate.conf sets tristate variables to uppercase 'Y' or 'M' # That way, we get the list of built-in modules in obj-Y --include include/config/tristate.conf +include include/config/tristate.conf include scripts/Kbuild.include -- cgit v1.2.3 From 47f38ae08df0aebb0e43fca50bf380aefea1f4d1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 8 Aug 2018 13:06:43 +0900 Subject: init/Kconfig: Use short unix-style option instead of --longname Avoids warning messages with the latest release of toybox, which never bothered to implement the --longopts nothing was using. Signed-off-by: Rob Landley Signed-off-by: Masahiro Yamada --- init/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 041f3a022122..192d4006d57a 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2,9 +2,9 @@ config DEFCONFIG_LIST string depends on !UML option defconfig_list - default "/lib/modules/$(shell,uname --release)/.config" + default "/lib/modules/$(shell,uname -r)/.config" default "/etc/kernel-config" - default "/boot/config-$(shell,uname --release)" + default "/boot/config-$(shell,uname -r)" default ARCH_DEFCONFIG default "arch/$(ARCH)/defconfig" -- cgit v1.2.3 From 56869d45e364244a721de34ce9c5dc9ed022779e Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 9 Aug 2018 15:47:06 +0900 Subject: kconfig: fix the rule of mainmenu_stmt symbol The rule of mainmenu_stmt does not have debug print of zconf_lineno(), but if it had, it would print a wrong line number for the same reason as commit b2d00d7c61c8 ("kconfig: fix line numbers for if-entries in menu tree"). The mainmenu_stmt does not need to eat following empty lines because they are reduced to common_stmt. Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 96081aa0fef0..22fceb264cf5 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; static struct menu *current_menu, *current_entry; %} -%expect 31 +%expect 30 %union { @@ -117,7 +117,7 @@ start: mainmenu_stmt stmt_list | stmt_list; /* mainmenu entry */ -mainmenu_stmt: T_MAINMENU prompt nl +mainmenu_stmt: T_MAINMENU prompt T_EOL { menu_add_prompt(P_MENU, $2, NULL); }; -- cgit v1.2.3 From c151272d1687ce2a379a93bf848080f9a42f1cef Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 14 Aug 2018 01:48:38 +0900 Subject: kconfig: remove unused sym_get_env_prop() function This function is unused since commit 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='"). Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg --- scripts/kconfig/lkc.h | 1 - scripts/kconfig/symbol.c | 9 --------- 2 files changed, 10 deletions(-) diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 6b7bbc6238e3..9eb7c837cd8f 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -125,7 +125,6 @@ const char *sym_get_string_default(struct symbol *sym); struct symbol *sym_check_deps(struct symbol *sym); struct property *prop_alloc(enum prop_type type, struct symbol *sym); struct symbol *prop_get_symbol(struct property *prop); -struct property *sym_get_env_prop(struct symbol *sym); static inline tristate sym_get_tristate_value(struct symbol *sym) { diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 869a5e8e87a5..073d780f7ec9 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -76,15 +76,6 @@ struct property *sym_get_choice_prop(struct symbol *sym) return NULL; } -struct property *sym_get_env_prop(struct symbol *sym) -{ - struct property *prop; - - for_all_properties(sym, prop, P_ENV) - return prop; - return NULL; -} - static struct property *sym_get_default_prop(struct symbol *sym) { struct property *prop; -- cgit v1.2.3 From 1880861226c13ddd42c34ddd30c3b502b650fe29 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 14 Aug 2018 01:48:39 +0900 Subject: kconfig: remove P_ENV property type This property is not set by anyone since commit 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='"). Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg --- scripts/kconfig/expr.h | 1 - scripts/kconfig/qconf.cc | 1 - scripts/kconfig/symbol.c | 2 -- 3 files changed, 4 deletions(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 84a5199bb46b..7c329e179007 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -185,7 +185,6 @@ enum prop_type { P_SELECT, /* select BAR */ P_IMPLY, /* imply BAR */ P_RANGE, /* range 7..100 (for a symbol) */ - P_ENV, /* value from environment variable */ P_SYMBOL, /* where a symbol is defined */ }; diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 62261b3a13c7..ef4310f2558b 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1149,7 +1149,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym) case P_DEFAULT: case P_SELECT: case P_RANGE: - case P_ENV: debug += prop_get_type_name(prop->type); debug += ": "; expr_print(prop->expr, expr_print_help, &debug, E_NONE); diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 073d780f7ec9..4ec8b1f0d42c 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -1289,8 +1289,6 @@ const char *prop_get_type_name(enum prop_type type) switch (type) { case P_PROMPT: return "prompt"; - case P_ENV: - return "env"; case P_COMMENT: return "comment"; case P_MENU: -- cgit v1.2.3