public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] save kernel version in .config file
@ 2004-08-04  5:57 Randy.Dunlap
  2004-08-08 19:05 ` Sam Ravnborg
  2004-08-09 20:03 ` Bill Davidsen
  0 siblings, 2 replies; 21+ messages in thread
From: Randy.Dunlap @ 2004-08-04  5:57 UTC (permalink / raw)
  To: lkml; +Cc: sam, zippel


(from June/2004 email thread:
http://marc.theaimsgroup.com/?t=108753573200001&r=1&w=2
)

Several people found this useful, none opposed (afaik).

Saves kernel version in .config file, e.g.:

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.8-rc3
# Tue Aug  3 22:55:57 2004
#

Please merge.
---

Save kernel version info and date when writing .config file.
Tested with 'make {menuconfig|xconfig|gconfig}'.

Signed-off-by: Randy Dunlap <rddunlap@osdl.org>


diffstat:=
 scripts/kconfig/confdata.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff -Naurp ./scripts/kconfig/confdata.c~config_version ./scripts/kconfig/confdata.c
--- ./scripts/kconfig/confdata.c~config_version	2004-06-15 22:20:21.000000000 -0700
+++ ./scripts/kconfig/confdata.c	2004-06-19 21:14:24.000000000 -0700
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 
 #define LKC_DIRECT_LINK
@@ -268,6 +269,7 @@ int conf_write(const char *name)
 	char dirname[128], tmpname[128], newname[128];
 	int type, l;
 	const char *str;
+	time_t now;
 
 	dirname[0] = 0;
 	if (name && name[0]) {
@@ -301,14 +303,25 @@ int conf_write(const char *name)
 		if (!out_h)
 			return 1;
 	}
+	sym = sym_lookup("KERNELRELEASE", 0);
+	sym_calc_value(sym);
+	time(&now);
 	fprintf(out, "#\n"
 		     "# Automatically generated make config: don't edit\n"
-		     "#\n");
+		     "# Linux kernel version: %s\n"
+		     "# %s"
+		     "#\n",
+		     sym_get_string_value(sym),
+		     ctime(&now));
 	if (out_h)
 		fprintf(out_h, "/*\n"
 			       " * Automatically generated C config: don't edit\n"
+			       " * Linux kernel version: %s\n"
+			       " * %s"
 			       " */\n"
-			       "#define AUTOCONF_INCLUDED\n");
+			       "#define AUTOCONF_INCLUDED\n",
+			       sym_get_string_value(sym),
+			       ctime(&now));
 
 	if (!sym_change_count)
 		sym_clear_all_valid();



--

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [PATCH] save kernel version in .config file
@ 2004-06-27  9:23 The Viking
  0 siblings, 0 replies; 21+ messages in thread
From: The Viking @ 2004-06-27  9:23 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: viking



-------- Original Message --------
References: <28jXg-7Hw-3@gated-at.bofh.it> <28lmp-jo-9@gated-at.bofh.it>

On Fri, 18 Jun 2004 08:38:58 +0200 Paul Rolland wrote:

| Hello,
|
| >
| > Is this interesting to anyone besides me?
| >
| Is it also possible to have this version being displayed during
| a make config/make menuconfig/... so that we know we are reading a
| config file that may have been generated for another kernel version,
| and not yet saved ?
|
| You would have, for make menuconfig :
|
|  Linux Kernel v2.2.13 Configuration, Configuration file version 2.4.20

 >Sure, it's possible.  I just don't want to add the kitchen sink.

 >IOW, I'm not convinced that it's useful most of the time...
 >only a little bit of the time.

My two cents worth:
I'd show it if it differed in kernel version, otherwise not. If this code is 
all relatively self contained, such as all being within the menuconfig/xconfig 
code, then it won't affect the running of the kernel. And yes, it would mean a 
little more code in place, but we're waiting for keyboard strokes in this 
code, or viewing its output. It's not timing-critical.

Sorry I took so long to get to this, but I've only caught up to this point.

-- 
2,313 messages to read, 2,313 messages to read - damn, Thunderbird just 
refreshed, 2,847 messages to read, ... (ad nauseum vibrum kernel)

The Viking of the Flying Brick System

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH] save kernel version in .config file
@ 2004-06-18  5:06 Randy.Dunlap
  2004-06-18  5:34 ` Willy Tarreau
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Randy.Dunlap @ 2004-06-18  5:06 UTC (permalink / raw)
  To: lkml


Is this interesting to anyone besides me?



Save kernel version info when writing .config file.

Signed-off-by: Randy Dunlap <rddunlap@osdl.org>


diffstat:=
 scripts/kconfig/confdata.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -Naurp ./scripts/kconfig/confdata.c~config_version ./scripts/kconfig/confdata.c
--- ./scripts/kconfig/confdata.c~config_version	2004-06-15 22:20:21.000000000 -0700
+++ ./scripts/kconfig/confdata.c	2004-06-17 22:00:22.000000000 -0700
@@ -301,14 +301,19 @@ int conf_write(const char *name)
 		if (!out_h)
 			return 1;
 	}
+	sym = sym_lookup("KERNELRELEASE", 0);
 	fprintf(out, "#\n"
 		     "# Automatically generated make config: don't edit\n"
-		     "#\n");
+		     "# for Linux kernel version: %s\n"
+		     "#\n",
+		     (char *)sym->curr.val);
 	if (out_h)
 		fprintf(out_h, "/*\n"
 			       " * Automatically generated C config: don't edit\n"
+			       " * for Linux kernel version: %s\n"
 			       " */\n"
-			       "#define AUTOCONF_INCLUDED\n");
+			       "#define AUTOCONF_INCLUDED\n",
+			       (char *)sym->curr.val);
 
 	if (!sym_change_count)
 		sym_clear_all_valid();


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2004-08-09 20:56 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-04  5:57 [PATCH] save kernel version in .config file Randy.Dunlap
2004-08-08 19:05 ` Sam Ravnborg
2004-08-09 20:03 ` Bill Davidsen
2004-08-09 20:05   ` Randy.Dunlap
2004-08-09 20:33     ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2004-06-27  9:23 The Viking
2004-06-18  5:06 Randy.Dunlap
2004-06-18  5:34 ` Willy Tarreau
2004-06-18 20:56   ` Sam Ravnborg
2004-06-18 22:05     ` Randy.Dunlap
2004-06-18 22:30       ` Sam Ravnborg
2004-06-18 22:42       ` Roman Zippel
2004-06-18 22:43         ` Randy.Dunlap
2004-06-19  4:07       ` Willy Tarreau
2004-06-19  5:02         ` Randy.Dunlap
2004-06-19 18:34           ` Willy Tarreau
2004-06-20  4:47         ` Randy.Dunlap
2004-06-18  6:29 ` Felipe Alfaro Solana
2004-06-18  6:38 ` Paul Rolland
2004-06-18 22:04   ` Randy.Dunlap
2004-06-18 12:32 ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox