Skip to contentSkip to conversation

Add ``cloneconfig'' target

PATCH In review Jeff Mahoney 5 participants 23 messages Feb 25, 2011 – Feb 27, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add ``cloneconfig'' target

Cloneconfig takes the first configuration it finds which appears to belong to the running kernel, and configures the kernel sources to match this configuration as closely as possible.

---
 scripts/kconfig/Makefile |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
scripts/kconfig/Makefile +17 -0
@@ -99,6 +99,23 @@ PHONY += allnoconfig allyesconfig allmod
 
 allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
+ 
+UNAME_RELEASE := $(shell uname -r)
+CLONECONFIG := $(firstword $(wildcard /proc/config.gz \
+				      /lib/modules/$(UNAME_RELEASE)/.config \
+				      /etc/kernel-config \
+				      /boot/config-$(UNAME_RELEASE)))
+cloneconfig: $(obj)/conf
+	$(Q)case "$(CLONECONFIG)" in				\
+	'')	echo -e "The configuration of the running"	\
+			"kernel could not be determined\n";	\
+		false ;;					\
+	*.gz)	gzip -cd $(CLONECONFIG) > .config.running ;;	\
+	*)	cat $(CLONECONFIG) > .config.running ;;		\
+	esac &&							\
+	echo -e "Cloning configuration file $(CLONECONFIG)\n"
+	$(Q)$< -D .config.running arch/$(SRCARCH)/Kconfig
+
 
 PHONY += listnewconfig oldnoconfig savedefconfig defconfig
 
Signature · 2 lines
Jeff Mahoney
SUSE Labs
#1 lore raw
Quoted 23 lines · Jeff Mahoney

Cloneconfig takes the first configuration it finds which appears to belong to the running kernel, and configures the kernel sources to match this configuration as closely as possible.

---
 scripts/kconfig/Makefile |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
scripts/kconfig/Makefile +7 -0
@@ -99,6 +99,23 @@ PHONY += allnoconfig allyesconfig allmod
 
 allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
+ 
+UNAME_RELEASE := $(shell uname -r)
+CLONECONFIG := $(firstword $(wildcard /proc/config.gz \
+				      /lib/modules/$(UNAME_RELEASE)/.config \
+				      /etc/kernel-config \
+				      /boot/config-$(UNAME_RELEASE)))
+cloneconfig: $(obj)/conf

scripts/kconfig/Makefile PHONY += allnoconfig allyesconfig allmod · line 118

Quoted 10 lines
scripts/kconfig/Makefile +10 -0
+	$(Q)case "$(CLONECONFIG)" in				\
+	'')	echo -e "The configuration of the running"	\
+			"kernel could not be determined\n";	\
+		false ;;					\
+	*.gz)	gzip -cd $(CLONECONFIG) > .config.running ;;	\
+	*)	cat $(CLONECONFIG) > .config.running ;;		\
+	esac &&							\
+	echo -e "Cloning configuration file $(CLONECONFIG)\n"
+	$(Q)$< -D .config.running arch/$(SRCARCH)/Kconfig
+

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
string
depends on !UML
option defconfig_list
default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
default "arch/$ARCH/defconfig"

It would be better to teach kconfig to read /proc/config.gz and then add it to the list above.

This list is used if you just type "make enuconfig" without any configuration.

Sam

#2 lore raw

PATCH 1/2 kconfig: add support for type handlers

This patch adds type handlers for compressed config files. Initial support provides callouts for gzip and bzip2, but there's no reason others could be added if demand is there.

This is intended to allow /proc/config.gz be a configuration source for 'make oldconfig' when .config is absent.

---

 scripts/kconfig/zconf.l |   50 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)
scripts/kconfig/zconf.l +48 -2
@@ -256,6 +256,44 @@ static void zconf_endhelp(void)
 	BEGIN(INITIAL);
 }
 
+static const struct type_handler {
+	const char *suffix;
+	const char *command;
+} type_handlers[] = {
+	{
+		.suffix = ".gz",
+		.command = "zcat",
+	},
+	{
+		.suffix = ".bz2",
+		.command = "bzcat",
+	},
+	/* Whatever other algorithms you like */
+	{}
+};
+
+static const struct type_handler *get_type_handler(const char *name)
+{
+	char *p = rindex(name, '.');
+	if (p) {
+		const struct type_handler *ops = type_handlers;
+		for (ops = type_handlers; ops->suffix; ops++) {
+			if (!strcasecmp(ops->suffix, p))
+				break;
+		}
+		if (!ops->suffix)
+			return NULL;
+		return ops;
+	}
+	return NULL;
+}
+
+static FILE *zconf_popen(const char *command, const char *name)
+{
+	char cmdbuf[PATH_MAX + strlen(command) + 2];
+	snprintf(cmdbuf, sizeof(cmdbuf), "%s %s", command, name);
+	return popen(cmdbuf, "r");
+}
 
 /*
  * Try to open specified file with following names:
@@ -267,15 +305,23 @@ static void zconf_endhelp(void)
  */
 FILE *zconf_fopen(const char *name)
 {
+	const struct type_handler *handler = get_type_handler(name);
 	char *env, fullname[PATH_MAX+1];
 	FILE *f;
 
-	f = fopen(name, "r");
+	if (handler)
+		f = zconf_popen(handler->command, name);
+	else
+		f = fopen(name, "r");
+
 	if (!f && name != NULL && name[0] != '/') {
 		env = getenv(SRCTREE);
 		if (env) {
 			sprintf(fullname, "%s/%s", env, name);
-			f = fopen(fullname, "r");
+			if (handler)
+				f = zconf_popen(handler->command, fullname);
+			else
+				f = fopen(fullname, "r");
 		}
 	}
 	return f;
Signature · 2 lines
Jeff Mahoney
SUSE Labs
#5 lore raw

PATCH 2/2 kconfig: Use /proc/config.gz as a configuration source

In reply to Sam Ravnborg

This patch uses the type handlers to add /proc/config.gz as a configuration source when 'make oldconfig' is used with a missing .config

---

 init/Kconfig |    1 +
 1 file changed, 1 insertion(+)
init/Kconfig +1 -0
@@ -26,6 +26,7 @@ config DEFCONFIG_LIST
 	depends on !UML
 	option defconfig_list
 	default "/lib/modules/$UNAME_RELEASE/.config"
+	default "/proc/config.gz"
 	default "/etc/kernel-config"
 	default "/boot/config-$UNAME_RELEASE"
 	default "$ARCH_DEFCONFIG"
Signature · 2 lines
Jeff Mahoney
SUSE Labs
#3 lore raw

Re: [PATCH 1/2] kconfig: add support for type handlers

In reply to Jeff Mahoney

Hi,

Quoted 7 lines · Jeff Mahoney

 This patch adds type handlers for compressed config files. Initial support provides callouts for gzip and bzip2, but there's no reason others could be added if demand is there.

 This is intended to allow /proc/config.gz be a configuration source for 'make oldconfig' when .config is absent.

this can be trivially scripted, any reason it _has_ to be done within kconfig ?

- Arnaud

Quoted 88 lines

---

 scripts/kconfig/zconf.l |   50 ++++++++++++++++++++++++++++++++++++++++++++++--

 1 file changed, 48 insertions(+), 2 deletions(-)
scripts/kconfig/zconf.l +48 -3
@@ -256,6 +256,44 @@ static void zconf_endhelp(void)
        BEGIN(INITIAL);
  }
 
+static const struct type_handler {
+       const char *suffix;
+       const char *command;
+} type_handlers[] = {
+       {
+               .suffix = ".gz",
+               .command = "zcat",
+       },
+       {
+               .suffix = ".bz2",
+               .command = "bzcat",
+       },
+       /* Whatever other algorithms you like */
+       {}
+};
+
+static const struct type_handler *get_type_handler(const char *name)
+{
+       char *p = rindex(name, '.');
+       if (p) {
+               const struct type_handler *ops = type_handlers;
+               for (ops = type_handlers; ops->suffix; ops++) {
+                       if (!strcasecmp(ops->suffix, p))
+                               break;
+               }
+               if (!ops->suffix)
+                       return NULL;
+               return ops;
+       }
+       return NULL;
+}
+
+static FILE *zconf_popen(const char *command, const char *name)
+{
+       char cmdbuf[PATH_MAX + strlen(command) + 2];
+       snprintf(cmdbuf, sizeof(cmdbuf), "%s %s", command, name);
+       return popen(cmdbuf, "r");
+}
 
  /*
  * Try to open specified file with following names:
@@ -267,15 +305,23 @@ static void zconf_endhelp(void)
  */
  FILE *zconf_fopen(const char *name)
  {
+       const struct type_handler *handler = get_type_handler(name);
        char *env, fullname[PATH_MAX+1];
        FILE *f;
 
-       f = fopen(name, "r");
+       if (handler)
+               f = zconf_popen(handler->command, name);
+       else
+               f = fopen(name, "r");
+
        if (!f && name != NULL && name[0] != '/') {
                env = getenv(SRCTREE);
                if (env) {
                        sprintf(fullname, "%s/%s", env, name);
-                       f = fopen(fullname, "r");
+                       if (handler)
+                               f = zconf_popen(handler->command, fullname);
+                       else
+                               f = fopen(fullname, "r");
                }
        }
        return f;
 
--

Jeff Mahoney
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 1/2] kconfig: add support for type handlers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Arnaud Lacombe

Hi,

Quoted 7 lines · Jeff Mahoney

This patch adds type handlers for compressed config files. Initial support provides callouts for gzip and bzip2, but there's no reason others could be added if demand is there.

This is intended to allow /proc/config.gz be a configuration source for 'make oldconfig' when .config is absent.

this can be trivially scripted, any reason it _has_ to be done within kconfig ?

This is what the original patch I posted did, and I was asked to teach kconfig how to do it itself.

- -Jeff

Quoted 80 lines
Quoted 80 lines

---

 scripts/kconfig/zconf.l |   50 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)
scripts/kconfig/zconf.l +48 -2
@@ -256,6 +256,44 @@ static void zconf_endhelp(void)
       BEGIN(INITIAL);
 }
 
+static const struct type_handler {
+       const char *suffix;
+       const char *command;
+} type_handlers[] = {
+       {
+               .suffix = ".gz",
+               .command = "zcat",
+       },
+       {
+               .suffix = ".bz2",
+               .command = "bzcat",
+       },
+       /* Whatever other algorithms you like */
+       {}
+};
+
+static const struct type_handler *get_type_handler(const char *name)
+{
+       char *p = rindex(name, '.');
+       if (p) {
+               const struct type_handler *ops = type_handlers;
+               for (ops = type_handlers; ops->suffix; ops++) {
+                       if (!strcasecmp(ops->suffix, p))
+                               break;
+               }
+               if (!ops->suffix)
+                       return NULL;
+               return ops;
+       }
+       return NULL;
+}
+
+static FILE *zconf_popen(const char *command, const char *name)
+{
+       char cmdbuf[PATH_MAX + strlen(command) + 2];
+       snprintf(cmdbuf, sizeof(cmdbuf), "%s %s", command, name);
+       return popen(cmdbuf, "r");
+}
 
 /*
 * Try to open specified file with following names:
@@ -267,15 +305,23 @@ static void zconf_endhelp(void)
 */
 FILE *zconf_fopen(const char *name)
 {
+       const struct type_handler *handler = get_type_handler(name);
       char *env, fullname[PATH_MAX+1];
       FILE *f;
 
-       f = fopen(name, "r");
+       if (handler)
+               f = zconf_popen(handler->command, name);
+       else
+               f = fopen(name, "r");
+
       if (!f && name != NULL && name[0] != '/') {
               env = getenv(SRCTREE);
               if (env) {
                       sprintf(fullname, "%s/%s", env, name);
-                       f = fopen(fullname, "r");
+                       if (handler)
+                               f = zconf_popen(handler->command, fullname);
+                       else
+                               f = fopen(fullname, "r");
               }
       }
       return f;
Quoted 8 lines
Quoted 8 lines

--
Jeff Mahoney
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAk1pOBcACgkQLPWxlyuTD7JlJACfVPh3NV+X5cz7l8BYgxkf1E2j mGsAoIpMp0AMjIjl5mm3OaR2H3N65PpP
=Sd++
-----END PGP SIGNATURE-----

#6 lore raw
In reply to Sam Ravnborg

Hi,

Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
       string
       depends on !UML
       option defconfig_list
       default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
       default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
       default "arch/$ARCH/defconfig"

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken. Say I try to build a Linux kernel on a system with has its own non-kconfig `/etc/kernel-config', I guess this would make the configuration fail.

Quoted 3 lines

It would be better to teach kconfig to read /proc/config.gz and then add it to the list above.

Why ? Thing should be kept simple. kconfig's job is not to know about the trillion file format which exist in the world, even more if the implementation is made by building a command[0], executing it in a separate process and reading the output. This is the shell's job. What may be useful in the contrary would be to eventually teach kconfig to read from <stdin>.

- Arnaud

[0]: which is built depending on an extension, which is even more awful ...

Quoted 9 lines

This list is used if you just type "make enuconfig" without any configuration.

       Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#22 lore raw
In reply to Jeff Mahoney

Hi,

Quoted 16 lines · Jeff Mahoney

Cloneconfig takes the first configuration it finds which appears to belong to the running kernel, and configures the kernel sources to match this configuration as closely as possible.

---
 scripts/kconfig/Makefile |   17 +++++++++++++++++

 1 file changed, 17 insertions(+)
scripts/kconfig/Makefile +0 -0
@@ -99,6 +99,23 @@ PHONY += allnoconfig allyesconfig allmod
 

 allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf $< --$@ $(Kconfig)

scripts/kconfig/Makefile PHONY += allnoconfig allyesconfig allmod · line 111

Quoted 10 lines
scripts/kconfig/Makefile +10 -0
+
+UNAME_RELEASE := $(shell uname -r)
+CLONECONFIG := $(firstword $(wildcard /proc/config.gz \
+                                     /lib/modules/$(UNAME_RELEASE)/.config \
+                                     /etc/kernel-config \
+                                     /boot/config-$(UNAME_RELEASE)))
+cloneconfig: $(obj)/conf
+       $(Q)case "$(CLONECONFIG)" in                            \
+       '')     echo -e "The configuration of the running"      \
+                       "kernel could not be determined\n";     \

You do not need the '\n', nor the '-e', echo(1) appends a newline by default.

Quoted 5 lines

+               false ;;                                        \
+       *.gz)   gzip -cd $(CLONECONFIG) > .config.running ;;    \
+       *)      cat $(CLONECONFIG) > .config.running ;;         \
+       esac &&                                                 \
+       echo -e "Cloning configuration file $(CLONECONFIG)\n"

see above.

Quoted 13 lines

+       $(Q)$< -D .config.running arch/$(SRCARCH)/Kconfig +

 PHONY += listnewconfig oldnoconfig savedefconfig defconfig

--
Jeff Mahoney
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#7 lore raw
In reply to Arnaud Lacombe
Quoted 15 lines · Arnaud Lacombe

Hi,

Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
       string
       depends on !UML
       option defconfig_list
       default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
       default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
       default "arch/$ARCH/defconfig"

Quoted 2 lines

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken.

The above allows the average user to just type "make menuconfig" and then the configuration of the current kernel is presented to the user. This is convinient in many cases.
We know the /proc/config.gz is an incresingly popular way to gain access to the configuration of the running kernel. So extending the already know and working way to obtaing the configuration of the running kernel to suppport /proc/config.gz is logical. The fact that the configuration is gzipped does not warrant a new option to deal with this that almost duplicate the existing functionality.

Sam

#14 lore raw
In reply to Arnaud Lacombe

Hi,

Quoted 15 lines · Arnaud Lacombe

Hi,

Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
       string
       depends on !UML
       option defconfig_list
       default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
       default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
       default "arch/$ARCH/defconfig"

Quoted 4 lines

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken. Say I try to build a Linux kernel on a system with has its own non-kconfig `/etc/kernel-config', I guess this would make the configuration fail.

It is true that it may be annoying/unexpected, but the most common use case is to build the kernel in the same machine which will run it.

In addition, it does not make the configuration fail, you just get the machine's configuration. If you typed "menuconfig" instead of "oldconfig" it means that you didn't have any configuration at all in the first place, so if you are building a kernel for some other machine you will have to configure through all the options manually anyway.

Quoted 10 lines
Quoted 4 lines

It would be better to teach kconfig to read /proc/config.gz and then add it to the list above.

Why ? Thing should be kept simple. kconfig's job is not to know about the trillion file format which exist in the world, even more if the implementation is made by building a command[0], executing it in a separate process and reading the output. This is the shell's job. What may be useful in the contrary would be to eventually teach kconfig to read from <stdin>.

/proc/config.gz is provided by the kernel and its format is defined by kconfig itself which is, as well, part of the kernel (it is not one random format from a pool of a trillion), so it will be nice if kconfig learns how to read its own configuration from there.

kconfig only knows about config files (one format). The fact that it's gzipped its irrelevant, any reasonable machine capable of building the kernel has gzip installed.

Quoted 20 lines

 - Arnaud

[0]: which is built depending on an extension, which is even more awful ...

Quoted 9 lines

This list is used if you just type "make enuconfig" without any configuration.

       Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

#15 lore raw

Hi,

Quoted 8 lines · Miguel Ojeda
Quoted 6 lines · Arnaud Lacombe

Why ? Thing should be kept simple. kconfig's job is not to know about the trillion file format which exist in the world, even more if the implementation is made by building a command[0], executing it in a separate process and reading the output. This is the shell's job. What may be useful in the contrary would be to eventually teach kconfig to read from <stdin>.

Quoted 5 lines

/proc/config.gz is provided by the kernel and its format is defined by kconfig itself which is, as well, part of the kernel (it is not one random format from a pool of a trillion), so it will be nice if kconfig learns how to read its own configuration from there.

your point being ? kconfig is not only used by the Linux kernel, and you cannot expect the feature to only be used in the cozy Linux kernel environment.

Quoted 4 lines

kconfig only knows about config files (one format). The fact that it's gzipped its irrelevant, any reasonable machine capable of building the kernel has gzip installed.

again, the average user has no interaction with kconfig directly, (s)he uses the top level Makefile target at best. The original patch of Jeff is way better than any hack to read a gzip file from kconfig. KISS and please don't reinvert the wheel.

- Arnaud

#8 lore raw
In reply to Sam Ravnborg

Hi,

Quoted 16 lines · Sam Ravnborg
Quoted 15 lines · Arnaud Lacombe

Hi,

Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
       string
       depends on !UML
       option defconfig_list
       default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
       default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
       default "arch/$ARCH/defconfig"

Quoted 5 lines
Quoted 2 lines

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken.

The above allows the average user to just type "make menuconfig" and then the configuration of the current kernel is presented to the user.

I'm sure there is a way to do this from the Kbuild and not from the Kconfig.

Quoted 1 line

This is convinient in many cases.

this is a subjective point of view. I do build a lot of kernel for anything but the current machine I'm using.

Quoted 4 lines

We know the /proc/config.gz is an incresingly popular way to gain access to the configuration of the running kernel. So extending the already know and working way to obtaing the configuration of the running kernel to suppport /proc/config.gz is logical.

Then again, this should be doable from Kbuild.

Quoted 4 lines

The fact that the configuration is gzipped does not warrant a new option to deal with this that almost duplicate the existing functionality.

agree.

- Arnaud

#16 lore raw
In reply to Arnaud Lacombe
Quoted 12 lines · Arnaud Lacombe

Hi,

Quoted 8 lines · Miguel Ojeda
Quoted 6 lines · Arnaud Lacombe

Why ? Thing should be kept simple. kconfig's job is not to know about the trillion file format which exist in the world, even more if the implementation is made by building a command[0], executing it in a separate process and reading the output. This is the shell's job. What may be useful in the contrary would be to eventually teach kconfig to read from <stdin>.

Quoted 8 lines
Quoted 5 lines

/proc/config.gz is provided by the kernel and its format is defined by kconfig itself which is, as well, part of the kernel (it is not one random format from a pool of a trillion), so it will be nice if kconfig learns how to read its own configuration from there.

your point being ? kconfig is not only used by the Linux kernel, and you cannot expect the feature to only be used in the cozy Linux kernel environment.

My point was that supporting reading from a .gz file is not anywhere near "knowing about the trillion file format which exist in the world" (and I was not talking about a "hack", see below).

Quoted 9 lines
Quoted 5 lines

kconfig only knows about config files (one format). The fact that it's gzipped its irrelevant, any reasonable machine capable of building the kernel has gzip installed.

again, the average user has no interaction with kconfig directly, (s)he uses the top level Makefile target at best. The original patch of Jeff is way better than any hack to read a gzip file from kconfig. KISS and please don't reinvert the wheel.

I agree with that. I understood that you were against adding support for reading /proc/config.gz whether patching the Makefile or teaching kconfig how to do that.

Miguel

Quoted 3 lines

 - Arnaud

#17 lore raw

Hi,

Quoted 8 lines · Miguel Ojeda
Quoted 7 lines · Arnaud Lacombe
Quoted 5 lines · Miguel Ojeda

/proc/config.gz is provided by the kernel and its format is defined by kconfig itself which is, as well, part of the kernel (it is not one random format from a pool of a trillion), so it will be nice if kconfig learns how to read its own configuration from there.

Quoted 7 lines
Quoted 3 lines

your point being ? kconfig is not only used by the Linux kernel, and you cannot expect the feature to only be used in the cozy Linux kernel environment.

My point was that supporting reading from a .gz file is not anywhere near "knowing about the trillion file format which exist in the world"

Well, Jeff's patch is already about gzip and bzip2. Soon it will be compress, xz, zip, rar, then rzip, lzma, 7z ...

- Arnaud

#9 lore raw
In reply to Arnaud Lacombe

Hi,

Quoted 6 lines · Arnaud Lacombe
Quoted 4 lines

The fact that the configuration is gzipped does not warrant a new option to deal with this that almost duplicate the existing functionality.

agree.

Let me precise, as there may be confusion. I agree about the new target issue, but definitively think this kconfig "option" (more a hack, which required a special option within kconfig) should be handled by Kbuild, not Kconfig, ie. I'd discard "option defconfig_list". File decompression (and eventually which config to pick) should be done prior to the invocation of Kconfig.

- Arnaud

#20 lore raw
In reply to Arnaud Lacombe

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 12 lines · Arnaud Lacombe

Hi,

Quoted 8 lines · Miguel Ojeda
Quoted 6 lines · Arnaud Lacombe

Why ? Thing should be kept simple. kconfig's job is not to know about the trillion file format which exist in the world, even more if the implementation is made by building a command[0], executing it in a separate process and reading the output. This is the shell's job. What may be useful in the contrary would be to eventually teach kconfig to read from <stdin>.

Quoted 8 lines
Quoted 5 lines

/proc/config.gz is provided by the kernel and its format is defined by kconfig itself which is, as well, part of the kernel (it is not one random format from a pool of a trillion), so it will be nice if kconfig learns how to read its own configuration from there.

your point being ? kconfig is not only used by the Linux kernel, and you cannot expect the feature to only be used in the cozy Linux kernel environment.

But this argument isn't really relevant. As with all of the other files listed in the defconfig_list, if it's missing (or can't be read), it will move on to the next one. Decompressing it first just makes things /more/ confusing since the initial message of 'defaults read from...' will read the name of the decompressed temporary file, not the source. It makes more sense to see it as "reading defaults from /proc/config.gz since that's obvious to anyone with kernel experience.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAk1pjfEACgkQLPWxlyuTD7Ki0wCfU8KrumyxlD+qTFajlhc1eHOn rMoAn0PqPyBYhBWlFTBT8YaL8/MWjw1J
=PVwv
-----END PGP SIGNATURE-----

#18 lore raw
In reply to Arnaud Lacombe

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 16 lines · Arnaud Lacombe

Hi,

Quoted 12 lines · Miguel Ojeda
Quoted 10 lines · Arnaud Lacombe
Quoted 5 lines · Miguel Ojeda

/proc/config.gz is provided by the kernel and its format is defined by kconfig itself which is, as well, part of the kernel (it is not one random format from a pool of a trillion), so it will be nice if kconfig learns how to read its own configuration from there.

your point being ? kconfig is not only used by the Linux kernel, and you cannot expect the feature to only be used in the cozy Linux kernel environment.

Quoted 5 lines
Quoted 3 lines

My point was that supporting reading from a .gz file is not anywhere near "knowing about the trillion file format which exist in the world"

Well, Jeff's patch is already about gzip and bzip2. Soon it will be compress, xz, zip, rar, then rzip, lzma, 7z ...

I added bzip2 as an exercise. But realistically, what would be wrong with distributors deciding to ship /boot/config-$UNAME_RELEASE.bz2 and saving a bit of valuable /boot disk space?

Even if people /do/ submit patches do do all of those formats, your argument is based on the premise that having that ability is necessarily bad. I don't think we need them, but I don't think it's a good argument against this patch either.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAk1pjxIACgkQLPWxlyuTD7Jm3wCfSG6z1aBOT6PDLVmQeycW5mmM Z/IAoJJXW7P5C+cWg8lFSTmm+HtBjR0E
=b5Hc
-----END PGP SIGNATURE-----

#19 lore raw

Hi,

Quoted 4 lines · Jeff Mahoney

I added bzip2 as an exercise. But realistically, what would be wrong with distributors deciding to ship /boot/config-$UNAME_RELEASE.bz2 and saving a bit of valuable /boot disk space?

I don't really care, that's outside of kconfig prerogative.

Quoted 5 lines

Even if people /do/ submit patches do do all of those formats, your argument is based on the premise that having that ability is necessarily bad. I don't think we need them, but I don't think it's a good argument against this patch either.

you welcome a lot of potential bloat and wheel re-invention. Both are bad.

- Arnaud

#21 lore raw
In reply to Jeff Mahoney

Hi,

Quoted 8 lines · Jeff Mahoney

But this argument isn't really relevant. As with all of the other files listed in the defconfig_list, if it's missing (or can't be read), it will move on to the next one. Decompressing it first just makes things /more/ confusing since the initial message of 'defaults read from...' will read the name of the decompressed temporary file, not the source. It makes more sense to see it as "reading defaults from /proc/config.gz since that's obvious to anyone with kernel experience.

no, this would only be the behavior of the way you did it.

- Arnaud

#11 lore raw
In reply to Sam Ravnborg
Quoted 16 lines · Sam Ravnborg
Quoted 13 lines · Arnaud Lacombe
Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
       string
       depends on !UML
       option defconfig_list
       default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
       default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
       default "arch/$ARCH/defconfig"

Quoted 2 lines

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken.

Quoted 7 lines

The above allows the average user to just type "make menuconfig" and then the configuration of the current kernel is presented to the user. This is convinient in many cases.
We know the /proc/config.gz is an incresingly popular way to gain access to the configuration of the running kernel. So extending the already know and working way to obtaing the configuration of the running kernel to suppport /proc/config.gz is logical.

Does this detect cross-compiling? The 'depends on !UML' triggered me...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#12 lore raw

Hi,

Quoted 25 lines · Geert Uytterhoeven
Quoted 16 lines · Sam Ravnborg
Quoted 13 lines · Arnaud Lacombe
Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
       string
       depends on !UML
       option defconfig_list
       default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
       default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
       default "arch/$ARCH/defconfig"

Quoted 2 lines

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken.

Quoted 7 lines

The above allows the average user to just type "make menuconfig" and then the configuration of the current kernel is presented to the user. This is convinient in many cases.
We know the /proc/config.gz is an incresingly popular way to gain access to the configuration of the running kernel. So extending the already know and working way to obtaing the configuration of the running kernel to suppport /proc/config.gz is logical.

Quoted 2 lines

Does this detect cross-compiling?

No.

% gmake ARCH=mips menuconfig
#

# using defaults found in /boot/config-2.6.35.11-83.fc14.x86_64
#
[...]

% gmake CROSS_COMPILE=bla ARCH=mips menuconfig
#

# using defaults found in /boot/config-2.6.35.11-83.fc14.x86_64
#
[...]

Which is plainly just wrong.

- Arnaud

Quoted 11 lines

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#13 lore raw
In reply to Geert Uytterhoeven

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 25 lines · Geert Uytterhoeven
Quoted 16 lines · Sam Ravnborg
Quoted 13 lines · Arnaud Lacombe
Quoted 12 lines · Sam Ravnborg

We already have something remotely similar in kconfig. We use the following list:
config DEFCONFIG_LIST
string
depends on !UML
option defconfig_list
default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config"
default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG"
default "arch/$ARCH/defconfig"

Quoted 2 lines

I may argue that anything within the Linux tree which point _by_default_ to something outside the tree itself is broken.

Quoted 7 lines

The above allows the average user to just type "make menuconfig" and then the configuration of the current kernel is presented to the user. This is convinient in many cases.
We know the /proc/config.gz is an incresingly popular way to gain access to the configuration of the running kernel. So extending the already know and working way to obtaing the configuration of the running kernel to suppport /proc/config.gz is logical.

Quoted 1 line

Does this detect cross-compiling? The 'depends on !UML' triggered me...

No, and it never has. The DEFCONFIG_LIST feature has been mostly unaltered since it was added in Jun 2006. Prior to that it was hardcoded into scripts/kconfig/confdata.c since before 2002.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAk1qj7kACgkQLPWxlyuTD7J/ZwCfQzFM6Qo+1Va5RTYKj4bXEydm 28EAoINVyrH+F4hYhCWSkXYCq3Y0euY/
=T1qc
-----END PGP SIGNATURE-----

#10 lore raw
In reply to Arnaud Lacombe
Quoted 7 lines · Arnaud Lacombe

Hi,

Quoted 4 lines · Arnaud Lacombe
Quoted 4 lines

The fact that the configuration is gzipped does not warrant a new option to deal with this that almost duplicate the existing functionality.

Quoted 8 lines
Quoted 2 lines

agree.

Let me precise, as there may be confusion. I agree about the new target issue, but definitively think this kconfig "option" (more a hack, which required a special option within kconfig) should be handled by Kbuild, not Kconfig, ie. I'd discard "option defconfig_list". File decompression (and eventually which config to pick) should be done prior to the invocation of Kconfig.

If you can come up with something simpler and better than what we have today then fine.
Simplifying kconfgi would be good.

But at least barebox uses defconfig_list - an maybe others. We need to consider non-kernel users too.

Sam