From patchwork Thu Jul 5 02:39:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141091 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409345ljj; Wed, 4 Jul 2018 19:41:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpccHiRXSVJUSN827eQE/V/Q81MKQa/Ug3sQAfpuAbAA2SXcVuz0XRhi19B4vj5KDoG8f7Y+ X-Received: by 2002:a62:fd06:: with SMTP id p6-v6mr4346843pfh.167.1530758503678; Wed, 04 Jul 2018 19:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758503; cv=none; d=google.com; s=arc-20160816; b=szpsHg3LeVveJcBXErIu0Xdhehi7evTLmNDINVpn1SovuNGHG9UgrleCl5iYtPg78Z 59RCxM6rHtU/Iq6ba/YFfMFNHKMWKbErgqn/9lTBcwKRQx4yaCK4sJSoczj8B5UmkokJ z3YD2Aqho+8FAhyTOJ78rY7PurKqHh76eiDasF4VCIQ0J8L5Qbrzk5BBpYRxzrJD4nAN I6qY2ER8FAbz71FLc28gQHjG9/tsM3iyAbcS4qzWsuqmq28oyVId8T7sKH1+ST59ymN8 7sIv5fAzg6EbwdqVKCYZCXhHnYsND2R/GCm/tC/ilZXvu2dfKZixSxCcfJiqaNZIAypM sGzQ== 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=yLz8AM33NtPVOG5Y8iy6SpZ9KxQYVmtCDPm950evRQQ=; b=wxueb/A0QCGqtnuhYsuT14RmvOdzuotD3tgb0nuqRBNY/FBaIZqdKHkK1O5a7F/F7r W/w838MEO/z0AW13QwD6Y/PsLjJ6XxUGRrVNCx6jvleJafg1BKViMM/coHjN5gLM8xyH OPhq5OzoKfZllJR7Fh9bhRgryaYdjm3sCoyyDJj3pJpwys4JiNwdy0yZIfsHZuUbljcE CWCj343LOtsEwYLpNaJKPLwvuaep8RO+SXVxjDNxx6ipVB6m/CWHJTSyD8+mQwz9pSTn U0xH/cFkFpTd/t6OGPctpBroPRzybmHmzJqaWfzr+XiCnO2pby6wQkE+i7PQ+j/JAleg Zo3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="EHMkqr/B"; 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 v84-v6si5008482pfa.103.2018.07.04.19.41.43; Wed, 04 Jul 2018 19:41:43 -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="EHMkqr/B"; 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 S1753349AbeGEClm (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:42 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43890 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753105AbeGEClg (ORCPT ); Wed, 4 Jul 2018 22:41:36 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZX028145; Thu, 5 Jul 2018 11:39:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZX028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758398; bh=yLz8AM33NtPVOG5Y8iy6SpZ9KxQYVmtCDPm950evRQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHMkqr/BECluRCIKmyjqMJj6/fhCm0YMWjBL2SEbOej+Fys16zHTBN7FuWSrovQSs 6khyvYcAi81nOBAp63eeXswkQJtDLkqEir2YC2rsV7+ZF2MLLpj21B+R6cfMb8FmWF OnZWTHkss6a5krArkilbIQYL9ysQHLqv1neNMd9fJFWeMLxob6sNnyJzY9rM/nZcg6 kQXZ+oTXNrjCeq0rAyLGTaty7AsPCKE0I58Gj8GWJjOlLePFMxPAG4zCsVcA4jNNoE F7A1ay98P981deO4aIYp7ffH7I6auv0rAnp0iK+6EAx/VWNixvHJj//oxjUGfWxgEn Vvdn7YweLL80w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 01/12] kconfig: rename file_write_dep and move it to confdata.c Date: Thu, 5 Jul 2018 11:39:38 +0900 Message-Id: <1530758389-30862-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- 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 Thu Jul 5 02:39:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141088 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409237ljj; Wed, 4 Jul 2018 19:41:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcr3yo7g+fOMjwhnDQmoipoIO0giWY2iqGD1X4ud0ZbwgMkNZCMlCIgS0nznKC4MmfwwBep X-Received: by 2002:a63:161a:: with SMTP id w26-v6mr3926940pgl.257.1530758493105; Wed, 04 Jul 2018 19:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758493; cv=none; d=google.com; s=arc-20160816; b=lFrzIwWB4E7SqEqB2aOuib1hF77FXMNsT/XmvX4j7bvKRhUfky8GvIWIau0o7281xU 8SIsnMSordVQNqjyxMbKTEXr2n6fKe/VCWnXyt/DgaDhRmltYtNm4hkmLSoZIL7KxB6M qAD7KqAnS/GpMjkcgKnjQJxMxDc4/wpunvFUP0GQ/ZujQPFwMPxrLwD3TjbRAq7YUeya wBhWgrYZV/utIXH2e1qEF/IQwY1qrWnINhvDmoKmVNvON8vK1R3iQuMszluryokISxiZ 0NBFrUK/LsTr+x+A6AvVT9tSYUQXGsRemGf/hY2y+3zUWM3QGe3hDNDnqCeu4omPSLbP 4AMQ== 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=H9Y4ynGPta8AfBiCIIAsKjioyPf3qY185lk6pn4qKOM=; b=VLhtRe8u2lmIAAWHllWbfnwdyhD9HupqRA+rE5MBBI5YR/Zs0Qw0hDqXyDkraKefyi feao7gWhfGo3EfYkEbv7vjoq7pP92BIRW8DRyo86wd/LukftrkYJ9t3LdqdVWqXRR+ON WjWd0Av/UwGV07CJ78Y39Z6TdgsLyYVtdl8fnha9J5Q9tmXBJ0k0zcFVlVVzC06GcEyd eSEi+T9Ho8iGXOC/QQIv47taHhsVrP7c7A1jJsAGjxm8Jzc+1FDJs8o3Ti95SV5XZPLJ WPV0VaDafjXAkSJ91n+llK3xaA+3cTgq4C/EJTQzFC9vZ8lfYF+M/86LQ8GWhjvGdgWJ sSZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HYlFQkks; 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 p187-v6si5126716pfp.125.2018.07.04.19.41.32; Wed, 04 Jul 2018 19:41:33 -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=HYlFQkks; 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 S1753212AbeGEClb (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:31 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43647 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753154AbeGECl3 (ORCPT ); Wed, 4 Jul 2018 22:41:29 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZY028145; Thu, 5 Jul 2018 11:39:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZY028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758399; bh=H9Y4ynGPta8AfBiCIIAsKjioyPf3qY185lk6pn4qKOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HYlFQkksOnYzNWDvz2mlO1g4n2mwDVaiPqjVs4Wiwsmr418N6yXZam1B7pmAfYEiV 6KLjZnp4fQXvvq2HoVT8WKtTSuqnCCgyshpEtKlidQtUZHul/cpOiiD93fXDftPLnt fJhzOW/FsFxGGhEj66n7hmLBJVWuHC6PIHexpTeyX2ukfcct8uGma0YCxweDTd4mCq l28bPAXUgkSYR4+4vYEfcGoNIDg1iSamlcXxktOrBuBsd9hO91dY8/dxyKDD8NjnSY X7ueo4YBhHvV3z5Ow5x3BfaEA2uNh8gEal0SPWFPPrzZ2HQQI/hqxfhHeWlRY6wtw1 Pnz1rNIQdhMuw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 02/12] kconfig: split out helpers to check file/directory, create directory Date: Thu, 5 Jul 2018 11:39:39 +0900 Message-Id: <1530758389-30862-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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_file() - check if the given path exists and it is a regular file is_dir() - check if the given path exists and it is a directory mkdir_p() - 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 | 85 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 17 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 4771820..881993e 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -16,6 +16,68 @@ #include "lkc.h" +/* return true if 'path' exists and it is a regular file, false otherwise */ +static bool is_file(const char *path) +{ + struct stat st; + + if (stat(path, &st)) + return 0; + + return S_ISREG(st.st_mode); +} + +/* 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'. + * If the path ends with '/' like 'include/config/', create 'include/config'. + */ +static int mkdir_p(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 +145,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 +152,7 @@ char *conf_get_default_confname(void) env = getenv(SRCTREE); if (env) { sprintf(fullname, "%s/%s", env, name); - if (!stat(fullname, &buf)) + if (is_file(fullname)) return fullname; } return name; @@ -725,10 +786,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 +908,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 +985,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 (mkdir_p(path)) { + res = 1; + goto out; } /* Try it again. */ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); From patchwork Thu Jul 5 02:39:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141097 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409748ljj; Wed, 4 Jul 2018 19:42:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsv5nShabCGDqf/6y6t93QLQKj0gSfDQJVydEwGlDA0CNo/smNDnQmgxxvTnKuqdbI4sEM X-Received: by 2002:a63:1722:: with SMTP id x34-v6mr3895678pgl.268.1530758548920; Wed, 04 Jul 2018 19:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758548; cv=none; d=google.com; s=arc-20160816; b=gQgac6gt5rdZQS/1QcnFnPZ/DWThLkhHgTHWrsQQ6Tos29N7m7fP4kYcN0FZd1XYUY S39y8VuOFsQxlh6RCELHs74pRCs5T3Ckds0j2RPJa1FcOW06kbE+JsiLjePBBTVL+h0Z 1tpytD/rtHD9MDdHtWukkhgkwwH6FVbRjSjV3aF/EqNWXHfeOeE/QAfJ6ufoYOii47ZL 33q9CUjB9ajLaHTPsbA5LOCAQLETN0hARdPaJbs1LMeZMId87RN66LVutMk5+TfJs73T ynC0yU2I2TzzE8Ae3XRESylBLl8TgWF4SjeMcHLKZa6MNa6wyLWocJe9DgsO4twsVp2x 63Cw== 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=qnJerOZw7y4UM2FcEumXP19Vq4DDaKyhKEblMJs0Uc0=; b=D5o6LsVuS5itjWOydHxkZZ5NFVjQ00qV9YPseNVmOxfZC5G+7ciwys4K9UAmIA7hbw /ubvG1qFA49mDk60gwicbbLrTqwLomozF5V416GOul7HXph5rPghnh2bxSyrMFm7DtDm qBZWlBL6h+dyj/Y3PlBeSGiVyqf3L51O8qzo82ciP+nsZHb7OhDxbJjtxE4uDKbKlT+S pxZBu+E6tbNCey/tUAMmvtbiKt7IIo4iNRVOl0WWe1NlswMkTPWwgNSgKnhyvlLngWTE +ebXbD9JFfAzVZ609F2ZIlCw8FoUL+a9BGkloiFE1tfHezn+CpU2r78/dbM5mBo89OGO ZKeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=eIQFIIzu; 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 z18-v6si4624660pgg.332.2018.07.04.19.42.28; Wed, 04 Jul 2018 19:42:28 -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=eIQFIIzu; 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 S1753447AbeGEClt (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:49 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:44108 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753355AbeGECln (ORCPT ); Wed, 4 Jul 2018 22:41:43 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZZ028145; Thu, 5 Jul 2018 11:39:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZZ028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758399; bh=qnJerOZw7y4UM2FcEumXP19Vq4DDaKyhKEblMJs0Uc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eIQFIIzub8sBVxl97eY3wE3j8nXFDpgJc+FcjSb2AGm+QrJmA66kxeG/00MPUKx0W G/7i6veCp/4ZpT0GzicTlfhAoN36RSR4kbtWq3WZv7xGTMtUb6jR/PNVg45x9mXOYM MJ2T/2W5ifHukZsTCKx7M9Mf78s1PPKlcnHN2Mx5KaxOYWwJWKyEBPZe1bncWyiq7o tPIpOFGlt5WiLMSGfrxwJkqqLg5Yj54fmZhORTTB+HRFlOQI09KLl89FRT1WJDL13Q R/kR17sa4zv7eQCBX7kKXAX457ds6dkXAntzsV2PCzaMjHEA1YAx8z0ZsQJaIrlAHH 6MVITETrCNcfw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 03/12] kconfig: remove unneeded directory generation from local*config Date: Thu, 5 Jul 2018 11:39:40 +0900 Message-Id: <1530758389-30862-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- scripts/kconfig/Makefile | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index a3ac2c9..c9e8cf5 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 Thu Jul 5 02:39:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141100 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1410664ljj; Wed, 4 Jul 2018 19:44:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJzkO90yngCoJP7p4hCKwC6YsoOnQj7fbISDgfgUbNgbhYrb/WZy9Vxo+Fp9ggzwftZcS1 X-Received: by 2002:a63:4f63:: with SMTP id p35-v6mr3874182pgl.167.1530758655373; Wed, 04 Jul 2018 19:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758655; cv=none; d=google.com; s=arc-20160816; b=El/5lmB7QNI6yl3COtiH5Aqjv4NlG2ktitH5LCAyb3DuDdDoBvosBkBFTPwbVFRp3J ec/cR3mvxlKoub43bNObctqufiv/gmBz6hDtfGBaDVRt/4j2xJFz7wQsbWpHf8emuZr0 mKiPoG4UMJZnpIYj4EJo7ORr1fr2XrkssYx+r3ejebGIdOAVFCIMjleVTmtY4a8YYnGY ag3p+tXxPfYY4CMxipzuLYH+I6YAD0SD+hKHbVgS/QgnscTESDOnyv386XMNNCt+OdG/ wkdXrB0l15ZlWBJznYptcTOJkOXb5da3JBaX8OceLr9VLin5uIr07HlUOaFqR7KOBbPG fWIA== 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=HVFBWVGPJQGYBwRsydwk7ExoP+uje8PBFhH82UtKbfQ=; b=tAyAK9HMhKyQRtiSmPn2STfD7hhuqrb8Giqj+7RRkeqRU+RkWhvoCzJsdkaj1hICDL gGMrtaQ9UM0iWzYGOfvBw2I0EgQHKaelP1alqF7pvokczNPA9FrrszkkX+QBS4M57/qb 8NU/dkFAPCWMeZuDoj3mpz4RkmbGa4GjI7QlwlV4AGm3/736T6DD49mtXVU41xwflyXs HsNtYBSDYbLiZyzam8mgKZ4ioZXDIXaYw34DdjLL50Gizi+CfLXExbB7UyiMiqFXfmW7 u2g4WvPjJp/VsGzvwLhgvFeHvtiznb4CKZigV4DWGTgSbBfY5A5DOttrdth0KB/Z9Ns9 hyUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Q94sf+VA; 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 b11-v6si649505plr.42.2018.07.04.19.44.15; Wed, 04 Jul 2018 19:44: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=Q94sf+VA; 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 S1753504AbeGECoM (ORCPT + 31 others); Wed, 4 Jul 2018 22:44:12 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43641 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753161AbeGECl3 (ORCPT ); Wed, 4 Jul 2018 22:41:29 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZa028145; Thu, 5 Jul 2018 11:40:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZa028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758400; bh=HVFBWVGPJQGYBwRsydwk7ExoP+uje8PBFhH82UtKbfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q94sf+VA/fxaMDc08NBZSt1NoKwTsc8rxzDoNGZ6eMSrleytShUncfqvaVtK/IaTW M4uhXXlA0J0hZEIl14d3sn1wFLf+CuUwEw77kN0cHDcpJYXspgQG/kqJvuutDkjqla t7y16SzP8kiTD2VIc/Mv1N1tMTqWwHPk6j5EW6/Cxg/iDfbUmi2+7mELRdQxRMnZqy pMLiX/6HcEMksnf5mzcfPAtzsAkNXEk83RLV/LuzJiYmKg3h8nrYjkEJQ62zVe2FHS S8xojYcsAGunofJXadN4fdamIxwjS8GBcIvjNoMFlwkfpE7QxSA/+Wu+hzDExEz4Km LJlGMVieEKcvg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 04/12] kconfig: create directories needed for syncconfig by itself Date: Thu, 5 Jul 2018 11:39:41 +0900 Message-Id: <1530758389-30862-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- 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 c9e8cf5..dffe268 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 881993e..38b3a6c 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -898,6 +898,9 @@ static int conf_write_dep(const char *name) fprintf(out, "\n$(deps_config): ;\n"); fclose(out); + + if (mkdir_p(name)) + return 1; rename("..config.tmp", name); return 0; } @@ -914,6 +917,8 @@ static int conf_split_config(void) conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); + if (mkdir_p("include/config/")) + return 1; if (chdir("include/config")) return 1; @@ -990,6 +995,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) { @@ -1062,14 +1068,22 @@ int conf_write_autoconf(void) name = getenv("KCONFIG_AUTOHEADER"); if (!name) name = "include/generated/autoconf.h"; + if (mkdir_p(name)) + return 1; if (rename(".tmpconfig.h", name)) return 1; + name = getenv("KCONFIG_TRISTATE"); if (!name) name = "include/config/tristate.conf"; + if (mkdir_p(name)) + return 1; if (rename(".tmpconfig_tristate", name)) return 1; + name = conf_get_autoconfig_name(); + if (mkdir_p(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 Thu Jul 5 02:39:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141090 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409337ljj; Wed, 4 Jul 2018 19:41:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfPIhF3XYA9IzG8DvSg8O7DsgfevMvLgfooa2Gy1ysBWMlZLRxFfaJBphs2ExL8l1ki0btE X-Received: by 2002:a65:6211:: with SMTP id d17-v6mr3926665pgv.450.1530758503111; Wed, 04 Jul 2018 19:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758503; cv=none; d=google.com; s=arc-20160816; b=QGcasPSZWhDWY83MHl1DEjyvCG33fUSW71DpYgXnNaq7VjIlTP3zZsIDN4FMdW5Keo AGKT9N4ElklGhvqthBBW7j8m6VrsLVesAYeYkYsxrTHzaEynBW2tomMDHKbDyZVwArjn +EEevvFTDdh6p6K9EqiqO2U1lO4wKm48yu0DDR4vpqkFCspWaph/N9WfS4IgCxxkkL15 nzxfSCOEsxpp2u1mFlFENBB86h1Odaz+AZPv4QM51ZcXT7v8vfKLZyDescsrGH7PiE7E FORZOYZpTR3385rLPBhm+eRmAfpHjB96NixUOl3dS3LkxDOvQdq/+tvnjYPSR+tmOLJ/ +5xg== 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=rpE7EtXmU6ta5MKoKdW8f6wc78ugB7bmilV4nG5tgRI=; b=qu9nOCpA5I+D09bHYISXVDnBCnfQAA+mrbHnKazKZeE7rj/HSG0CKqjxr5ji+90tGU JVCCngLdM5srzauA4THQNpZV8HFvwLb6KqPiH6JiITEyoWmnab2OVTXGn7Il0CUu6+Bt DrU4pUt11E8bvoGSlz/rymyZctWKFkHQW4+eo2wczODGgiSIuftZb5QOtmFXrAPPNDxL ZqNVhPRHH74DCPzPVUUAV9l8CM0zOXRDqDA2LVrrpd+azQZM5X1VfLzyM0gQ6Eje+tIr UpF5i0ZACR3nngulXaOVvPypHl+pcAjAhwsB4Bd/FQm0mut1DVMX1rhqbeIjQGSNjtWg lu0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ap7ps1nH; 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 v84-v6si5008482pfa.103.2018.07.04.19.41.42; Wed, 04 Jul 2018 19:41:43 -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=ap7ps1nH; 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 S1753323AbeGECll (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:41 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43927 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753155AbeGEClh (ORCPT ); Wed, 4 Jul 2018 22:41:37 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZb028145; Thu, 5 Jul 2018 11:40:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZb028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758401; bh=rpE7EtXmU6ta5MKoKdW8f6wc78ugB7bmilV4nG5tgRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ap7ps1nHuOViuCiVVljp0PLiumgdvXoAEx96D99eqrAmWUd75Iakg9L/BCJqmq8CR /EQakYo/E7LIvqiwcYc47nt+2b6fdhOOkb2p4KVtKxy0dW0TuC2vbQqUnygChPUzpj iRmyZadKSu0FViOk64oZLgkUObK2QUr5FgyR++9x37V2MjhXWGTZjoV2tbYFamHOOh rxS7+ZlPcewxXpZVQyvabjWVRl8CdhelbEi75MUwJ1XxPMU1uSyxH8qto2Dp0ieejj wgG7kJGm2jl6K5XG+CoRx19ASn53Wzi2dqZgzGz4CJvKx7+hZdlcMy6kD4hML/rrsD p5jwATH5Xp0mw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 05/12] kconfig: make syncconfig update .config regardless of sym_change_count Date: Thu, 5 Jul 2018 11:39:42 +0900 Message-Id: <1530758389-30862-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- 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 Thu Jul 5 02:39:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141098 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1410313ljj; Wed, 4 Jul 2018 19:43:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf0VU64Ip+8vLJYyqR8kNe5Uexom3dtT16InfDxksA4b7ENnlL3ohM/nwAfx5OiqIPw9CUv X-Received: by 2002:a65:6301:: with SMTP id g1-v6mr3889468pgv.324.1530758614034; Wed, 04 Jul 2018 19:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758614; cv=none; d=google.com; s=arc-20160816; b=Zq+QPoxsKSaZ3K5kj2k4bP36BVfrPj32TGLzpCnEv3f0eze1k1GsXSrctErcbqjxim yQMshAdbuRCxPmwT+mcMlw1tyY935vZY67BYyUlrXIolQIPJrueAB5v9Gr/5UPv9N0Fs YTqs4dLHmBvOCgO3bK+Yg/CtGwqdH6Fup2NMAB/C1eKpeKjKKwf9aPcZ+yJG2vjuH08W LHx+Y/JdvmzQrTsdsrHNxfZYeuQVoJoZ98OJHnXBdNFq1l323kh0ZtnPd9wokrWyhyG8 TvaX+YDsBPBr/ACEg12e3bzz3X2AOYKlxnflN9PU7ylaLGglx8e69ukVlx+/Ya5o5P1d Ngng== 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=n4GF68ZS1ymMUwvExQBbpYOK2zqCDJxpiO4aoxZzkGU=; b=WIcGl5jOqC9Khes0ebd2h+STd+ILUoBhvNON/dqw2vQZl1BnLXktSgls5mCbJQ6r24 op3sIXXeWGqjCvB9UqCzaa4+lEAI3/aZW5a3nYzBYB1uv/KPXt4F1X4xDjVAVimr9Wel yl8cUL33s3fOyNfwKrwrOdtE0nornMsiHJ7RW/MAU6lAVp24+e4ynBFPWlfpJdh/zuv1 SFzxpLnF8JyMeFwS5mSNn7IfHr2oc2QfjtgVDX4KLgPjisLDB0bjVfdf5hueZKXTe4k5 cODR3tWVsqK8Me2D8GswtHGUt3MkIshZP+8k97+sx1r+pXu57P6gBN2Eheyjs7Raf7Ew rzsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="FMGkFK/y"; 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 b11-v6si649505plr.42.2018.07.04.19.43.33; Wed, 04 Jul 2018 19:43: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="FMGkFK/y"; 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 S1753539AbeGECnc (ORCPT + 31 others); Wed, 4 Jul 2018 22:43:32 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43989 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264AbeGEClj (ORCPT ); Wed, 4 Jul 2018 22:41:39 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZc028145; Thu, 5 Jul 2018 11:40:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZc028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758401; bh=n4GF68ZS1ymMUwvExQBbpYOK2zqCDJxpiO4aoxZzkGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMGkFK/yGrGgHs5EhXrXeQBuuZ43h/XPosxx6CwmCkN9JBqUeGlOB+4EmGcrlHJe7 bXjlJWFdQXBZj/15IRFRMDoyzhODEfdaEgZ2zlR2N3MNL69xD9D2oB6knP1Dln7rLX C0ZI0IA94oiucMt+XY8YexwHosXr8lj73P6fT8v2zJONdYwU2BvW4FGA3KIYMe/TMK 6NVcRvTUkFmjVpqxHTTJUCXRCwTncZjrlllwEBybvCb1d2ijgdxqUgjViBlIUX7049 y66bQj1rZ/odNH78FNhGGOP5Bhhq8AYvjmSoLWtJdkHxXL8CUMkAl+yy4kbI1igRlK GQ/e+piEiGb/A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 06/12] kconfig: allow all config targets to write auto.conf if missing Date: Thu, 5 Jul 2018 11:39:43 +0900 Message-Id: <1530758389-30862-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- 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 38b3a6c..5af25a0 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -1012,13 +1012,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_file(autoconf_name)) + return 0; + sym_clear_all_valid(); conf_write_dep("include/config/auto.conf.cmd"); @@ -1081,14 +1085,13 @@ int conf_write_autoconf(void) if (rename(".tmpconfig_tristate", name)) return 1; - name = conf_get_autoconfig_name(); - if (mkdir_p(name)) + if (mkdir_p(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 Thu Jul 5 02:39:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141093 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409431ljj; Wed, 4 Jul 2018 19:41:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfzIRhcD0U1CY1F/MjEUCAu//RUv5cj7r1KNJNSnosd+nbF3oy/0ewIicO93BimMtGH6Oja X-Received: by 2002:a17:902:48c8:: with SMTP id u8-v6mr4293823plh.152.1530758510107; Wed, 04 Jul 2018 19:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758510; cv=none; d=google.com; s=arc-20160816; b=H4mO+N2auRXfYbob+8LZEsMusdQS1mLhLCCLkbyIxxR9A6ipDFN3506MJwl1XfaVtt HDAeUl+k1MrR3rPrLMQfJaBh9R8say7AUKdNftfz4tOkgNulcsq4R5MBb8h71HhskdKW gSIhJlyujNn2jNhmOvaS0FDq1vUJw9y4HhuHNyh4+LXF1t9sMmLeY/LEb/BamlxvXAcT yPJNNM3moSiYfl32x/VB85CkiS19lnQlG7+k7f5aqkpuoC2Q4hot2IoNIkeyXqsrjHgx 47I3/A/PXOvQKBrvcgkomzeYS/OTMcr5MrsRB/7aEodMLLwXBdlw2maPQ3WTsfu7mMHN mPPQ== 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=PeVnUtgNC8gbPFeql5sex6hHkYn8Hq42VaeMvYoJ94Q=; b=kfLktBbx35g5N5qhL6BvVUSrBKCvR2prTi55f+54D4M9mYEM2FHQTCbJZZd6HtTDM5 /Sl7GjmoFCfza+xr/tquAaaYb98RFBdhnHPzknpsBW7Po5vLZIUB8Z4zVpb/g+r3mj2T PlRR9k2eIYAmU0Jl7h8xkEJ7UZnarXUJM6LWAH+9Y/bOV2goff6USN4BGozWf9+jCmM3 /HOqFn5cqnSwBVa7BcRa206l6YuBkv3TpSVdCbXmx9wnPXgYDm7HnKe3B5Fb9oU4VT/J JDxcWEN80hhl/VWiHPH9MUU0kZfukPYZA4Mw3lkXntsW0Fa1XQqIbjbjB+8PaNw1ukSw 83QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uxE+PwbT; 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 h12-v6si5123067pfk.156.2018.07.04.19.41.49; Wed, 04 Jul 2018 19:41:50 -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=uxE+PwbT; 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 S1753408AbeGEClq (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:46 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:44119 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753372AbeGECln (ORCPT ); Wed, 4 Jul 2018 22:41:43 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZd028145; Thu, 5 Jul 2018 11:40:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZd028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758402; bh=PeVnUtgNC8gbPFeql5sex6hHkYn8Hq42VaeMvYoJ94Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uxE+PwbTMNq/fcoT4cHNahcP2vjXwhW5fG1p5QfCWBdzwFuY9Wf4u3A822hAZmAuF Lh8eqCKCmH4vlmcQDDxW2H8xJsCTm7x4TcFlWR8KXTsH55cx0pB0fLx5sja0u1xdlF a0pJXzE7Z8EB50snqw2jx6kPdCoxYJhRAwtHSLGN9UVOSWYL8kBvRxXep6xiNnsbIY Ct0KRi9Qo2NuD0kvDYunNJxYJoxgsJL06eOXRk/PX9crBJ/rqyjK8gmtNRtBB2w63H 3rme4QOti3cuZd/PMfvzobCbf5mCST+0AiTLD/WNNYWIl4mzCTh4yXcaJSmlq16AZB leAOS+b1bHZ7Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 07/12] kbuild: use 'include' directive to load auto.conf from top Makefile Date: Thu, 5 Jul 2018 11:39:44 +0900 Message-Id: <1530758389-30862-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/Makefile b/Makefile index d15ac32..ef24068 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 From patchwork Thu Jul 5 02:39:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141092 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409376ljj; Wed, 4 Jul 2018 19:41:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpefMNN+udyWkG363Pod29xKGveAFCKR4koT8EzoZDGCO6UaHgH4zQWTJvFHADK7mpEUVBGk X-Received: by 2002:a62:968f:: with SMTP id s15-v6mr4408056pfk.191.1530758505132; Wed, 04 Jul 2018 19:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758505; cv=none; d=google.com; s=arc-20160816; b=ChGp3Ax3ehuuWv390qmOPpvg0EaST+CRaG14P69N4tbce8nE3RErJ1csG1iH9vDk2O cEEfhR5L+lXNmc+6EjKyjT3qjsfrC4TDSoFZpT/t8BVxNufDfK/AORxPhan0jH+Flzk/ TbmPCfHn1t6B9TB+r53X9AHJwFswnVp5EbPN1NyrPb9+ELsljLIpyIrSfoDJ2AJHC8dF go+Mt7a0DynUTrLRbVwsgldyr+E1ieNOn8MLUQu/WTEMf10Z6OQqwdw5NgZzfA2+pKCs VuGZ622O5AhT1DrU/7KyynsHQkOCoiD5PCHBrorLHbSPyJ2CfoCtCAtt1BDa3pEKxMhP wy/A== 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=5iP+WFhN/JF+QJ1sHqvSaieX4HmPr/nz+jZdqsNYU8I=; b=I0j/rGphinc7QYJT+rxTucTX8MMcG7ikcZA34iHWRMWBEz7PQvv0DmIOqKlXaZOHMo RBReAMYZwGHbnA2RAqj+H6skr2R7mLQc7ecMNtT1ObaZAR5ZM1jTT7Sbt2zZC/VcEbFe 0QNlQZ55bZ8hZEEls2S30eBub6mdBmOJ03mxaTjrOnABahdPG381mzAyq3g20GeCrGii hl/6P0K0hD/J1hlQ5tV2l2nSnfutzhhm73kS6Q+aMtmNrFyikXEUHcKoYdQjPheCqBSp 0f0erBiPz7xIbTD//37qNFQ2U9WbCxrzsB9p8CEI+gTZrgVxEmmnyYRF27t/4fclNtCF hLRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=XL8rJ1+z; 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 h15-v6si804986pgh.566.2018.07.04.19.41.44; Wed, 04 Jul 2018 19:41:45 -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=XL8rJ1+z; 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 S1753383AbeGECln (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:43 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43891 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753062AbeGEClg (ORCPT ); Wed, 4 Jul 2018 22:41:36 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZe028145; Thu, 5 Jul 2018 11:40:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZe028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758403; bh=5iP+WFhN/JF+QJ1sHqvSaieX4HmPr/nz+jZdqsNYU8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XL8rJ1+zSHI2OKUzexfcJNBks8gzC55i7380gz7+FQ+U1PVVjna8ec+i7UGqrf6zN EfvYQ61WvOyBSXmokDGkz1sonGZK8g32tl0rVIMW9bVCPVx9ojsoxHxaPMGktC1lFE CFmh60XXUfx+oRuEzeeVbEoMO7U6V8yqryqWYbAGmSeIv2lIiQ3maZCqaIPUsBzFzO q2p5EKBzLlIdcGDbsblt5h62fJxSce22MdCvKiWoAAecEwuWR+Btdkm/LJvJaDQwLR w+qLRhFHM5x79VLC6QKojXHxoEKq/JP/zaDGb14g4CpZ+8y7OoePnVS3MlIUOnyDpR B7w4ErBiiUwJA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 08/12] kbuild: add .DELETE_ON_ERROR special target Date: Thu, 5 Jul 2018 11:39:45 +0900 Message-Id: <1530758389-30862-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- scripts/Kbuild.include | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index c8156d6..b2d14f1 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 Thu Jul 5 02:39:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141089 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409258ljj; Wed, 4 Jul 2018 19:41:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcI91IVeUCQf0RenEVOvnyLBlJ/FEf1fNZoEy5j+82yFJPoMbQQYjLTeLwfSaxtMG55qSte X-Received: by 2002:a62:9652:: with SMTP id c79-v6mr4469819pfe.114.1530758495092; Wed, 04 Jul 2018 19:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758495; cv=none; d=google.com; s=arc-20160816; b=f8eqIJkfqigiIPIHtaVRLxMmW4qK32MWPvNuHl65UQkuqX1QeSBB4G3Ko/83dipIAh f0o7UamDxoEr2Grj8m8x7DZUaZrOTd4IW8D2AGa9JpuXnYpls4myev6UiC6Dw6t1Ju7C KGwQoiIL9nRkP2TB/X5hGLIpD46Sa+GrwOwKgCfuHiCeNKlz8NpJg/OM1V1ZZ12zzLsn TCyT5FPKKSuK9sdPdNNVy47zoj/ZentImug1I9FpXpRH2mZGf8R3JWzVXMF2sh0Ms3dv CYlgRFufXnso1FtGceWMLQmku98CqwgjGOnxzDmtL8jAk5Yd0aHlINpTeigUoU4N4x2y yv4Q== 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=aKZ/y86rj+Ea3TF1jUMYEhW+7zXkg8xpFB++9mhoS9w=; b=Ny6/pX+xgSo8cfeq2XAstEZZPz9X23WSeydGffskTrbiAM8cq5U8NHzkAookXt/aNg Mz1H81LsB+QNQHWtFN42iyU0Ay1tADNtwkX3x27ogDaID4Ktc6eQwp4Nh/5aTpr2+dyG EbqSYmUJRPjTbW8A52JoDh+O88B7VBOHKKQV5eVxYXa36FGB5KC0G3lH6VPdmShdVMEC meRiGK+cwj2+D0a6gfEBrgm0VctM5c+Z9kXtrJLMGswPYtyIxA7HbCNTZvS7dOIYSbDn Fy0vWjdcv6wqdQxPaSftmWJAIgWcH8O9OtePMe08Oh3gZR9pU8KPqZ+B5z5TTL7GitAM wMvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=NDLdMTCK; 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 o1-v6si4768443plb.279.2018.07.04.19.41.34; Wed, 04 Jul 2018 19:41:35 -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=NDLdMTCK; 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 S1753254AbeGEClc (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:32 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43642 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753155AbeGECl3 (ORCPT ); Wed, 4 Jul 2018 22:41:29 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZf028145; Thu, 5 Jul 2018 11:40:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZf028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758404; bh=aKZ/y86rj+Ea3TF1jUMYEhW+7zXkg8xpFB++9mhoS9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDLdMTCKyTdKDMLMOHII3sdpPsI7b9Dq+pTzhSNpUmK09ORTHk1xJs644NxEDm7q/ Fm+HA7Dt+r8rdjlBrLv3CA1D6CxGDF6EW+YmUeC9enYvATNB0rrCedl+kAHySMVN27 x5Bqf1w3Yqa1J2JgzfvPhyAn6+1E0qDNGzLBtrO+wM8t82lwv8cyJG8LfMO5oJyb1+ kSNt4gfAnnJC1dAHJuNhNV/5alT40lfUH2mU6M67c62wcvVfltWKvK/cjbUM/lU7Lm PeUFpm/ZIQvO5SW4HdhaLhxCivaNmYAKzhRU2gpZS2SPrRG0gLUIMWM9CGBl3Eh9oT kdcqLmH5OHD9w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 09/12] kbuild: do not update config when running install targets Date: Thu, 5 Jul 2018 11:39:46 +0900 Message-Id: <1530758389-30862-10-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- Makefile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index ef24068..f0663c8 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 From patchwork Thu Jul 5 02:39:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141095 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409562ljj; Wed, 4 Jul 2018 19:42:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpemJx0TsMaEykCc/VeMVTKjX9F5ZQNGhmoZ/leZioTj4Op99COeKprVQw40PGlBw3/C9ZNb X-Received: by 2002:a62:1894:: with SMTP id 142-v6mr4448283pfy.49.1530758527857; Wed, 04 Jul 2018 19:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758527; cv=none; d=google.com; s=arc-20160816; b=tBSt/osO8NGgqiXCNJs4GTJecW/z/kpb4Mp+pl+yZ2LlEemaR7krYudbv29weBzKa4 F0fP3UlZbnf2CJlCgCTrCWsXR3HAoX+EeriBNJIddm5k9ITE10Oe61lxGBVFH/cE21+r AkYTuM+TJf5N6bwvAgIlFxGLCrqSW5IQerk5LZzcZjmTOb1nDYpBxl/0iJ7rWFuCenOD VW9Yq1AdxPvOgPLlet58QlAa8QdgOXQyypURYhrrZRiEcfJop4JqX4VFytwAfC3QXDsa vQ5y5kj2uLRTL0njpoWqfVfSirbrIxOiSneMtsMijh0/nR1UDpvpWqYS2MnyHrPAQWXJ +e6g== 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=u6aifoU1n3Vl9zZKiS9dT41GFAXNW8O//Adc4m1xEjM=; b=pGFDJaS8iqbeOdDiPpH95htuImquO7Dh6HfvxSDdEpMbuusSMcK3AMEJG854qk4BNi W+YMbowtOA/6xmF7RPHQ+gfyUrQsPllKRaq70qG2F3n1yhv69Z1s/M7x8EVSdaNNt+Sj 7g03Obh20EJkk4K4YNaMKpqY9T+IFOcgzY2uumiQVXarBXwWiBxrrwA+LAbovFC3nx3M ALVktUH29AxUYtwapJbKkkNxysGleOhPxQ3H/3ttKCXF9Ppi4kTerebrcMF0ylQatICM oFXa/QNf4NPGFQo9IKBT3XG/8BKBCGNkH6iJUQjzV9OobSIIeBgRRnCbsQST/BzISf7j uHAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hd7P61ko; 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 k6-v6si4918089pla.78.2018.07.04.19.42.07; Wed, 04 Jul 2018 19:42:07 -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=hd7P61ko; 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 S1753503AbeGECly (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:54 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:44279 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753428AbeGEClt (ORCPT ); Wed, 4 Jul 2018 22:41:49 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZg028145; Thu, 5 Jul 2018 11:40:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZg028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758405; bh=u6aifoU1n3Vl9zZKiS9dT41GFAXNW8O//Adc4m1xEjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hd7P61kobhNx3enoEetYVWe1VR8R/gofF1UMBHjniW0rKUhG6eNf1194GlU9gqC1u NjcwQbiDomrOJeWbYg08aX3wxHEb8hHaiub//p7e6+OypYrQcV0FjUDhd1wdXj7QCd IUL0wl557nmM1mD38wVjhz37SYvXKjORJPVXHYdQ2kkYEnue1hb9rJ7tazxBVJ3Bna W7RnROCKqb6iGMAX9fQSU1tYWXx7k4KoQrI8lh3wNSv3U4GYBorKq+EVCol0Am6QA/ DBqgFKgiDow61XbjlWlkpEd9GSaohAo07Re47nXbFGOQeOzWTeKUpEM63nkVFYrjxY ovxPyEUycbFUA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 10/12] kbuild: do not update config for 'make kernelrelease' Date: Thu, 5 Jul 2018 11:39:47 +0900 Message-Id: <1530758389-30862-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/Makefile b/Makefile index f0663c8..c258937 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 Thu Jul 5 02:39:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141096 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409667ljj; Wed, 4 Jul 2018 19:42:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdj7GvuXxF8MK+femDaZyHEL94+MwEIm3Kvh7G4yRcAnQcujojpx76rcigsWWFZIIL6UOJw X-Received: by 2002:a62:3d86:: with SMTP id x6-v6mr4431836pfj.192.1530758538615; Wed, 04 Jul 2018 19:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758538; cv=none; d=google.com; s=arc-20160816; b=D7mfOXZINkFH0T2nD5phK9haWzcx9wjc1boyknWf7Z77o3uQztMn78o0b3RMdUeoxb SRtAwI+ODs+jry/wr8zPm9u9FDDhAgRiHlFjOBRwzQd1G8Mowo8ylWKs0l814QN80EUI lmo3i0DO6Xpf/qMF2EdIckx5SlwiQac5JpX++oppWrgjAHaze6lXHIbFwJ+uqqM16CwJ pxARukdsjTkUAfcz/mcpgwppW4fKe/ETg3EKZKJDKqLVmc9QRt1pjplOMbrle9Hlzw7c GzwP3teoJ4XCsVK0mnCyWxjmFLPoZSso3E+Mpu23oXiY2lHHZJUijcScoNjorhf3X3hg NkZA== 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=ff2I2ZXiCD//Ov0MDFFTpaElbwzFiTPXI1cCDc6X+Vk=; b=jaRHIuwib3tXU04WSgzlMdwA5vQ+GdT7YfQp+PG8JCnVVZSLzCgaCTgVbJ/yeXa4I6 U24hLuThY5675HUlMqrK9fW2ppNpHKiQozDAlWBiPAOyZf9SiRVPJ2nx2oApjAru89dz wMmfc9Ol+CGs69C9N+DpLm8BF4Jgq+RYz9mZQe+j3ERss4oDxpUxvQcz4iQvGWTE8eO6 QXFErvCyJJNUXWlsgk5swVzwnuRIIp7cOFRLUOkj3aDpKVbpigutGV9I8AZ1vEf0rp9P E0sGbi+ATMiLWL6UrmeKmzMukX3wLa8nU50C9YjEr+2xS4F8EkVqhfacuHawkCctZTtB qfCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rD6yPOro; 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 67-v6si4981791pfe.49.2018.07.04.19.42.18; Wed, 04 Jul 2018 19:42:18 -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=rD6yPOro; 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 S1753471AbeGEClx (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:53 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:44282 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753430AbeGEClt (ORCPT ); Wed, 4 Jul 2018 22:41:49 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZh028145; Thu, 5 Jul 2018 11:40:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZh028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758405; bh=ff2I2ZXiCD//Ov0MDFFTpaElbwzFiTPXI1cCDc6X+Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rD6yPOrokJFMl6tCmwQzlSYzzrbcN4XgTmcO7vLDqFnrsxIhfU4a0jjfPEfYk+VGa IQcJao70r76VRLQH+zvCg74Vpe1wsJ6Era6blWG7w8DP+Ashqmk302QN9PNa8fyEbR EQuJVSeAEfgYrAkCIwdNnqwZXgrBU0s6fc6C0mG/GLD+LXDNmQDtIaxlYS1lyHSmS8 tLT6Xb0GUTELQ0AiI6TyBt/AiVD1xIW5UmcQWGxCFXhtTAWe9XMJFCoUA4haTnVB7e JFUHcTTa0rsE5kiqldt5w5iBr1wN8SnZunHYlvXP3xejsTaVHV8Xuf/d8k59o1s09d OQq0qEeBq/1VA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 11/12] kbuild: remove auto.conf and tristate.conf from prerequisites Date: Thu, 5 Jul 2018 11:39:48 +0900 Message-Id: <1530758389-30862-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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. We do not have to explicitly list include/config/auto.conf as prerequisites any more. include/config/tristate.conf is generated as a side-effect of syncconfig; if auto.conf exists, tristate.conf exists as well (unless a user does 'rm include/config/tristate.conf') Signed-off-by: Masahiro Yamada --- Makefile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index c258937..c6ab38c4 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: $(Q)$(MAKE) $(modbuiltin)=$* From patchwork Thu Jul 5 02:39:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 141094 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1409481ljj; Wed, 4 Jul 2018 19:41:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfq9xLG4x9cD7sNCRCyxK0RziXpK/H4LeJ2OjXy3g7V11jx87Yr990vpvt2Rz9ggW3P30x7 X-Received: by 2002:a63:4c56:: with SMTP id m22-v6mr1970201pgl.299.1530758517294; Wed, 04 Jul 2018 19:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758517; cv=none; d=google.com; s=arc-20160816; b=La3tdq1WuwLONV2HWfInn9ZgXThbfNUhq//rRx3xd7Y6n4XHEcJ+2k52x9SRcn2Ujj GAKG10ksdUu+opwaVPqtHYnizUAbyqGIXXuhssaocoFMmNtQAL8v1O7jphluvhgM3IeU uJMrb1G3bDn6k/XI3HTGrM14lSzlJM2zgoACmcP3f+vQucPs/PZoM+dlybvhboJvc4AD WZ+VaQ+dWabOrFyaM3l/WqIdmv1B9qW5CICOztMBFwj8uRswY9wfcxpUsYnohTbeT4Iw WXBccY+a693p9yPTLS0St2OHPAtphc938BlsA3Ec6NKnxJh4+DO+Q1xhfbboAk/j6ePd QLBw== 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=HPg1BTuEoSm+fgZpkkuu/EIbOF9VVMU6RAq5/wJ8UsU=; b=f+PtOwWDrVlJt6SrySlnoa8rnIbpHp6Qsdepn70kRLxLvMQTEyEV24oK2QosT0N/uK IPyZKsWw6ItfiAaFk+0OSV/9bxj6mMnvspL8g7Vn0ywyrAZPNa434y9ITVvaP2AQgnMS TGUSFyWZdE7gt0S4WXhQ03FACvT9AnzqfOH/w7cEVJEEOAQqq8d8Xt1jFkTsIKNzl0bK nvP/5UKwdQiveInp+ntSo9MrVo0vHKYa67XMC0xbZsXGsD2O7v6egtzk+oR2GEp+Kr6T V1R6TUFnLZS+5q5ymojp/g8A34mITnJg+b6YypgGNzGdvTYALiYy2N/ZqsJJ+T6QOP4V EC/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FZri1uVy; 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 h12-v6si5123067pfk.156.2018.07.04.19.41.56; Wed, 04 Jul 2018 19:41:57 -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=FZri1uVy; 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 S1753528AbeGECl4 (ORCPT + 31 others); Wed, 4 Jul 2018 22:41:56 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:44271 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753419AbeGEClt (ORCPT ); Wed, 4 Jul 2018 22:41:49 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w652duZi028145; Thu, 5 Jul 2018 11:40:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w652duZi028145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1530758406; bh=HPg1BTuEoSm+fgZpkkuu/EIbOF9VVMU6RAq5/wJ8UsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZri1uVyN8JKa0VRWZJUrz544w9WQ/POH1lATc7T++8NFLf8YbDDfIDQJeQbsb8Bh 2S/3i5IvTzUMnh1tVaMl7RxxJbX8hXk9v1KAku6qiDJAvi4TkpCU/fK1Az3ryjv/no HHUnIzfNHhtolsQKxkp6RoomNwMPoNMUu6dhvs+DkFIcbSpMx2TdVDhvGZfaii4cDP yqWNzXHQvFRnSTaR5j8PXqLPEr6YSrv0T7wVOQ5CqPNrSVIdujbXzFl7DcYD+xuTrG qyw70QR1DSnJRE4o4KZRmYR1HFZfaGkgZYEn37os/PW437d5glTHfasJbq9eAAjFLs /LdQYOvYJcFgQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Dirk Gouders , Ulf Magnusson , Linus Torvalds , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 12/12] kbuild: replace include/config/%.conf with include/config/auto.conf Date: Thu, 5 Jul 2018 11:39:49 +0900 Message-Id: <1530758389-30862-13-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com> References: <1530758389-30862-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 Now that include/config/tristate.conf does not appear in the top-level Makefile. Replace the pattern rule with include/config/auto.conf . Signed-off-by: Masahiro Yamada --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/Makefile b/Makefile index c6ab38c4..58bd78b 100644 --- a/Makefile +++ b/Makefile @@ -631,7 +631,7 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # The actual configuration files used during the build are stored in # include/generated/ and include/config/. Update them if .config is newer than # include/config/auto.conf (which mirrors .config). -include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd +include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else # External modules and some install targets need include/generated/autoconf.h