linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/9] ARM: add CONFIG_PHYS_OFFSET default values
Date: Fri, 19 Feb 2016 18:07:25 +0000	[thread overview]
Message-ID: <20160219180725.GB19428@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.20.1602191215140.13632@knanqh.ubzr>

On Fri, Feb 19, 2016 at 12:31:02PM -0500, Nicolas Pitre wrote:
> Yet, the only reason for a default here is to accommodate automatic 
> build tests like randconfig, right?
> 
> If so then this should be "fixed" by having the config system provide 
> built-in symbols that can be tested from kconfig files.  This way you 
> could terminate the above list with:
> 
> 	default 0x00000000 if RANDCONFIG || ALLYESCONFIG
> 
> or the like.

I've suggested in the past that we have kconf read a seed file for
these configurations.  kconf already has most of the required support
for this, we just need to teach it where to read it from.  Maybe
something like this.

 arch/arm/allrandom.config |  1 +
 scripts/kconfig/conf.c    | 61 ++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/arch/arm/allrandom.config b/arch/arm/allrandom.config
index e69de29bb2d1..5a70ef5926f5 100644
--- a/arch/arm/allrandom.config
+++ b/arch/arm/allrandom.config
@@ -0,0 +1 @@
+CONFIG_PHYS_OFFSET=0
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 866369f10ff8..5a4b2d8bbf9a 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -12,6 +12,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <sys/fcntl.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <errno.h>
@@ -489,10 +490,53 @@ static void conf_usage(const char *progname)
 	printf("  --randconfig            New config with random answer to all options\n");
 }
 
+static int try_allconfig(int try_arch, int input_mode)
+{
+	const char *name = NULL;
+	int fd = -1, ret;
+
+	if (try_arch) {
+		const char *srctree = getenv("srctree");
+		const char *arch = getenv("ARCH");
+		
+		fd = open(".", O_DIRECTORY);
+		if (fd == -1) {
+			perror("opening .");
+			return -1;
+		}
+		if (chdir(srctree) == -1 ||
+		    chdir("arch") == -1 ||
+		    chdir(arch) == -1) {
+			perror("chdir");
+			return -1;
+		}
+	}
+
+	switch (input_mode) {
+	case allnoconfig:	name = "allno.config"; break;
+	case allyesconfig:	name = "allyes.config"; break;
+	case allmodconfig:	name = "allmod.config"; break;
+	case alldefconfig:	name = "alldef.config"; break;
+	case randconfig:	name = "allrandom.config"; break;
+	default: break;
+	}
+
+	ret = name ? conf_read_simple(name, S_DEF_USER) : 1;
+	if (ret)
+		ret = conf_read_simple("all.config", S_DEF_USER);
+
+	if (fd >= 0) {
+		fchdir(fd);
+		close(fd);
+	}
+
+	return ret;
+}
+
 int main(int ac, char **av)
 {
 	const char *progname = av[0];
-	int opt;
+	int opt, ret;
 	const char *name, *defconfig_file = NULL /* gcc uninit */;
 	struct stat tmpstat;
 
@@ -601,6 +645,9 @@ int main(int ac, char **av)
 	case allmodconfig:
 	case alldefconfig:
 	case randconfig:
+		ret = try_allconfig(1, input_mode);
+		if (ret < 0)
+			exit(1);
 		name = getenv("KCONFIG_ALLCONFIG");
 		if (!name)
 			break;
@@ -613,16 +660,8 @@ int main(int ac, char **av)
 			}
 			break;
 		}
-		switch (input_mode) {
-		case allnoconfig:	name = "allno.config"; break;
-		case allyesconfig:	name = "allyes.config"; break;
-		case allmodconfig:	name = "allmod.config"; break;
-		case alldefconfig:	name = "alldef.config"; break;
-		case randconfig:	name = "allrandom.config"; break;
-		default: break;
-		}
-		if (conf_read_simple(name, S_DEF_USER) &&
-		    conf_read_simple("all.config", S_DEF_USER)) {
+		ret = try_allconfig(0, input_mode);
+		if (ret) {
 			fprintf(stderr,
 				_("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"),
 				name);

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently@9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2016-02-19 18:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 14:01 [PATCH 0/9] ARM: randconfig testing fallout Arnd Bergmann
2016-02-18 14:01 ` [PATCH 1/9] ARM: ARMv7-M uses BE-8, not BE-32 Arnd Bergmann
2016-02-18 16:06   ` Nicolas Pitre
2016-02-18 16:12     ` Arnd Bergmann
2016-02-19  8:47       ` Vladimir Murzin
2016-02-19 10:17         ` Arnd Bergmann
2016-02-18 14:01 ` [PATCH 2/9] ARM: change NR_IPIS to 8 Arnd Bergmann
2016-02-18 14:26   ` Marc Zyngier
2016-02-18 14:37   ` Russell King - ARM Linux
2016-02-18 15:18     ` Arnd Bergmann
2018-09-18  8:19       ` Chunyan Zhang
2016-02-18 14:01 ` [PATCH 3/9] ARM: make free_memmap as __init Arnd Bergmann
2016-02-18 15:55   ` Nicolas Pitre
2016-02-18 14:01 ` [PATCH 4/9] ARM: add CONFIG_PHYS_OFFSET default values Arnd Bergmann
2016-02-18 16:02   ` Nicolas Pitre
2016-02-19  8:33     ` Arnd Bergmann
2016-02-19 14:29       ` Chris Brandt
2016-02-19 15:34         ` Arnd Bergmann
2016-02-19 16:43           ` Russell King - ARM Linux
2016-02-19 17:18             ` Chris Brandt
2016-02-19 17:57             ` Nicolas Pitre
2016-02-19 16:10       ` Nicolas Pitre
2016-02-19 16:23         ` Arnd Bergmann
2016-02-19 17:31           ` Nicolas Pitre
2016-02-19 18:07             ` Russell King - ARM Linux [this message]
2016-02-19 21:14               ` Arnd Bergmann
2016-02-18 14:01 ` [PATCH 5/9] ARM: atags_to_fdt: don't warn about stack size Arnd Bergmann
2016-02-18 16:13   ` Nicolas Pitre
2016-02-18 16:26     ` [PATCH v2] " Arnd Bergmann
2016-02-18 17:14       ` Nicolas Pitre
2016-02-19 16:58       ` Arnd Bergmann
2016-02-18 14:01 ` [PATCH 6/9] ARM: uaccess: avoid warning for NOMMU in access_ok Arnd Bergmann
2016-02-18 16:15   ` Nicolas Pitre
2016-02-18 14:01 ` [PATCH 7/9] ARM: move NO_DMA definition to ecard.h Arnd Bergmann
2016-02-18 16:17   ` Nicolas Pitre
2016-02-18 14:02 ` [PATCH 8/9] ARM: do not use optimized do_div for ARMv3 Arnd Bergmann
2016-02-18 17:20   ` Nicolas Pitre
2016-02-19  9:03     ` Arnd Bergmann
2016-02-19 18:44       ` Nicolas Pitre
2016-02-18 14:02 ` [PATCH 9/9] ARM: fix kprobe test with CONFIG_CPU_32v3 Arnd Bergmann
2016-02-18 14:21   ` Jon Medhurst (Tixy)
2016-02-18 16:21   ` Nicolas Pitre

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=20160219180725.GB19428@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).