Is this interesting to anyone besides me?
Save kernel version info when writing .config file.
Signed-off-by: Randy Dunlap <[email protected]>
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();
On Thu, Jun 17, 2004 at 10:06:51PM -0700, Randy.Dunlap wrote:
>
> Is this interesting to anyone besides me?
> Save kernel version info when writing .config file.
Very good idea Randy ! I've already used some wrong config picked out of 20,
and having a simple way to do a quick check is really an enhancement. BTW,
does KERNELRELEASE include the build number ? and could we include the
config date in the file too ?
Regards,
Willy
On Thu, 2004-06-17 at 22:06 -0700, Randy.Dunlap wrote:
> Is this interesting to anyone besides me?
Yes. It will help with the hell of config files I have. Thanks.
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
....
Regards,
Paul
On Thu, 17 Jun 2004, Randy.Dunlap wrote:
>
> Is this interesting to anyone besides me?
>
>
>
> Save kernel version info when writing .config file.
I certainly find that to be a nice and useful enhancement - good idea.
--
Jesper Juhl <[email protected]>
On Fri, Jun 18, 2004 at 07:34:55AM +0200, Willy Tarreau wrote:
> On Thu, Jun 17, 2004 at 10:06:51PM -0700, Randy.Dunlap wrote:
> >
> > Is this interesting to anyone besides me?
> > Save kernel version info when writing .config file.
>
> Very good idea Randy ! I've already used some wrong config picked out of 20,
> and having a simple way to do a quick check is really an enhancement. BTW,
> does KERNELRELEASE include the build number ? and could we include the
> config date in the file too ?
Date seems worthwhile. buildnumber does not make sense since we do not
generate a new .config for each build.
Sam
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.
--
~Randy
On Fri, 18 Jun 2004 22:56:02 +0200 Sam Ravnborg wrote:
| On Fri, Jun 18, 2004 at 07:34:55AM +0200, Willy Tarreau wrote:
| > On Thu, Jun 17, 2004 at 10:06:51PM -0700, Randy.Dunlap wrote:
| > >
| > > Is this interesting to anyone besides me?
| > > Save kernel version info when writing .config file.
| >
| > Very good idea Randy ! I've already used some wrong config picked out of 20,
| > and having a simple way to do a quick check is really an enhancement. BTW,
| > does KERNELRELEASE include the build number ? and could we include the
| > config date in the file too ?
|
| Date seems worthwhile. buildnumber does not make sense since we do not
| generate a new .config for each build.
OK, I've added date, based on Sam's comments, but someone tell me,
when/why does filesystem-timestamp not work for this?
Thanks for the replies.
--
~Randy
Save kernel version info and date when writing .config file.
Signed-off-by: Randy Dunlap <[email protected]>
diffstat:=
scripts/kconfig/confdata.c | 14 ++++++++++++--
1 files changed, 12 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-18 14:27:25.414950216 -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,22 @@ int conf_write(const char *name)
if (!out_h)
return 1;
}
+ sym = sym_lookup("KERNELRELEASE", 0);
+ time(&now);
fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n"
- "#\n");
+ "# Linux kernel version: %s\n"
+ "# %s"
+ "#\n",
+ (char *)sym->curr.val, 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",
+ (char *)sym->curr.val, ctime(&now));
if (!sym_change_count)
sym_clear_all_valid();
On Fri, Jun 18, 2004 at 03:05:35PM -0700, Randy.Dunlap wrote:
> On Fri, 18 Jun 2004 22:56:02 +0200 Sam Ravnborg wrote:
>
> | On Fri, Jun 18, 2004 at 07:34:55AM +0200, Willy Tarreau wrote:
> | > On Thu, Jun 17, 2004 at 10:06:51PM -0700, Randy.Dunlap wrote:
> | > >
> | > > Is this interesting to anyone besides me?
> | > > Save kernel version info when writing .config file.
> | >
> | > Very good idea Randy ! I've already used some wrong config picked out of 20,
> | > and having a simple way to do a quick check is really an enhancement. BTW,
> | > does KERNELRELEASE include the build number ? and could we include the
> | > config date in the file too ?
> |
> | Date seems worthwhile. buildnumber does not make sense since we do not
> | generate a new .config for each build.
>
> OK, I've added date, based on Sam's comments, but someone tell me,
> when/why does filesystem-timestamp not work for this?
Because date is easier to see in grep.
Sam
Hi,
On Fri, 18 Jun 2004, Randy.Dunlap wrote:
Did you test this with anything else than menuconfig?
> + (char *)sym->curr.val, ctime(&now));
Try to avoid poking around in that structure. First the value needs to be
calculated with sym_calc_value() and then it can be accessed with
sym_get_string_value().
bye, Roman
On Sat, 19 Jun 2004 00:42:19 +0200 (CEST) Roman Zippel wrote:
| Hi,
|
| On Fri, 18 Jun 2004, Randy.Dunlap wrote:
|
| Did you test this with anything else than menuconfig?
Nope...
| > + (char *)sym->curr.val, ctime(&now));
|
| Try to avoid poking around in that structure. First the value needs to be
| calculated with sym_calc_value() and then it can be accessed with
| sym_get_string_value().
Thanks, will use that info.
--
~Randy
On Fri, Jun 18, 2004 at 03:05:35PM -0700, Randy.Dunlap wrote:
> OK, I've added date, based on Sam's comments, but someone tell me,
> when/why does filesystem-timestamp not work for this?
Oh, there may be lots of reasons. The first one which comes to my mind is
when I archive several config files in a same directory, I rarely think
about adding '-a' to cp to preserve the dates. And when you're experimenting
with a kernel and you're at the 20th at the end of the day, the date in the
config file is often more reliable than yourself to keep track of what you
have tried.
Thanks,
Willy
PS: do you think this could be done easily to 2.4 too ?
On Sat, 19 Jun 2004 06:07:17 +0200 Willy Tarreau wrote:
| On Fri, Jun 18, 2004 at 03:05:35PM -0700, Randy.Dunlap wrote:
|
| > OK, I've added date, based on Sam's comments, but someone tell me,
| > when/why does filesystem-timestamp not work for this?
|
| Oh, there may be lots of reasons. The first one which comes to my mind is
| when I archive several config files in a same directory, I rarely think
| about adding '-a' to cp to preserve the dates. And when you're experimenting
| with a kernel and you're at the 20th at the end of the day, the date in the
| config file is often more reliable than yourself to keep track of what you
| have tried.
I see.
| Thanks,
| Willy
|
| PS: do you think this could be done easily to 2.4 too ?
It's trivial for 'make menuconfig' (bash scripting) [below].
OTOH, I won't look at the tcl/tk 'xconfig' stuff...
--
~Randy
linux-2.4.26
Save kernel version and config file date in config file.
diffstat:=
scripts/Menuconfig | 5 +++++
1 files changed, 5 insertions(+)
diff -Naurp ./scripts/Menuconfig~config_version ./scripts/Menuconfig
--- ./scripts/Menuconfig~config_version 2002-08-02 17:39:46.000000000 -0700
+++ ./scripts/Menuconfig 2004-06-18 21:57:47.000000000 -0700
@@ -1275,13 +1275,18 @@ save_configuration () {
CONFIG=.tmpconfig
CONFIG_H=.tmpconfig.h
+ DATTIM=`date`
echo "#" >$CONFIG
echo "# Automatically generated by make menuconfig: don't edit" >>$CONFIG
+ echo "# Linux kernel version: $kernel_version" >>$CONFIG
+ echo "# $DATTIM" >>$CONFIG
echo "#" >>$CONFIG
echo "/*" >$CONFIG_H
echo " * Automatically generated by make menuconfig: don't edit" >>$CONFIG_H
+ echo " * Linux kernel version: $kernel_version" >>$CONFIG_H
+ echo " * $DATTIM" >>$CONFIG_H
echo " */" >>$CONFIG_H
echo "#define AUTOCONF_INCLUDED" >> $CONFIG_H
On Fri, Jun 18, 2004 at 10:02:53PM -0700, Randy.Dunlap wrote:
> | PS: do you think this could be done easily to 2.4 too ?
>
> It's trivial for 'make menuconfig' (bash scripting) [below].
Cool, thank you very much Randy.
> OTOH, I won't look at the tcl/tk 'xconfig' stuff...
Not my problem either, I haven't used it for 3 or 4 years.
Cheers,
Willy
On Sat, 19 Jun 2004 06:07:17 +0200 Willy Tarreau wrote:
| On Fri, Jun 18, 2004 at 03:05:35PM -0700, Randy.Dunlap wrote:
|
| > OK, I've added date, based on Sam's comments, but someone tell me,
| > when/why does filesystem-timestamp not work for this?
and then Roman made some very good comments about looking up and
printing symbol values and testing with xconfig and gconfig.
Thanks, Roman.
Having done all of that successfully, here is the updated patch for
2.6.7.
Save kernel version info and date when writing .config file.
Signed-off-by: Randy Dunlap <[email protected]>
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();
-------- Original Message --------
References: <[email protected]> <[email protected]>
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