From patchwork Fri Jul 20 07:46:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142439 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649844ljj; Fri, 20 Jul 2018 00:48:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeX4XE2KJp7X5JmHm7o8StMtqKZfbOiVTAFGHjRojbipcBbr+kvdC9FDejL64pUQw6RnMlu X-Received: by 2002:a17:902:7884:: with SMTP id q4-v6mr1065542pll.174.1532072895183; Fri, 20 Jul 2018 00:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072895; cv=none; d=google.com; s=arc-20160816; b=WBDM66yNAs1FqkobEdRTESEQr3cXVXWwK7aCaqirkWjxG6lwUxTSMx6eiAs7GPvjvL Y0NdphtjiNMKS932l9oIaAxcMKt3EwVyMN3XFQL/eB77BjuAgG+ZJ058o7Gmr87L0h4p Fp6x3AfreoDZExGj5lDLwdJvmocgPQ4frRGNtEsp/VL0UVM8KLIVzQkZsvIECdty9etT KUig+uCatzNX7Xc4er2wnPjANHZSRQboBOINwYhz0QCFgLH29PHCe31oINPtmXloW107 nMOUNs7vyWXOcJIw2QRRvigzQYRcB7LChxdvwq1mhQ95ORQilX1ePgra4XsuHWYMEWpK 9gLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=+vx41ZFtpKJwWZU71ii9pTSFQCyA/XRd3YVe6EEB2ys=; b=dS0rC7HKkX9zhe5CUaqzSIVkf2sv7HBSB9ikpbmJnCP69hhTQqJPYj1RyF+X/K/SqM uAhJqNDCOEgU4kuAWT2UV/EhhcRMzNuhfDaZbZ9cJ1+y0eoZx/zS8YufvOV8ZmopgFXN G7KeAQwGnyaC0AMFER4FCk9xFJ1tfzUgeVIAFcUsKdlYT5/znYpyDsNlrkreAFpyGbR8 CBJSZgWiAxTUZIewPRbPXaKkSHNzjRDRyKYGlLTTYv/V3w8yd4jdwTntv4zDB3qS5fo8 NUSTt3AtBN1lG10mqNZG+zkjw8sTUuGO0Cfgq823km1rMrpPv90F0QmHOalHqRVwgMkS 91Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=h95JPZ4v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si1305175pgs.243.2018.07.20.00.48.14; Fri, 20 Jul 2018 00:48:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=h95JPZ4v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728064AbeGTIfL (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:11 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28803 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727748AbeGTIfK (ORCPT ); Fri, 20 Jul 2018 04:35:10 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdir008048; Fri, 20 Jul 2018 16:46:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdir008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072800; bh=+vx41ZFtpKJwWZU71ii9pTSFQCyA/XRd3YVe6EEB2ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h95JPZ4v9qNh+9Rb8e94J5yrNyW5wNrmrKREXf1yjRzlhpdkLw4UfGy+UYRHDLjpT pqL4yN9ZXoAPACKUKa26qcm0ELXMuGkiDrLPP39EKlp6qqhC/gmDqaK9AFCVRlkF2j BAw4t7ll6vGsFzO8t0w3hWPiBNfbkOAeg4D6O5A6oTW4c1PP4HgIijiFJK4Pykub4E zXC6XNCpmdg4YJxSOP7j7ek7WQreTnyVPGPK9Ii0TBZnrahgKm/VlTbsK2+9FcZW1Q HVsRKHg0wPzaxX/Rye+4FzFvbpsIVpyEzwBCRhTUm0aLscIRBDa2cIH1vQTL5GG7fC YUzKzDkUgomRg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 01/11] kconfig: rename file_write_dep and move it to confdata.c Date: Fri, 20 Jul 2018 16:46:26 +0900 Message-Id: <1532072796-7947-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None scripts/kconfig/confdata.c | 31 ++++++++++++++++++++++++++++++- scripts/kconfig/lkc.h | 1 - scripts/kconfig/util.c | 30 ------------------------------ 3 files changed, 30 insertions(+), 32 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 39e2097..4771820 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -813,6 +813,35 @@ int conf_write(const char *name) 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; @@ -935,7 +964,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 ed3ff88..6b7bbc6 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 a365594..d999683 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) { From patchwork Fri Jul 20 07:46:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142444 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2650346ljj; Fri, 20 Jul 2018 00:48:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/XRh6N+qQjw3E8epqfL3cCZobZZ5/z6rA90C9phTwa2UEhAYR1ZmYJuT61MaVtTpzLeEx X-Received: by 2002:aa7:850b:: with SMTP id v11-v6mr1066961pfn.165.1532072933510; Fri, 20 Jul 2018 00:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072933; cv=none; d=google.com; s=arc-20160816; b=jVvCLTU+OAqbWaO7ncmmzZ6O91v8TZkLHBH5dYmLOs5T1JxeFfUYDD67hZAD3K3QjO 6YNc2f7+rIflIMlfJBxxsUEsP9mhKlQb5qL1rfTEyHT/WMP7XsADv1gNEfD2BDpl5XSJ Z+xPjzK1k72SfVr8nM5oH1Ce6KzLgo6W95GasPEJx7YCDx4GZS26zFehb3QhCRsCMeBm jDV8wWb3Wacp9P0CDbql5OEvkQTLZC0UdKiayMEvBFaeljdG0HRWk/c9IP3QA/DabAJO PoGq63vtCKVEJusIFaZHduIiy1lp7IixFV7nn4gnU79TNhwApEpAnLj4GMGjg2ULXZW1 juUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=cXR/OBQLPsG16WR6UwVtIB/snnTvNMrrUFnvALmkARg=; b=GzLd1Qry/ihUUejn5XeVP5ndASC5WFjVRhLU+Ft4VKB7FTfA20/boWuI4pvVFLaEZr D41BYxtAFKlATrFkvT4wkz79OUyDRg1FdjOJ/5JANJMnnlw39VyM73WN470hQxUr8tbT I0KgJPlLadZL8ndAZ9mtvI58Go0SHvOD+j6FjI3mOBoRZ7G7C3Ir4VKqNAjVZY48e1+0 K4+3S90JGqwBAJjK53S9I8hJXciYxrwIohw1iMT1x1YXSuNGP9qgDlpR1/WzHolaFrar b0GKvHHNnTiLwceY4oY0O3M4ca8/W2nopIiiDax2YuCScZAx6WuDSOVfpfxyL3+EgIXZ +SgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=UcL8gWzC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a74-v6si1305381pfe.301.2018.07.20.00.48.53; Fri, 20 Jul 2018 00:48:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=UcL8gWzC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728244AbeGTIfi (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:38 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28748 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727751AbeGTIfJ (ORCPT ); Fri, 20 Jul 2018 04:35:09 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdis008048; Fri, 20 Jul 2018 16:46:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdis008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072801; bh=cXR/OBQLPsG16WR6UwVtIB/snnTvNMrrUFnvALmkARg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcL8gWzC9sTxXnnqF9dzWETAmEk0id6CBhV3wg4JwqzzqlJbDyXBpLCK5P8Pj45rn 7m1nv//eGA5RtT+S/s8HF0q1g6ifgIN9C8hJdwXAW5GPqXS0FU3f0ya6g736BxCNna p9MrEOirfHGCfRPYTiPlMh/7aD2OSRx2i5nr5ELb+b5ERRyigafq1PDd8GmoRuLxmt gbGn9lthB3vmLAOOUJkTYDX+wwwHqyURst3DD/fTqdP3EkurV0ytNd6CvR9NtZcTeB JvsSHE6kWagGfpmaN23XOhCrocVXJDCrUQxKcAnP9BqCBqdJo1/uP0BXCxJWAhvFbc qDjw7GcVz/E+A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 02/11] kconfig: split out useful helpers in confdata.c Date: Fri, 20 Jul 2018 16:46:27 +0900 Message-Id: <1532072796-7947-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: - Rename mkdir_p() to make_parent_dir() for clarification - Add is_present() instead of is_file() scripts/kconfig/confdata.c | 81 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 17 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 4771820..f9c5ad4 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 *); @@ -83,7 +141,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; @@ -91,7 +148,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; @@ -725,10 +782,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(); @@ -848,7 +904,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(); @@ -926,18 +981,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); From patchwork Fri Jul 20 07:46:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142437 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649796ljj; Fri, 20 Jul 2018 00:48:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfinMNVolkC47Mf4VGOIP8Os/WVNHAwtuqq8QGyWu+8wxQF6K6PL/mjJluVmJ4+F48NBJpv X-Received: by 2002:a17:902:28a4:: with SMTP id f33-v6mr1022610plb.297.1532072891747; Fri, 20 Jul 2018 00:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072891; cv=none; d=google.com; s=arc-20160816; b=TvvD5gn9JfPisWwa0n2YeZ2TYGd/vBOlG8ITWOoNKm5NRariAMQBdhUuCsl1lrBNrJ 8tsexXhLA5hWoBQLC/EnIiua5nXPBYH8InVBXcmY8JinuLsC1Ha7+gn1fEZKaLgY4f3P 3XnZgLOUB6mzqOMpxkZAPzj7pG+ggMcu+Ftmk09NgdyJA/2Gt0mH3wQ4pvSzS2spPbhy g8TbbKkYoDkGlUvDDii8WRSwIFmmaUNRLOEmOFCDdiTREOcPevcW///EHb5EQj0vzrI4 v7Y4qZ+rkNhcVYNGxCPAii10S1XIP5n4aGnE93seNHVLVlnz0o6LVbtxyXpq4e2ZK36v SayQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=UtJFHkFTAqjinjSTmU9cVhuQt6CxhteUa18fp6U9CLg=; b=Xt8qDDbq8D6KIO0rMzkJTgEdSYWu7ljTuMH1H3G/UqL0RGYRQ4lO+BEuWzLpRRwyki CsP8yY7MJ/JVMUPydkFMY/sp5Lprcc504m+YsU0HoC1NldyhS1ZCRao679QIwG2pBhsA 7Di2Y2lpwEvpmV+EcwA9JQtLEThU+FwBP4E+1mKygB73j5mkRDx9sI7Glm/c8qh4k/aZ fXXzq5cAaayhmiL5xoVnOX/gSyN5x/lLN5HWbcOKnK1dmsfKD8dt0SLXI6/RI5/7CrTL g25XfcTjWcAzQoE7dROI8V+b+Qt1TniRBeD239BR9F423ZdtTnJzTn4IQYV0aRkujDbw QWmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rKDoGcNT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si1286246pfk.199.2018.07.20.00.48.11; Fri, 20 Jul 2018 00:48:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rKDoGcNT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727825AbeGTIfI (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:08 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28747 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727748AbeGTIfH (ORCPT ); Fri, 20 Jul 2018 04:35:07 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdit008048; Fri, 20 Jul 2018 16:46:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdit008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072801; bh=UtJFHkFTAqjinjSTmU9cVhuQt6CxhteUa18fp6U9CLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKDoGcNTGwuU8hEmgZrlV3sFsSksiS5t24xBbHAtM+1nibfTdSwQKYb57CGdFMZgT RDJe17w9ncIqhwF+LMHJPYpH73FUYtwWtIAOJpJBBpOBN2dSRX3hdALC0f9lii63+/ Ej05qIEf72pE39Uic3ZhOI5e4v/B77QFXOFwY4tdRiMv9HLa91n3xnzQNh7CU0QhpL clHkw/ba1281n32MjaUumkzGLLb9J0OSILgfNR27Vr31Y6HdCt//54DAMYXkaleJKD pozMa0sImr9hfDPCCx7lu9YWo0xjpju9L3R4/3HumOGFJ5nKcPB46pIOdhrFrHBIPs k7A40EIYvrEWg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 03/11] kconfig: remove unneeded directory generation from local*config Date: Fri, 20 Jul 2018 16:46:28 +0900 Message-Id: <1532072796-7947-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None scripts/kconfig/Makefile | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index f3c0e62..96a1c3d 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 || \ From patchwork Fri Jul 20 07:46:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142441 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649912ljj; Fri, 20 Jul 2018 00:48:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeNxhJqoP3T5WHarhuGyJzK0oPEG3jwAm5F6IPT2CaIpTQ00XS8A0cjFTw1HjvAG6EHmDmn X-Received: by 2002:a63:1546:: with SMTP id 6-v6mr1020052pgv.271.1532072900101; Fri, 20 Jul 2018 00:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072900; cv=none; d=google.com; s=arc-20160816; b=AW8YLzfZXPIBEf9bGV4+f6o/H28HEkoI56ZT9f+f/INkVg1P49kFujlmITmRmshAp9 7evxCobEl9/frIbJq/ZwSQny4PqeC+rMGQwfsKPzoW/t5cPwuSH71qhz+1IwVsADapJq O3G0+C4kxo2wsD+Q2qz4hloWxUkHhoo2iG7vT79fHRGHX+NyqPlyQegyO6Ju3ystTrE4 cxB3MFcMTuiHzh4OjBud1dSRGHWI5P87v78f2jpwvuFc22KakRGyE7u2rBIABCOGl3/X J13ViX58+nMfPQiJCoXjFA2muhqHWbfaG0ltfPxuJjw6zTws5a3ZyGP28g3QD7MHrxZ4 VD5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=LqQqu0tZs2J4GmrBjOwh4wZ06Eh+9gk34ftQDqDAJI8=; b=lfFojUEyOHb1LW5wSKG7DJPv9Uke4Qj/Q3dH6iqPv70UeQJIBkECq2cXYMPIHlT0dN rQY0hKI2Q4HBWFVXxTTPGazbeGscWhOEUgM/0m2IDmUEgC3+tkwmpTUVuZuXDPrkJOck cbkjKkvhLXuTPJrGK3OZ5PLXnW/3ItgP3g39DkLMf5TbwYuR0xyPUss8CoIF4oTqBj5c uVQiWtXTVeLuHUIx0Cc+SvZzZ0Q4y9XxtZCTQkwzh6ohun0lbaT+plHZHegszbkvKfTj J7WkTt7Pjvp8Iv3HidrLGOnUWS9cVZcBpIiinNP9hqugmMP+RsHJFJls3+8kibk2loZb Qe/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FKBJiwGS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9-v6si1204271pfg.27.2018.07.20.00.48.19; Fri, 20 Jul 2018 00:48:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FKBJiwGS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728138AbeGTIfQ (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:16 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28854 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727749AbeGTIfM (ORCPT ); Fri, 20 Jul 2018 04:35:12 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdiu008048; Fri, 20 Jul 2018 16:46:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdiu008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072802; bh=LqQqu0tZs2J4GmrBjOwh4wZ06Eh+9gk34ftQDqDAJI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKBJiwGS1XT9YvKualpWNPIJgpkMa6iyES0zgPgOY5dzZnhfBiJoZHctluSM6w0PE LOp5cvkDPgFNl5GbFG2tAQoenh8CnWZYNignQg16OPGsi/EJKjvhn8QTiIYfHlxDIs Gz2yjUkB9k7j+Du6/rYA81GKd7W9Yb1mBhlPLIC43xalnJWzdIieLCB8RPs0lZZETz KyVzX2cl9nThQKvOShvJoo3Qe6jaL188kumGTZtVudhjxXAqu10DwpW1KHQ2S63wzS 467UaVoxb/y3Rqs4rhAM2PZcSdakUFxMWkfArKCowE8IRzb45ev1Hbie2LFndcYUd3 cZSdcrpA3f7UA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 04/11] kconfig: create directories needed for syncconfig by itself Date: Fri, 20 Jul 2018 16:46:29 +0900 Message-Id: <1532072796-7947-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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 --- Changes in v4: None scripts/kconfig/Makefile | 15 ++++++--------- scripts/kconfig/confdata.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 96a1c3d..963ba90 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 f9c5ad4..029ab16 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -894,6 +894,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; } @@ -910,6 +913,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; @@ -986,6 +991,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) { @@ -1058,14 +1064,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. From patchwork Fri Jul 20 07:46:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142442 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2650117ljj; Fri, 20 Jul 2018 00:48:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf5sE+5SZ+QI/LpGz7suwKcFIIIpcKyFMXy/ESLlLbbI6xUozuJqY07HNJxim89RZdbJGTg X-Received: by 2002:a62:15c8:: with SMTP id 191-v6mr1103341pfv.194.1532072914596; Fri, 20 Jul 2018 00:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072914; cv=none; d=google.com; s=arc-20160816; b=GkilRSz/liU0ZxGDz9sQ40MxhYjUc8aX7Sa106f1UDwIZoRYRT1mqEfzGLTCSmtZTH k9z3OKRJVJcOQktfdTXm/76IqmkCr77x4/GLC66goNtAJOQLTLhbjHaAh7DTcnFQ0Uwq T7nY4rlcFaskvvAvbn1MnYn1PI975NCXTQjai8hhPJo/LFfyijYxS7ZuumwATCJ5a3kZ k7U4IglumtXbtPFa9RrL8Uf16B28BqjHvpD8SS4OKyfW1ujnCO1/YfhlEyGefuib78nT s62T8f96c/36S4ObDvxmw3z5qhkayH+46PKEM1P8GDmiXprMUBNLc1x6ysLZ5PngyTn4 NZLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=DL6rqdJcJnUdm3wir3gubx0P8b9ZdYaiRz2bsCRy3j8=; b=FFDc05AWpTOXaqAy/+RBnfFGRV+EuWbIOqtjAKon3rleMFXXsqlMXDtuoQwS40H37I qraiEYeQFz1vFdhrNghVrA9b09ZvO4cFZ8fdLq4f1eQaQRF8rbP7J8e1CkSeHmOMMqCP +yhLPgT1nU+cTumFIVfpvkU8ptzxc9ibichBnmEaXHXQrT/Eke5gtxqMw1n5EazEiLUt euN2NSd7sFKw4IyScK3je4es4JM4ghW+i9wDcwaJ5wV48uCtH52Hzj3FR8kJrHLsVKUf ZgzDI4E56UMCBF9wNxG8GwysZEA6HEVWKaC06k1QOK2kw5LwDd9QJYc48QUuGtFjvkBF xAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ds3jhj07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p77-v6si1367630pfj.294.2018.07.20.00.48.34; Fri, 20 Jul 2018 00:48:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ds3jhj07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbeGTIfb (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:31 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28745 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbeGTIfJ (ORCPT ); Fri, 20 Jul 2018 04:35:09 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdiv008048; Fri, 20 Jul 2018 16:46:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdiv008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072802; bh=DL6rqdJcJnUdm3wir3gubx0P8b9ZdYaiRz2bsCRy3j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ds3jhj07Vn1lHnauCVIt933fA5pnX9m6TvL4G/HaJ2liB+WID3NKc0j4Z/JsdXpBt Xk1NnReFUqFYFTzFQtf3aFGvHZbHrWUQfYmjxOXkhChGdw6k2ByIGPi7JuKCCKeXWn WnM0ozUOvgfAkJZTU4hxQ5svMFQMkh43Yq9Ullnnj2knjsWgmpmY0NTT8ZgN71dalI mzvJuTBoAYLOf6updg3rOyrWArx3coWT3zvVQ0Bf1IVZQBk1dQgaODStcyc9rlpDPN KMoY5pEqXWMAJs6uptcFxWT1ta1IEyN+lmQsVGXhj9YyS6ztXH2zMEsPubpAUwk3xp 6FX4hZNsNgGsQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 05/11] kconfig: make syncconfig update .config regardless of sym_change_count Date: Fri, 20 Jul 2018 16:46:30 +0900 Message-Id: <1532072796-7947-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None scripts/kconfig/conf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 671ff53..5af8991 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); } From patchwork Fri Jul 20 07:46:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142436 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649756ljj; Fri, 20 Jul 2018 00:48:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdC2axwIITl7HghGR7/ry6U4OyfUMDfDc7q7IWHH3kuhgqpukYNvfpqE4ej6m5GFQOoIQCd X-Received: by 2002:a63:4306:: with SMTP id q6-v6mr975542pga.181.1532072889078; Fri, 20 Jul 2018 00:48:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072889; cv=none; d=google.com; s=arc-20160816; b=JJPxiPcFRhSJ6o0iPOO9aafUlAYpALCaR1i0Twbw9E8SMBLUlGk3/+IXAd6NxOr1js KqNwkR1ExU3B+AOyvbJuhIxlXr3X+7GVRPbIi+xVX8Dw1LaGqqHTdbC0OmkvWUCuY21T AZjfz9lSVmP43zUfYyf3RGUaBXSUy29y7ghunF25KIKo1+FxIzD/vT5kZyvjs1HIKzlI npDp7Z5QlUNTIeq3pEEZ7lCGaCrmjaeklANNOAD6BQ43QfW5/R7clfTqm8ss20X7tmTg +zcKpsSmMcXOiEuk4+CUq1nWq5TvCxDDhNxMrQgdl0rd1ZyKg7UEoL+eFsT9cGyECUqN +sBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=TqBqVF6vt5N89XqqLGehnhoV0W4cuLDMGfMaQ668pc0=; b=WbxcsyN/kjqn6HoylC/DJQObWQrpPvMGlirP22O3vTiSVEnNjM13BiWl9Rkv3V2e9n yh/l/ZBgJKsCD6co8I/pn7tbUHXlcPZjIUHRKrtS0E+pM2N2qB4r/mXmZ/VjNdQOitIC SzRpR5aqiacPqeS/iHQqFhmE/GZUVTwlejeVZR6vmPVlivAFmI2hBSGSbKkrwxs9Z/6l t5hzlq7DZ0K3tGIcjgQulFALdFJ0uQhobMszs/MUXB9PfS0VOoeqEyO+XXbtxQw1oWlM 8Kh86I9imZLwwEbz74Zyo6nIZvWx91CEuri0PBpq7B8uci55J8571iOCX8E2qteU6CgT tPjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nBTc1P3j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si1247396pge.404.2018.07.20.00.48.08; Fri, 20 Jul 2018 00:48:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nBTc1P3j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727675AbeGTIe7 (ORCPT + 31 others); Fri, 20 Jul 2018 04:34:59 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28453 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727290AbeGTIe6 (ORCPT ); Fri, 20 Jul 2018 04:34:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdiw008048; Fri, 20 Jul 2018 16:46:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdiw008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072803; bh=TqBqVF6vt5N89XqqLGehnhoV0W4cuLDMGfMaQ668pc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBTc1P3jKlwfjB9TR/2ueKdxQfxrql8DgHcQ8gafD9TBCv81UP0mWzhdFr12KCqrZ kKBLMSkm6HbA7q3q6SISAKCYzXmeEzRDf/E5lTVE5KNVYiEOCSx8MWm32YpogVGl+9 tm2RNrcnjFS01zc3bN92o4ffPlY/O4VOWDjBN6IDU/zmL14LQ/xSraHxGNwSzjmFbo r5ILg1yIdFzyGTvSe8fBrDltbcfZN2Ipvdr7xQb/Frx3n8GgQm+2dFWyvqNHYSG4fA H91bkiiN6aX4S8Mw6zQWR3Jubf/+zjsYMebjjtNYL6q9ZGd8UTUBdaMYHc3sHsq5ry DuhWL0kK/fhWA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 06/11] kconfig: allow all config targets to write auto.conf if missing Date: Fri, 20 Jul 2018 16:46:31 +0900 Message-Id: <1532072796-7947-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None 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(-) -- 2.7.4 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 5af8991..b35cc93 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 029ab16..620b50d 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -1008,13 +1008,17 @@ static int conf_split_config(void) 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"); @@ -1077,14 +1081,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 610c4ab..f16ed51 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 a8b7a33..b0cd52f 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 *fmt, va_list ap)); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 5294ed1..82b27a0 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -977,6 +977,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 97b7844..208f7be 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 ad9c22d..62261b3 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; } From patchwork Fri Jul 20 07:46:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142445 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2650490ljj; Fri, 20 Jul 2018 00:49:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf27xeqbFrtSzq+inu+9c3uXlR7sl6tPxlVHx3BQJnSJJKI5QyfPyH3ilP4c7Az69DeW10O X-Received: by 2002:a65:6109:: with SMTP id z9-v6mr1016641pgu.243.1532072944977; Fri, 20 Jul 2018 00:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072944; cv=none; d=google.com; s=arc-20160816; b=QiEsL59UFhNyjSNtaSblxT6ItgfwJ4BTNV2s9JaUlwSdPtKQ8vGe7TCAj6q/dNOIYb dCAjMJqgXSjzotBOu9/aYhQtuPH87Lc7w4eXeLGdFxckN+TJO9lZzKcL882yIA3kDUSw u6y3+u2NXfu9UvZzY9Z26bcRqW0lvBLRErbFO4Ujy50X/kGK8CWokF2g1YZy4k5w/raX +h7e6HOmzejXxtBTZTZU8JCTy6B7I2DFFubzxnWDXcM9lghUne9t+AUuYyNP6gcg5iIY vyHzxNC0/EXH0lZKTlaW9F8gDaqelyWDFLRP/LJbLb1yvY/pYrxG0KDm6o4RYrO5UHpT U1kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=96arycp4z8LOgD9Xj6LUTt+Z6oY7DhyU5UyNBMuQ0w0=; b=zHHtk/uRQDygGdImcgMWP6XkZsWEl6+aiMmhUwXvH0SJE+KYJY8F+nXLhR4L2GTScO feOjEF8Lj91I2SEExUF1zISXeYPqxU6glRK8eVC9if39db1daJkxlLDP+9Yyj0UBwkzq Z5tFJQpytdGLHfbQ0I0Bm6c/qdMrVwAXqtq6WWzmnz/JaguDp76+NChw2fRVGTDYJilG VC/4I2pWz+RasGFrUXUupnucJOmTUhCpzNEGcBuP/bxN37bV8bwxhXfyU7rmjYSYWRWj JvEMC3zGCj09ZNd/x2QdYBeQTCIplTt+x7i85FJ6lRS6b/Tit5s6Jx08JiOMRiZ7ne/W UyUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=1srvT4mZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18-v6si1366583pfc.106.2018.07.20.00.49.04; Fri, 20 Jul 2018 00:49:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=1srvT4mZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727562AbeGTIe7 (ORCPT + 31 others); Fri, 20 Jul 2018 04:34:59 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28450 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbeGTIe6 (ORCPT ); Fri, 20 Jul 2018 04:34:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdix008048; Fri, 20 Jul 2018 16:46:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdix008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072804; bh=96arycp4z8LOgD9Xj6LUTt+Z6oY7DhyU5UyNBMuQ0w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1srvT4mZkHbAn2ue+MaX0Ocz4P4BnmHNtrG8Y8UkCWfQCdbLPP/j0JiA+wENfnsON BzVhGAJY98pcw2l9RBVpvNJD2lgQBSaBqsGC3OdlCtpjq0X+J/CeLvLrjV2+6HvhSa C38N9YBRD+cbKmFKtJsTh6ZuPbmx6Z7LLT4xo58717WOMf1PtZdB/vxTlehqe0Upya 3r42jGvgUONf3AayBLT8uBlrxRpxmLIj1Qh0X4qEja7AP3kcgSCzNeEyMHEyQ2icKw zHrNXuvscVwbNmv5Cy4XPkSZ37/jwbfrUKL5hZhfnqdkFxOJiZgXJv7NpY4MgtbCDI 2CvhGlQAlQrGQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v4 07/11] kbuild: use 'include' directive to load auto.conf from top Makefile Date: Fri, 20 Jul 2018 16:46:32 +0900 Message-Id: <1532072796-7947-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 5c8e9a3..2fa9830 100644 --- a/Makefile +++ b/Makefile @@ -585,7 +585,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 From patchwork Fri Jul 20 07:46:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142435 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649697ljj; Fri, 20 Jul 2018 00:48:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdoQKv6CdK67KtQwCLlx6KpyQ+XunUiG/ZRpLjk5HpQbfg9e+I4bPhCub8ijYbmUHziduSO X-Received: by 2002:a62:6b44:: with SMTP id g65-v6mr1099530pfc.226.1532072885074; Fri, 20 Jul 2018 00:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072885; cv=none; d=google.com; s=arc-20160816; b=o+X5aqMa0ZaEJHUXbQEGWuQwkiTYe0WAfPMBuW+yfkP4jY7VwyxVKblpt7N2Zr4xfn cgwhI7dedKsgCCkhrlQGHHKJUKNYYuRoBOccZpAxnrrI7BPYBzavnL86F/FrZLBoZTcX nUP8dPS85x3uNyQTGXwGoKV7aoirOpDjIW/XV7YSHDowyByfscPT/ok4OnvoT7UreY6d QzNDOO54FSrM4tfjGc5mO9ciRx/ibQih97A7IAcbQZ8bM8KE8+n/CxSFs8KxlZgl7dOa i+T78ncCQpcLcvUb4z7IEwLGJDTVUwKO/9Ul87g1GyknFyqy2FIlEESehNeGQXi0enEe aL/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=0+xfs+t9qw6M2tt8q3cWVLKoBU4NgX/D4N4D58QqJ4g=; b=erBXcFO03aPJQ73lRWBCLlO7AXlvgSOSUKE54EZbfIS77K0oZN+hV/+A9Ys3Xo7ERQ 9UBbA2pr6Bz+500wmour3ws2o6DGaBIOvktplcIX9rfLRz4M9Oidog68d8LiKbrUa6Im psx1NLLaRTGBkulCFfbch7jlQQeVpztsQSpwm/oJc8ApgzW9jhx1Vl4vsTF/GZeSTB1P qj2gP5Mrh/HaecRONDZAl9z8vrjNzgWO334bToAOH3A1sVIWbhLb4swuBOHeHWSruDN4 BkDN0oBhRhvWWpaWV6JdYaiGKIGEQbXFvYRkrcoLdujMkB52Rinx4oa4OLoDeBvRNWwd MHug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=D49FMcwu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11-v6si1306263pfe.102.2018.07.20.00.48.04; Fri, 20 Jul 2018 00:48:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=D49FMcwu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727740AbeGTIfA (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:00 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28448 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbeGTIe6 (ORCPT ); Fri, 20 Jul 2018 04:34:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdj0008048; Fri, 20 Jul 2018 16:46:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdj0008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072804; bh=0+xfs+t9qw6M2tt8q3cWVLKoBU4NgX/D4N4D58QqJ4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D49FMcwuuk7iycUF/XCYQiqBAMTZrXLhcgFAIHMgOovnwMGGrUgYR7Y3/AQGT87fj Vk4qkmOQ02ds/NGvIqCAVKSr58k4riskgXXbHnUTfADhd8ScXivgrulvE+rtJMTN1l 7bhUUpvfggXeRoOXgURzwfkYoPS9t9kjAyOEI3QkJc6H7tvZofBuhE3MUIcoWaFG80 CC2sf0ybBfYelp04VRYUW4rxLTZOEAPYZmHAFBHMCV3cYRUMMbEWh9bL5hLXleiIMw t5icg3xDpHCxadlvtpbsdu9U+Xog0yxr4IS/z9pfGfZ37RqAAVoZolXeIJ8XRCIQ78 w4SZFSj/IV8qg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v4 08/11] kbuild: add .DELETE_ON_ERROR special target Date: Fri, 20 Jul 2018 16:46:33 +0900 Message-Id: <1532072796-7947-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None scripts/Kbuild.include | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 3d14d0e..7f4b1db 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: From patchwork Fri Jul 20 07:46:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142438 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649819ljj; Fri, 20 Jul 2018 00:48:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf2K2LeXLei2buK98wrJZ+L43znONa1yQkHwE4uBTSNlKA6p2C2x2kb0EbkoYhQ7/GYNqLs X-Received: by 2002:a62:3d86:: with SMTP id x6-v6mr1112789pfj.192.1532072893092; Fri, 20 Jul 2018 00:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072893; cv=none; d=google.com; s=arc-20160816; b=xY7FSctgO50aNfujxUEv9IpTwUMxyXBPWFCmn5tnx2mWvn5iB/6uKvuy0XNWiqE2Ec PCPiDar2v6+GYNlSek8Cr2J1lWiXtzjxRVx9vStd/J/FPdWmPQC+GT7w61+mAyPDZSNI FY34u9WUEXaTBW/iep/emnBcbQgthomgAWLhTLKDoD4kQpbGj9R2nvQGJ3hCsEdbCoTh WxyapphCuM5i8OPvD0Eu/NVKFa2Fr0/YqGKxYw1h2zMC+H8It3TT4LB3OKHjx9q7RdtE 4tmVSB0lXHtTpv2ZGP8CJz3M5b1M8G3pNXzq2P9vrzghlMkQvXMwn9AuOZcGCN/Xtyhy pTKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=shsXDaqfurwusv+szzzzbnfT8vVFakrXhQ4CFfSL1ao=; b=KdIjxIBYTO75buB2+XX2FKY+NY+gbqgEHk+TC3OvVZ9swwvapP/XfWtzNzsUkKbgCl bw++t0HaRmPuHP4CG4u1yLs4iuGQ8GR1RXVuSnJdr6biIV5zHqptZfL5iUW3ODGxA32z 6cOgl5iHPAnv+dNDxS+OGo30vMswsKtCFONVXuavnv8q/ywlYbibvhxR+ieOEK/wXuQh BI0Q3kTETdwK6BETRB5HaGwwsoLX+kwZ1GZTLpo9MfalDy+rR/ZaOeS/pG/ELxj7Albr kzU6khpIo6DayCPONrMOUvDVCaO3x+QUg9oUHi+KO3FyAO0NmzQ8s+gibuXm/7VVvZP+ 6iig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=p39XuK+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si1305175pgs.243.2018.07.20.00.48.12; Fri, 20 Jul 2018 00:48:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=p39XuK+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbeGTIfJ (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:09 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28749 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727749AbeGTIfI (ORCPT ); Fri, 20 Jul 2018 04:35:08 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdj1008048; Fri, 20 Jul 2018 16:46:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdj1008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072805; bh=shsXDaqfurwusv+szzzzbnfT8vVFakrXhQ4CFfSL1ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p39XuK+W3wZX9KPTlFx2J7BiJqN0T71i+YiqXYxy21fxR4bvp90QRxfrPpIs5j5pj w693ET6Ojs0+4rvyxp0AbGbI4aoDjgrYTop8kPeIdOopIQLJXUAGlw/F4M/Qz0pIxF wGetxTC/w5/diPaHot5lrIVEeRLp2GECXe2umChcePny8gPCcOyc++ixW3gL1iU/Ng gYQXxp67Pb1NuBgbHXhFGyuMX+voavy9z5s1ZWf/OC26T83llTEa2CmCFh1+auvfCt CAAm2wkbyJsKKVxepigpieSrV41gYyRl70psHAK8116K+YFoZ1GsPWiKBBeLaHk2c4 QuJ2MFtIRR1FQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v4 09/11] kbuild: do not update config when running install targets Date: Fri, 20 Jul 2018 16:46:34 +0900 Message-Id: <1532072796-7947-10-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "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 --- Changes in v4: None Makefile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 2fa9830..ad83917 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 @@ -607,7 +619,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. @@ -622,8 +634,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: @@ -635,7 +648,7 @@ include/config/auto.conf: echo >&2 ; \ /bin/false) -endif # KBUILD_EXTMOD +endif # may-sync-config else # Dummy target needed, because used as prerequisite From patchwork Fri Jul 20 07:46:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142434 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2649688ljj; Fri, 20 Jul 2018 00:48:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeQMmCF4wx8sYGFkyfLQ9I9MlbKGZiLmB3oMdryl38W1g47VuLPR8akN75hEoZmFExZL54m X-Received: by 2002:a62:5290:: with SMTP id g138-v6mr1142044pfb.46.1532072884737; Fri, 20 Jul 2018 00:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072884; cv=none; d=google.com; s=arc-20160816; b=DsQS2hLHy6TXfzSl38/ZwwphzGGTVjOa+DMJNyecaqBqNxf5bajs0DN/8+K5NNiKZM CkkTm3Cm7CURPSV///mhobewdHgcqeteJaQO9ae/dLpVhbq0k0N95tOcGvhdLHSFON7/ aHhl5uiSPRoRvZtfD44I9EYX3j8riGftuexOUrdes1jDdQIdM41OosdJi/fbQPRvWHOY 0o+PZEXHC81cY3j0ZQTWRAEikKDbr90JVtD2JTNlDX2Xcvq0t6Ve2mHQnrbNMGwRa5Bx XDp4Qp2Hg1yhnIdPgpcCTi0ZrpqwEp6f8OTr7stITR1cp1MqvD+EQGaqLkTJN0EeNwIQ E3DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=jDNKqUuLzwnkvVwfACbXbAwZGNLvx4EVw6xRbAj0t/c=; b=YjqH/GZgH9asBiG/L8bVMEAQG552eIinKe3kXauBjY9PP8AoRaaB7dhOqExAlr/Jb1 uPOC20+Gj1RqrkvbBxV6SMSDsE0ajoPr3+AE41PqjBroChDJPRd8fmFVI2Ck32Fm7cyk zYxmgy73THkwv2JpHq2G/Y2CugaypeCLh2Gg0BTaRfIFK0YFyLkjVE07lpGYwFJ8YNtt V4vmYG5uBPdjfMtfKScgq/lAgrLaSLdYqv4ZZbKxxk/M5y+Q9l8dZJEhUSQFOXSY+MV5 l3wGisVPFfdPlXlPOfbaTHKEn8qU+06qhK9IVWxkhKj40FyUCX6ulUIUKLHVKcQeaISI RzHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=l3xg9h8e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11-v6si1306263pfe.102.2018.07.20.00.48.04; Fri, 20 Jul 2018 00:48:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=l3xg9h8e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727410AbeGTIe5 (ORCPT + 31 others); Fri, 20 Jul 2018 04:34:57 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28419 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727026AbeGTIe5 (ORCPT ); Fri, 20 Jul 2018 04:34:57 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdj2008048; Fri, 20 Jul 2018 16:46:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdj2008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072806; bh=jDNKqUuLzwnkvVwfACbXbAwZGNLvx4EVw6xRbAj0t/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3xg9h8eBW6BDpqghTyEn9aAAh6RLEQgf5k5e+GQgHfzHy1QZkuhHeQweBrx/9lCe UijafqbgrnZpY3Or/WVOd0QOAVHaYfy4Ah22G9gHfuPB4ixDd+OwbAlX4GdH5FhH8i UsJuZKFdf4Ymwfewzchruad9WWMO+tatMGVbrE1vggYLGXjCZrOgn0QoLmLVevP/4/ pjz+tadZTbEbLGLAi/T6fl17djU19/Spe0iYXUmsfgbVo8rSMNRZfYlz4lG6J2Vjm7 INa/a41gUa0MkjQAjjKBjSRTpdxU27RuAviyngHCBfte/eihbd16vfd4brDhdiJKtk X1r6UpdmG1mSA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v4 10/11] kbuild: do not update config for 'make kernelrelease' Date: Fri, 20 Jul 2018 16:46:35 +0900 Message-Id: <1532072796-7947-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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 --- Changes in v4: None Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/Makefile b/Makefile index ad83917..0ec1c27 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 From patchwork Fri Jul 20 07:46:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142443 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2650207ljj; Fri, 20 Jul 2018 00:48:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpep0LM2WsL21mm5gF3aLAaEEdIDcOAlExA4Zf/DQvAN3E1HWY9Glf7/swdNujEES0DmoT+6 X-Received: by 2002:a63:fa48:: with SMTP id g8-v6mr1053489pgk.224.1532072922295; Fri, 20 Jul 2018 00:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532072922; cv=none; d=google.com; s=arc-20160816; b=PXgljTBGCN0FIYqc9HzWT1KAqbcwax5dSyetDzzSn01M50yWQ8Ya5YPX+qoSBAq+Io n9hAXPNWiKfyIonXvPRKyHqJHydMvZ44y2hu+/9nuoZicPpZ9kzuUCIHuLDXFJxaWR99 IE3J5qeT/9W/UbKn1/uwna/vXGLPbgYsN4+3HrHMzRae5rbp6pzMP2s9BXdaBhCS+CY5 hGqk5rqDpF6F3EniYCYHsRRau1getF22y1S7T42jO0R4Ig5El9uiorLBWZOZ4Z0f5j7K KvGO9bAM54g1MvusTsS+1JEY4bnEZ82GTWRQq02UPoVbjOmnEFmRKfoHIi7avQ4RV7fi oWUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=0AEHVsWGTyJTmFv8yz8zN2xealBncVG4ABdemn2CJys=; b=s3ktb7eH4/5/Jzo5E8iaUvqNUSf0n//BRpkS7Id4luu3Uho8ZdEYDIpZqZwk917hT4 5dJEuh6wnYPxfIWMZvbNd60Y8uJ8yxBVOXfxWhlgokscKtJGDtiY7NLWSIc7PwsP7fee MQC4n8hZ7oQ42HXDQpzkcj76t94Bs3RddGYg9gSA836ehLr554qm4VBFIyzBaUjZZYjh 3BKW6WFxKJQV1frjRL5o4HlgJPazA1ITyHAIQhPcj0nNadvLy4uyQdSvlrUPf9mZS1uB A4jg2UNhuxQZAxMO7S3j57jrbmOtbuHw1us/8HT/ATi4pmiO+/BraiR4DpT/96RX6Tjp fK2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ebH61TNe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si1379758pgx.60.2018.07.20.00.48.42; Fri, 20 Jul 2018 00:48:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ebH61TNe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728335AbeGTIfj (ORCPT + 31 others); Fri, 20 Jul 2018 04:35:39 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:28746 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727755AbeGTIfJ (ORCPT ); Fri, 20 Jul 2018 04:35:09 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w6K7kdj3008048; Fri, 20 Jul 2018 16:46:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w6K7kdj3008048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532072806; bh=0AEHVsWGTyJTmFv8yz8zN2xealBncVG4ABdemn2CJys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ebH61TNe8HjsZTIoHVQ2ZkzzjIKpmcbxPCf40AEu50t8rSvDMs76Dt6nKniwhOB38 WO3bLS6C35VQ55BMYbKkIZsMEZriIUTSCMXgw9Ru4xqW0qoB43XA1GMb5OQ865/oya 4ZHj3R1ZaEtrrro/H/og4efQm0wS/oXZDeV0RHuVm6Go+yWj6HYsyKJWZbUcSTRnoL tbuFoDkGl/tMmIYpYysC4fpgZpK6d+PbK0sSNUPeCr0r25sEoxBh9yz5lZw1dOAINw 9+ajZo5c3L6iW5q4rPmP13AeTzWdbHPvrRUDZ/YAgMmA9a0qnuXi9FiqMI1D//cqF6 rdad4bdXE1/OA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v4 11/11] kbuild: remove auto.conf from prerequisite of phony targets Date: Fri, 20 Jul 2018 16:46:36 +0900 Message-Id: <1532072796-7947-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> References: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v4: None Makefile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 0ec1c27..ceb9c1e 100644 --- a/Makefile +++ b/Makefile @@ -650,10 +650,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,) @@ -1048,15 +1044,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 @@ -1086,8 +1081,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 @@ -1225,7 +1219,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)=$*