public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-kbuild@vger.kernel.org, "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <mmarek@suse.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 2/3] Kconfig: improve handling for all{rand,yes,no,}.config fragments
Date: Fri, 16 Feb 2018 22:41:12 +0100	[thread overview]
Message-ID: <20180216214117.1947175-3-arnd@arndb.de> (raw)
In-Reply-To: <20180216214117.1947175-1-arnd@arndb.de>

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 <arnd@arndb.de>
---
 scripts/kconfig/conf.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

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;
 	}
-- 
2.9.0


  parent reply	other threads:[~2018-02-16 21:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16 21:41 [PATCH 0/3] fixing the last failures in randconfig builds Arnd Bergmann
2018-02-16 21:41 ` [PATCH 1/3] Kconfig: disable PROFILE_ALL_BRANCHES for compile testing Arnd Bergmann
2018-02-16 22:03   ` Steven Rostedt
2018-02-16 22:14     ` Arnd Bergmann
2018-02-16 22:40       ` Arnd Bergmann
2018-02-16 22:50         ` Steven Rostedt
2018-02-17 13:32       ` Greg Kroah-Hartman
2018-02-20  9:32   ` Masahiro Yamada
2018-02-16 21:41 ` Arnd Bergmann [this message]
2018-02-20  9:26   ` [PATCH 2/3] Kconfig: improve handling for all{rand,yes,no,}.config fragments Masahiro Yamada
2018-02-20  9:59     ` Arnd Bergmann
2018-02-20 17:04       ` Masahiro Yamada
2018-02-21 16:57         ` Arnd Bergmann
2018-02-22 17:27           ` Masahiro Yamada
2018-02-23  4:13           ` Masahiro Yamada
2018-02-16 21:41 ` [PATCH 3/3] Kconfig: add a default allrandom.config Arnd Bergmann
2018-02-20  9:16   ` Masahiro Yamada
2018-02-20 11:11     ` Arnd Bergmann
2018-02-20 16:51       ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180216214117.1947175-3-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=yamada.masahiro@socionext.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox