Re: [PATCH 0/5] introduce K64BIT=y and backward compatibility ARCH={i386,x86_64} for x86

Previous thread: Temporary lockup on loopback block device by Mikulas Patocka on Saturday, November 10, 2007 - 12:51 pm. (11 messages)

Next thread: [PATCH] [POWERPC] Fix CONFIG_SMP=n build error on ppc64 by Olof Johansson on Saturday, November 10, 2007 - 1:59 pm. (2 messages)
From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 1:40 pm

As discussed in another thread the right thing is to add a generic solution
to select between 32 and 64 bit - useable for powerpc, s390, ppc et al.

First step was to teach kconfig how to force 64BIT to a specific value.
The x86 Kconfig file needed a small twist to use 64BIT as the symbol
to seelct 32 or 64 bit.
Then it was simple to add backward compatibility ARCH= settings.

The patchset is not yet pushed out - I will await a bit feedback first.

Shortlog and diffstat.
      kconfig: factor out code in confdata.c
      kconfig: use $K64BIT to set 64BIT with all*config targets
      x86: Use CONFIG_64BIT to select between 32 and 64 bit in Kconfig
      kconfig: document make K64BIT=y in README
      x86: introduce ARCH=i386,ARCH=x86_64 to select 32/64 bit


 Makefile                    |   16 ++++-
 README                      |    2 +
 arch/x86/Kconfig            |   26 +++-----
 arch/x86/Makefile           |   10 ++-
 scripts/kconfig/Makefile    |    2 +-
 scripts/kconfig/conf.c      |    1 +
 scripts/kconfig/confdata.c  |  146 +++++++++++++++++++++++++++----------------
 scripts/kconfig/lkc_proto.h |    1 +
 8 files changed, 124 insertions(+), 80 deletions(-)

The majority of the diffstat is the code refactoring of confdata.c
The rest is simple changes.

Patches follows...
Patches are on top of the patchset to introduce "make ARCH=x86"

	Sam
-

From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 1:43 pm

This patch introduce no functional changes.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 scripts/kconfig/confdata.c |  119 +++++++++++++++++++++++--------------------
 1 files changed, 64 insertions(+), 55 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index b2913e9..e0f402f 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -83,6 +83,68 @@ char *conf_get_default_confname(void)
 	return name;
 }
 
+static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
+{
+	char *p2;
+
+	switch (sym->type) {
+	case S_TRISTATE:
+		if (p[0] == 'm') {
+			sym->def[def].tri = mod;
+			sym->flags |= def_flags;
+			break;
+		}
+	case S_BOOLEAN:
+		if (p[0] == 'y') {
+			sym->def[def].tri = yes;
+			sym->flags |= def_flags;
+			break;
+		}
+		if (p[0] == 'n') {
+			sym->def[def].tri = no;
+			sym->flags |= def_flags;
+			break;
+		}
+		conf_warning("symbol value '%s' invalid for %s", p, sym->name);
+		break;
+	case S_OTHER:
+		if (*p != '"') {
+			for (p2 = p; *p2 && !isspace(*p2); p2++)
+				;
+			sym->type = S_STRING;
+			goto done;
+		}
+	case S_STRING:
+		if (*p++ != '"')
+			break;
+		for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
+			if (*p2 == '"') {
+				*p2 = 0;
+				break;
+			}
+			memmove(p2, p2 + 1, strlen(p2));
+		}
+		if (!p2) {
+			conf_warning("invalid string found");
+			return 1;
+		}
+	case S_INT:
+	case S_HEX:
+	done:
+		if (sym_string_valid(sym, p)) {
+			sym->def[def].val = strdup(p);
+			sym->flags |= def_flags;
+		} else {
+			conf_warning("symbol value '%s' invalid for %s", p, sym->name);
+			return 1;
+		}
+		break;
+	default:
+		;
+	}
+	return 0;
+}
+
 int conf_read_simple(const char *name, int def)
 {
 	FILE *in = NULL;
@@ -213,61 +275,8 @@ load:
 				conf_warning("trying to reassign symbol %s", sym->name);
 				break;
 			}
-			switch (sym->type) {
-			case S_TRISTATE:
-				if (p[0] ...
From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 1:43 pm

The variable K64BIT can now be used to select the
value of CONFIG_64BIT.

This is for example useful for powerpc to generate
allmodconfig for both bit sizes - like this:
make ARCH=powerpc K64BIT=y
make ARCH=powerpc K64BIT=n

To use this the Kconfig file must use "64BIT" as the
config value to select between 32 and 64 bit.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/conf.c      |    1 +
 scripts/kconfig/confdata.c  |   27 +++++++++++++++++++++++++++
 scripts/kconfig/lkc_proto.h |    1 +
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index a38787a..c6bee85 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -591,6 +591,7 @@ int main(int ac, char **av)
 			conf_read_simple(name, S_DEF_USER);
 		else if (!stat("all.config", &tmpstat))
 			conf_read_simple("all.config", S_DEF_USER);
+		conf_set_env_sym("K64BIT", "64BIT", S_DEF_USER);
 		break;
 	default:
 		break;
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index e0f402f..0cb7555 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -145,6 +145,33 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 	return 0;
 }
 
+/* Read an environment variable and assign the vaule to the symbol */
+int conf_set_env_sym(const char *env, const char *symname, int def)
+{
+	struct symbol *sym;
+	char *p;
+	int def_flags;
+
+	p = getenv(env);
+	if (p) {
+		char warning[100];
+		sprintf(warning, "Environment variable (%s = \"%s\")", env, p);
+		conf_filename = warning;
+		def_flags = SYMBOL_DEF << def;
+		if (def == S_DEF_USER) {
+			sym = sym_find(symname);
+			if (!sym)
+				return 1;
+		} else {
+			sym = sym_lookup(symname, 0);
+			if (sym->type == S_UNKNOWN)
+				sym->type = S_OTHER;
+		}
+		conf_set_sym_val(sym, def, def_flags, p);
+	}
+	return 0;
+}
+
 int conf_read_simple(const char *name, int def)
 {
 	FILE *in = NULL;
diff ...
From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 1:43 pm

This change allow us to use the new syntax:
make K64BIT={n,y} to select between 32 and 64 bit.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 arch/x86/Kconfig |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 153c26c..0d86611 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1,34 +1,24 @@
 # x86 configuration
 
 # Select 32 or 64 bit
-choice
-	bool "Select 32 or 64 bit"
-	default X86_32
+config 64BIT
+	bool "64 Bit kernel"
+	default n
+	help
+	  Say yes to build a 64 bit kernel - formerly known as x86_64
+	  Say no to build a 32 bit kernel - formerly known as i386
 
 config X86_32
-	bool "32 bit (former ARCH=i386)"
-	help
-	  This is Linux's home port.  Linux was originally native to the Intel
-	  386, and runs on all the later x86 processors including the Intel
-	  486, 586, Pentiums, and various instruction-set-compatible chips by
-	  AMD, Cyrix, and others.
+	def_bool !64BIT
 
 config X86_64
-	bool "64 bit (former ARCH=x86_64)"
-	help
-	  Port to the x86-64 architecture. x86-64 is a 64-bit extension to the
-	  classical 32-bit x86 architecture. For details see
-	  <http://www.x86-64.org/>.
-endchoice
+	def_bool 64BIT
 
 ### Arch settings
 config X86
 	bool
 	default y
 
-config 64BIT
-	def_bool X86_64
-
 config GENERIC_TIME
 	bool
 	default y
-- 
1.5.3.4.1157.g0e74-dirty

-

From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 1:43 pm

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 README |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 159912c..6622ba1 100644
--- a/README
+++ b/README
@@ -194,6 +194,8 @@ CONFIGURING the kernel:
    "make *config" checks for a file named "all{yes/mod/no/random}.config"
    for symbol values that are to be forced.  If this file is not found,
    it checks for a file named "all.config" to contain forced values.
+   Finally it checks the environment variable K64BIT and set the config
+   symbol "64BIT" to the value of the K64BIT variable.
    
 	NOTES on "make config":
 	- having unnecessary drivers will make the kernel bigger, and can
-- 
1.5.3.4.1157.g0e74-dirty

-

From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 1:43 pm

Using the newly added infrastructure is is now simple
to add addition ARCH= symbols to select between 32 and 64 bit.
Do this for x86.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile                 |   16 +++++++++++++---
 arch/x86/Makefile        |   10 +++++++---
 scripts/kconfig/Makefile |    2 +-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 902082b..5efee80 100644
--- a/Makefile
+++ b/Makefile
@@ -165,8 +165,7 @@ export srctree objtree VPATH TOPDIR
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/        \
-				  -e s/sun4u/sparc64/                    \
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 				  -e s/arm.*/arm/ -e s/sa110/arm/ \
 				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
@@ -198,8 +197,19 @@ CROSS_COMPILE	?=
 UTS_MACHINE 	:= $(ARCH)
 SRCARCH 	:= $(ARCH)
 
+ifeq ($(ARCH),i386)
+        K64BIT := n
+        SRCARCH   := x86
+endif
+ifeq ($(ARCH),x86_64)
+        K64BIT := y
+        SRCARCH := x86
+endif
+export K64BIT
+
+
 # Sanity check the specified ARCH
-ifeq ($(wildcard $(srctree)/arch/$(ARCH)/Kconfig),)
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig),)
         $(error "ERROR: ARCH ($(ARCH)) does not exist (for i386 and x86_64 use ARCH=x86)")
 endif
 
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index ee94224..feba761 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -1,9 +1,13 @@
 # Unified Makefile for i386 and x86_64
 
 # select i386 defconfig file as default config
-KBUILD_DEFCONFIG := i386_defconfig
-
-# # No need to remake these files
+ifeq ($(ARCH),x86)
+        KBUILD_DEFCONFIG := i386_defconfig
+else
+        KBUILD_DEFCONFIG := $(ARCH)_defconfig
+endif
+        
+# No need to remake these files
 $(srctree)/arch/x86/Makefile%: ;
 
 ifeq ...
From: Randy Dunlap
Date: Saturday, November 10, 2007 - 3:23 pm

and if found, sets

---
~Randy
-

From: Randy Dunlap
Date: Saturday, November 10, 2007 - 3:18 pm

---
~Randy
-

From: Guillaume Chazarain
Date: Saturday, November 10, 2007 - 1:55 pm

Hi,


Why not calling the environment variable CONFIG_64BIT,
in preparation of the day when all CONFIG_ variables can
be passed by environment variables?

-- 
Guillaume
-

From: Adrian Bunk
Date: Saturday, November 10, 2007 - 10:14 pm

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-

From: Guillaume Chazarain
Date: Sunday, November 11, 2007 - 5:43 am

Hi Adrian,


Glad you asked. Today, when I want to recompile a kernel while
changing a CONFIG_ option, I manually edit the .config,
remove the appropriate line and then run make oldconfig.
I'd like to be able to do: make oldconfig CONFIG_FOO=bar.

Also, when working on a specific feature of the kernel, I tend to
install both a kernel with the CONFIG_ option set and one with
the option unset. Scripts to do that can twiddle the .config file,
but it would be more convenient if kbuild could avoid that.

As you see, I'm more interested in make oldconfig than
make all*config.

Cheers.

-- 
Guillaume
-

From: Adrian Bunk
Date: Sunday, November 11, 2007 - 6:07 am

first of all it's obvious that there can't be any guarantee that your 
CONFIG_FOO variable will actually get the value bar since dependencies 
might enable or disable it despite you wanting the opposite.

Another important point is that users that know about and see CONFIG_* 

I'm wondering why you don't use two different O= output directories 
instead?

Depending on the CONFIG_ option in question this might even greatly 
reduce your compile times.

And you won't upgrade the kernel you work against that
often compared to working on and testing of your own changes when 


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-

From: Guillaume Chazarain
Date: Sunday, November 11, 2007 - 7:59 am

But kconfig is mainly for kernel hackers, otherwise it would be

/me is filled with wonder at the discovery that .config is saved in the O=
directory. Thanks a lot Adrian for this time saver. So it's not strictly an
output directory, more a build directory.

I still think "make oldconfig CONFIG_FOO=bar" is useful for the occasional
config change, but thanks again for this great tip.

-- 
Guillaume
-

From: Sam Ravnborg
Date: Sunday, November 11, 2007 - 8:30 am

The opposite....
All output is placed there - including the configuration generated by
the *config frontends.
It is not limited to kernel-build output.

One of the use cases for "make O=.." is a setup where the kernel source
is located in a RO location (CDROM, restricted permissions etc).

	Sam
-

From: Guillaume Chazarain
Date: Sunday, November 11, 2007 - 8:55 am

I meant, it's not strictly an output directory as if I do

make O=dir oldconfig

it will _read_ dir/.config, so the O= directory is also used for input.
And yes, I was splitting hairs ;-)

Sorry for the confusion.

-- 
Guillaume
-

From: Randy Dunlap
Date: Saturday, November 10, 2007 - 3:16 pm

What's with <warning> and <conf_filename> here?  I don't see how

---
~Randy
-

From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 3:31 pm

Added to allow conf_warning to print out something usefull.
Like in the following example:

make K64BIT=randy allnoconfig

Environment variable (K64BIT = "randy"):0:warning: symbol value 'randy' invalid for 64BIT


This could look better - but I preferred this version for the
less readable:
(null):0:warning: symbol value 'randy' invalid for 64BIT

Thanks for the other inputs. I am correcting them in
my local patch-set. Before resubmit I willawait further comments.

	Sam
-

From: Sam Ravnborg
Date: Wednesday, November 14, 2007 - 3:08 pm

Hi Roman

The value can be supplied on the command-line so we need to validate input.
The code is a copy of what happen when reading a all.config file and
the functionality should be equal.
Can we make that part simpler too?

By the way - I have never understood the purpose of the flags (S_DEF_USER etc.)

The future plan is to set the architecture as part of the configuration step
and not by ARCH=. The ARCH= notation will continue to be supported
but will merely be a hint about the desired architecture.

The only place where it will play a real effect is when generating
allnoconfig, allyesconfig, allmodconfig, randconfig.

Some consistency check will likely be added - but a pure 'make' will
build the kernel with the configured ARCH and the configured CROSS_COMPILE
setting.

One of the blockers are that kconfig does not support more than one prompt
for a choice symbol. Is this something you can fix - or sketch how to fix it?

	Sam
-

From: Roman Zippel
Date: Thursday, November 15, 2007 - 8:43 am

Hi,


Is there a need for this?
BTW ARCH was already available as a value in the Kconfig files, so setting 
the 64BIT option was already possible without any changes the kconfig 
system, e.g.:

config 64BIT
	bool "64 Bit kernel" if ARCH!="i386" && ARCH!="x86_64"
	default ARCH="x86_64"

The patch below adds some features to it:
- it allows to import any environment variable by specifying "option env=..."
- it generates a dependency on it, so the kernel config is updated if it 
changes.


These are two different uses, when reading a .config only the basic syntax 

It allows to hold multiple configs, a user of it is conf_split_config() 
which loads another config and compares to the current config and updates 
the files under include/config as needed.
It could also be used by front ends to display what actually changed 

The basic idea is to add a name to the choice, so multiple choices can be 
grouped together. This requires some changes to the dependency check to 
make sure one choice option doesn't depend on another (which is currently 
enforced by the syntax).

bye, Roman


Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---
 init/Kconfig                         |    4 ++
 scripts/kconfig/expr.c               |   16 +++++-----
 scripts/kconfig/expr.h               |    5 +--
 scripts/kconfig/lkc.h                |    5 +++
 scripts/kconfig/menu.c               |    7 +++-
 scripts/kconfig/qconf.cc             |   15 ++-------
 scripts/kconfig/symbol.c             |   53 +++++++++++++++++++++++++++++------
 scripts/kconfig/util.c               |   25 +++++++++++++++-
 scripts/kconfig/zconf.gperf          |    1 
 scripts/kconfig/zconf.hash.c_shipped |   45 ++++++++++++++++-------------
 10 files changed, 123 insertions(+), 53 deletions(-)

Index: linux-2.6/init/Kconfig
===================================================================
--- linux-2.6.orig/init/Kconfig
+++ linux-2.6/init/Kconfig
@@ -7,6 +7,10 @@ config DEFCONFIG_LIST
 	default ...
From: Sam Ravnborg
Date: Thursday, November 15, 2007 - 12:25 pm

Yes. We would like to set 64BIT or not in other than x86 cases.

I thought this was not possible but it must have been the limitation

I will finish up your patch and target it for next merge window.

Took a deeper look.
So we can have 4 different set of vlaues where the value indexed by S_DEF_USER
is the one that is actually used and the other three can be used to hold values.

I will try to document this in expr.h
Do you have any suggestions how to properly fix this?

	Sam
-

From: Roman Zippel
Date: Thursday, November 15, 2007 - 12:43 pm

Hi,


Can we please can get some consistency in this?

Why can't this be fixed properly now? You don't even need this patch, just 

It's not, the actual symbol value is set later depending on the dependency 
constraints.

bye, Roman
-

From: Roman Zippel
Date: Thursday, November 15, 2007 - 2:24 pm

Hi,


This can already be set via all.config/allmod.config.
Where is this need coming from? The point is that I don't like to add an 
interface, which is maybe used by two people, who should be perfectly 

I showed you a solution, which requires no patch at all, while your patch 
adds extra functionality which is questionable.
Why is a quick hack preferable over a proper solution? 
Either explain why my solution isn't usable or _please_ revert the K64BIT 

The other function doesn't complain about it either. There is already 
only limited error checking, e.g. there is no complaint that the value 
isn't really set (because it was selected by something else), otherwise 
the .config check during a kernel upgrades would be a lot noisier than it 
already is. Anyone directly editing .config should know what he is doing.

bye, Roman
-

From: Sam Ravnborg
Date: Thursday, November 15, 2007 - 3:06 pm

You suggest just to check ARCH value and not apply your patch. This was
not my initial understanding as was hopefully obvious from my reply.

So you suggest to make the ARCH= setting on the command line mandatory
again even for a configured kernel which is a step backward.

I assume your patch also has this drawback - no?

If user did NOT specify ARCH we should use the kernel configuration - which
your solution fail to do.

If user did specify ARCH and the kernel is configured then what?
-> Ignore the ARCH= setting
-> Warn if they do not match
-> Always adhere to the ARCH setting

Accepting the solution where we check the ARCH as you suggested and
loose the benefits of letting the configuration be the master should
be OK for upcoming kernel release.

	Sam
-

From: Roman Zippel
Date: Thursday, November 15, 2007 - 6:28 pm

Hi,



To make this easy I attached the patch which reverts the problematic 
changes and then you only need this simple change to force the 64BIT value 
for ARCH={i386,x86_64}, otherwise it's set by the user:

bye, Roman

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---
 Makefile         |    3 ++-
 arch/x86/Kconfig |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6/Makefile
===================================================================
--- linux-2.6.orig/Makefile
+++ linux-2.6/Makefile
@@ -165,7 +165,8 @@ export srctree objtree VPATH TOPDIR
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+				  -e s/sun4u/sparc64/ \
 				  -e s/arm.*/arm/ -e s/sa110/arm/ \
 				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
Index: linux-2.6/arch/x86/Kconfig
===================================================================
--- linux-2.6.orig/arch/x86/Kconfig
+++ linux-2.6/arch/x86/Kconfig
@@ -3,8 +3,8 @@ mainmenu "Linux Kernel Configuration for
 
 # Select 32 or 64 bit
 config 64BIT
-	bool "64-bit kernel"
-	default n
+	bool "64-bit kernel" if ARCH="x86"
+	default ARCH="x86_64"
 	help
 	  Say yes to build a 64-bit kernel - formerly known as x86_64
 	  Say no to build a 32-bit kernel - formerly known as i386
From: Randy Dunlap
Date: Thursday, November 15, 2007 - 8:44 pm

Roman,

This all began (AFAIK) because some of us want to continue to be
able to specify ARCH={i386,x86_64} on the (make) command line --
not by using a .config file.  Taking away ARCH= on the command line
is a regression (in some minds, at least), so Sam provided that
capability.  Is that capability still present after this patch?



---
~Randy
-

From: Sam Ravnborg
Date: Thursday, November 15, 2007 - 10:41 pm

Just eyeballing your patch I made following observations:
1) make all*config, randconfig, defconfig is broken on 64-bit boxes
2) A pure code refactoring patch is reverted for no obvious reason
3) Behavioral changes are not documented:
   - 32-bit/64-bit can only be selected in config is you specify ARCH=x86
   - ARCH= takes precedence over kernel config for a configured kernel
4) The changelogs miss title on reverted patches

All points are trivial to fix so I do not say your approach is
bad - just that the supplied patch is not good enough.

I will fix it up tonight and test it.

	Sam
-

From: Roman Zippel
Date: Friday, November 16, 2007 - 5:54 am

Hi,


With your approach you made it impossible to set 64BIT from all*.config,

It was done for the wrong reasons, otherwise the warning before it should 
have been included as well and then the function could have been reused 


What point is there in being able to specify ARCH=x86_64 and then still 

Seriously?

bye, Roman
-

From: Sam Ravnborg
Date: Sunday, January 6, 2008 - 6:26 am

Hi Roman.

Some time ago you sent the following patch which I have started
to review properly and test.
But it triggers a few questions / comments.

For reference (since it is so long ago I have kept most
of the patch but only a few places are commented.

Please get back to me so we can finsih this patch and have it applied.
I will split the patch in two btw.
One where option env= is introduced
and a second patch that kill the three hardcoded variables
in symbol.c (ARCH, KERNELVERSION and UNAME_RELEASE).


As this is in a .h file I assume it should be extern.
But this parts looks wrong. I have added back the case P_RANGE.

Why is this change needed?
I did it like this:
			menu_warn(current_entry,
			          "config %s: redefining environment symbol from '%s' to '%s'",
And like this:
		menu_warn(current_entry,
		          "config %s: environment variable '%s' undefined",
--

From: Roman Zippel
Date: Sunday, January 13, 2008 - 8:49 pm

Hi,



Automatically generated symbols are not saved, this was previously not 

I omitted the prefix, it's inconsistent with other warnings.

bye, Roman
--

From: Sam Ravnborg
Date: Sunday, January 13, 2008 - 10:58 pm

Thanks Roman.
I will test and apply tonight.

Removal of KERNELVERSION in patch #3 is wrong as the frontend
uses KERNELVERSION to display the kernel version in their title.
OK

Thanks,
	Sam
--

From: Roman Zippel
Date: Sunday, January 13, 2008 - 8:50 pm

Add the possibility to import a value from the environment into kconfig
via the option syntax. Beside flexibility this has the advantage
providing proper dependencies.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---
 Documentation/kbuild/kconfig-language.txt |   21 ++++++++++++++
 scripts/kconfig/expr.h                    |    3 +-
 scripts/kconfig/lkc.h                     |    5 +++
 scripts/kconfig/menu.c                    |    5 ++-
 scripts/kconfig/qconf.cc                  |   16 +++-------
 scripts/kconfig/symbol.c                  |   45 ++++++++++++++++++++++++++++++
 scripts/kconfig/util.c                    |   23 ++++++++++++++-
 scripts/kconfig/zconf.gperf               |    1 
 scripts/kconfig/zconf.hash.c_shipped      |   45 ++++++++++++++++--------------
 9 files changed, 129 insertions(+), 35 deletions(-)

Index: linux-2.6/Documentation/kbuild/kconfig-language.txt
===================================================================
--- linux-2.6.orig/Documentation/kbuild/kconfig-language.txt
+++ linux-2.6/Documentation/kbuild/kconfig-language.txt
@@ -127,6 +127,27 @@ applicable everywhere (see syntax).
   used to help visually separate configuration logic from help within
   the file as an aid to developers.
 
+- misc options: "option" <symbol>[=<value>]
+  Various less common options can be defined via this option syntax,
+  which can modify the behaviour of the menu entry and its config
+  symbol. These options are currently possible:
+
+  - "defconfig_list"
+    This declares a list of default entries which can be used when
+    looking for the default configuration (which is used when the main
+    .config doesn't exists yet.)
+
+  - "modules"
+    This declares the symbol to be used as the MODULES symbol, which
+    enables the third modular state for all config symbols.
+
+  - "env"=<value>
+    This imports the environment variable into Kconfig. It behaves like
+    a default, except that the value comes from the environment, ...
From: Roman Zippel
Date: Sunday, January 13, 2008 - 8:51 pm

Use the environment option to provide the ARCH symbol.
Remove the unused KERNELVERSION symbol.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---
 init/Kconfig             |    4 ++++
 scripts/kconfig/symbol.c |   14 --------------
 2 files changed, 4 insertions(+), 14 deletions(-)

Index: linux-2.6/init/Kconfig
===================================================================
--- linux-2.6.orig/init/Kconfig
+++ linux-2.6/init/Kconfig
@@ -1,3 +1,7 @@
+config ARCH
+	string
+	option env="ARCH"
+
 config DEFCONFIG_LIST
 	string
 	depends on !UML
Index: linux-2.6/scripts/kconfig/symbol.c
===================================================================
--- linux-2.6.orig/scripts/kconfig/symbol.c
+++ linux-2.6/scripts/kconfig/symbol.c
@@ -56,20 +56,6 @@ void sym_init(void)
 
 	uname(&uts);
 
-	sym = sym_lookup("ARCH", 0);
-	sym->type = S_STRING;
-	sym->flags |= SYMBOL_AUTO;
-	p = getenv("ARCH");
-	if (p)
-		sym_add_default(sym, p);
-
-	sym = sym_lookup("KERNELVERSION", 0);
-	sym->type = S_STRING;
-	sym->flags |= SYMBOL_AUTO;
-	p = getenv("KERNELVERSION");
-	if (p)
-		sym_add_default(sym, p);
-
 	sym = sym_lookup("UNAME_RELEASE", 0);
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
--

From: Randy Dunlap
Date: Saturday, November 10, 2007 - 3:33 pm

Hi Sam,
Looks good to me and should satisfy our habits^w usages models.

The one minor question is the environment variable name (K64BIT or
something else, like Guillaume brought up).  Personally I don't
care how it's spelled.  IOW, K64BIT is sufficient, but if there is a
goal to be able to place any CONFIG_symbol on the command line or
as an env. variable, they might as well all be named with CONFIG_*.

Thanks,
---
~Randy
-

From: Sam Ravnborg
Date: Saturday, November 10, 2007 - 3:50 pm

The K64BIT varibale came up because it is more unique than CONFIG_64BIT.
Google turned up less than 20 hits[1] on K64BIT but 14900 on CONFIG_64BIT.
And I dunno if some people source their .config or other crazy stuff.

And then K64BIT was easier to type...
But if we assume this is internal stuff only then we could go
for the longer version and I will then suggest to prefix
the CONFIG_ symbol with K like in KCONFIG_64BIT which
has no hits with google right now!

I do not see this extended to 'any' CONFIG_ symbol
but maybe the 4 most important ones.
[64BIT, SMP, PREEMPT, ?]

[1] before my posting - now we are up to ~80.

	Sam
-

From: Adrian Bunk
Date: Saturday, November 10, 2007 - 10:09 pm

I seriously question this would be "the right thing".

32/64bit isn't that special that this and only this option would require
special casing, and the KISS principle of having only one way to specify 

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-

From: Sam Ravnborg
Date: Sunday, November 11, 2007 - 4:54 am

"The right thing" in the correct context.
It was discussed to keep ARCH={i386,x86_64} and the point I have
is that if we are going to extend ARCH=... to be useable to
specify kernel bit size then it should be done in a generic way
and not like it was done before on x86.

I do not consider the discussion about keeping/dropping
ARCH={i386,x86_64} as concluded.

And if we decide on keeping ARCH={i386,x86_64} then I have
questioned the semantics. Clear opinions are missing..

ARCH= semantic

Impact                   before             now
================================================
32/64 bit                 yes               yes
bzImage location          yes               no
different Kconfig files   yes               no
decide defconfig          yes               yes
asm symlink               no                no
build option              yes               no [1]

[did I miss anything? I think I did]

[1] ARCH=... select 32/64-bit during configuration.
    There is no difference between ARCH={x86,i386,x86_64}
    when building the kernel because the 32/64 bit
    choice is done at configuration time.

The table above reflect the [now] semantics with the
patches that is present at lkml.

And the patch needed to implment the above
semantic (after the preparational stuff which
is generic) are:

$ git diff --stat HEAD~1..HEAD
 Makefile                 |   18 ++++++++++++++----
 arch/x86/Makefile        |    8 ++++++--
 scripts/kconfig/Makefile |    2 +-
 3 files changed, 21 insertions(+), 7 deletions(-)


The scripts/kconfig/Makefile change is a bugfix that maybe
should be included in another patch. It is not x86 specific.

So 19 additional lines and 5 deleted lines to introduce the
ARCH= semantics above.

	Sam

-

From: Roman Zippel
Date: Sunday, November 11, 2007 - 7:47 pm

Hi,


Could you please point me to this discussion?
Thanks.

bye, Roman
-

From: Sam Ravnborg
Date: Sunday, November 11, 2007 - 10:23 pm

It starts with this post from Jeff Garzik:
http://lkml.org/lkml/2007/11/9/274

	Sam
-

Previous thread: Temporary lockup on loopback block device by Mikulas Patocka on Saturday, November 10, 2007 - 12:51 pm. (11 messages)

Next thread: [PATCH] [POWERPC] Fix CONFIG_SMP=n build error on ppc64 by Olof Johansson on Saturday, November 10, 2007 - 1:59 pm. (2 messages)