From patchwork Fri Feb 16 21:41:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 128644 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1006910ljc; Fri, 16 Feb 2018 13:42:34 -0800 (PST) X-Google-Smtp-Source: AH8x226AxRBoIY4hU4wW77TPR2/THuq1ki9oZYPeQjboGXne5uxSBGPOFn89iKwQYZrATImwWfTZ X-Received: by 10.98.35.66 with SMTP id j63mr7357278pfj.140.1518817354653; Fri, 16 Feb 2018 13:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518817354; cv=none; d=google.com; s=arc-20160816; b=kdLBwJW7OsL8GncjpMWfam3KNa3wmihL1KTrT+7uzgWVbZKM2Zdj4cPqPI9i4slrRC rFRfUS9g0b4GJbLD+fMZhzpHjAoRdJLrc5flBtN85YtMs3S6LqquR7roi+LIEBqF3qlm QmtPgLyttM27jMykNObt1R5jeHOFuSon417qdTiT/7U3wGZZypJgy5+SRi0G+iLb08kE Rk/na3HMzDsXxyERHSDRiwVCze7tDCrZcdfrD2LCBclqR6zauPGxjCmcQxot5idhlADU 8L7coq8oImu1fLldX1kzJbUYHhS8ksTC18KRIYrb7D5qtgwd13z1RHZBTcOX8FUn8207 +1kw== 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:arc-authentication-results; bh=NdiXOwE3+fPNEtWzey9w1q7yNkPM+KPTEhOrGKhZWDY=; b=eAwLT9OtPl5PNn410g+tEH5oGM76aaDeK6CmSCMkqyshw9QvYN+WVxgAObFGVAu3Oe u1/UdLs93GVwYXBKtny/3leDMwA0zE8pkLrM8T8uGoqcg8wf5HtOQ5wHWKO0ihGSAtcc 8y7vYUl8LXLsNhHsstHj/QUK9Uk1mubqYPLt2YSbZW3bsX/kUa7qHBEAvLOHcQvdG/3W 5jA1IFrlTl1R7f+VMVV/4NuGMvk+a+KmeMu1lmzYkdnx61oFvniPukmgmnZ9uZ0dAlLz /fbBTSj+Pkcds/2PcrGvjORIYxlPQWSEoeIXGf/stSP+Rjyv6eFLIOURtSUWdNOs7erK B2rg== ARC-Authentication-Results: i=1; mx.google.com; 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 k136si136794pga.44.2018.02.16.13.42.34; Fri, 16 Feb 2018 13:42:34 -0800 (PST) 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; 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 S1751156AbeBPVma (ORCPT + 28 others); Fri, 16 Feb 2018 16:42:30 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:33403 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbeBPVm1 (ORCPT ); Fri, 16 Feb 2018 16:42:27 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MY6Rk-1fHY3V1Gwi-00UvrK; Fri, 16 Feb 2018 22:42:17 +0100 From: Arnd Bergmann To: linux-kbuild@vger.kernel.org, "Yann E. MORIN" Cc: Masahiro Yamada , Michal Marek , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 2/3] Kconfig: improve handling for all{rand, yes, no, }.config fragments Date: Fri, 16 Feb 2018 22:41:12 +0100 Message-Id: <20180216214117.1947175-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180216214117.1947175-1-arnd@arndb.de> References: <20180216214117.1947175-1-arnd@arndb.de> X-Provags-ID: V03:K0:DsySdBUpNFt+e/nzmYwfqzjYZjpj13re5X7xnJx5gyI1Eeyc/8O bvSkfnghSQX638gGp1PkFzOa8i6l8rZvtOekkUkm1aaURKIKb0py02Wfc7Dok9JVN4WJqbD 0SaUzZwHPEVI5+wagKrKHx9y0gdbrZ8M+lGGMHuK6Ejpeg2UAaiyYla/BwdyCY26nNbxjTl 61spnBBv+c9zB3bUKcaZQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:7V4FJictevY=:MRXOYVnDOsHw/syrtJvLz5 xH+99PCW/BbtlcdQB8gIbbMFI0VNPbAITFuTovVKfhL0oUgZbB7L9BHHsPo+rdXny+FZAW4Bv s9jSQRsStEMj/Y8/3+FDPUoBGNNMCk/NXO8ltMLGNTmis+WA1JaG7g2MEEpPu3CE11m+l28h6 ECkJQfaBKgG/uMuXYkKn+UTy+TPONESYjb6vwwINYh2bcpq+1AcCv9nTM+n6J+injfx3CzMot KpYK2r9WNlNIitPlpPTSigwqfa+tSLnk4kQTOpENteXZwxx7lFt7zjQKp/1mtaAoWQLvX3Ffw K7JLV/NehWkd9jGDt3vefPV+J16e4JkN9yOqhRUk/zqX1pOhUZMe1qWrhwDVlPQZxpJ4pKQ77 4O0qapEQjuqCWot40KXVTsUmmmw7P68REVVvwFNagkZ1CQRUbwofsfvZvzpy6B4t59DhYKL9o tXhRh22PqRbEmX1UYkmePzQ62lDtE5UCFdVv4eX4U1enf6EF5afVg18KqYLh9HZKQu1ZDsjxX PROUbAxNVoHrENZqNQCg2592TQElwVrLKbCzPOgscJWXFWgZmOlv2AfoA5IaAmG0qtOpTgz1s EZjvbZn1O/Cq379oGZYMO4piSQK1g+Gxl7GgCUuLXivBeV1bWL8QdPfvUHH1M8MdzsdbMLRU7 MYDtldFcfoHfjKoXrX+O1E5ZYyOsbI4ThWjizDyyZ3e+2d3xJL6YlMxkt01zRwdvzROflqYAd iQy7rFga0BAcJHX4ZOmdN+5Mcz5YuoyWGytcKQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel currently supports two methods of dealing with config fragments in the tree: a) Running "make foo.config" looks for arch/$(ARCH)/configs/foo.config and kernel/configs/foo.config, and applies the defaults from those files on top of the current configuration. b) Running "KCONFIG_ALLCONFIG=1 make randconfig" (or the equivalent allmodconfig/allnoconfig/allyesconfig/alldefconfig) will look for a "allrandconfig.config" file in the current directory or the top of the $(srctree). These are used as defaults before we generate the remaining options. This is rather inconsistent, and prevents us from easily shipping good defaults for "randconfig". I'm extending the logic here so that the second case also looks for the hardcoded file names in the standard directories (first arch/$(ARCH)/configs/, then kernel/configs) in the source tree. Signed-off-by: Arnd Bergmann --- scripts/kconfig/conf.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) -- 2.9.0 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 866369f10ff8..848bf4d15e9a 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -493,8 +493,9 @@ int main(int ac, char **av) { const char *progname = av[0]; int opt; - const char *name, *defconfig_file = NULL /* gcc uninit */; + const char *arch, *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; + char fullname[PATH_MAX+1]; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -621,14 +622,24 @@ int main(int ac, char **av) case randconfig: name = "allrandom.config"; break; default: break; } - if (conf_read_simple(name, S_DEF_USER) && - conf_read_simple("all.config", S_DEF_USER)) { - fprintf(stderr, - _("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"), - name); - exit(1); + /* try ./name, arch/$(ARCH)/configs/name and kernel/config/name */ + if (!conf_read_simple(name, S_DEF_USER)) + break; + arch = getenv("ARCH"); + if (arch) { + snprintf(fullname, sizeof(fullname), "arch/%s/configs/%s", + arch, name); + if (!conf_read_simple(fullname, S_DEF_USER)) + break; } - break; + snprintf(fullname, sizeof(fullname), "kernel/configs/%s", name); + if (!conf_read_simple(fullname, S_DEF_USER)) + break; + + fprintf(stderr, + _("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"), + name); + exit(1); default: break; }