public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] 2.4 add suffix for uname -r
@ 2001-05-06  7:15 Keith Owens
  2001-05-06  7:35 ` Mike A. Harris
  2001-05-07 17:29 ` Pavel Roskin
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Owens @ 2001-05-06  7:15 UTC (permalink / raw)
  To: linux-kernel

A frequent requirement is to rename vmlinuz-2.x.y to 2.x.y-old or
2.x.y.save to preserve a working kernel.  But renaming the image does
not change the value of uname -r so it still tries to use modules
2.x.y, which defeats the purpose of saving an working kernel.

Normally I would say that this is a user space problem but it requires
finding every program that uses uname(2) and every script that uses
uname -r and changing them, not practical (modutils, alsa, pciutils,
/etc/rc.d, mkinitrd etc.).  Instead this small patch to the kernel adds
the boot time option unamersfx (uname -r suffix).  Rename a kernel
image from 2.x.y to 2.x.y.foo, rename /lib/modules/2.x.y to 2.x.y.foo
and boot with unamersfx=.foo to safely pick up the old kernel.

Objects that "know" the value of uname -r that they were compiled with
will not work with unamersfx.  Are there any?

Against 2.4.4.

Index: 4.1/init/main.c
--- 4.1/init/main.c Sat, 28 Apr 2001 18:38:57 +1000 kaos (linux-2.4/k/11_main.c 1.1.5.1.1.4 644)
+++ 4.1(w)/init/main.c Sun, 06 May 2001 16:50:44 +1000 kaos (linux-2.4/k/11_main.c 1.1.5.1.1.4 644)
@@ -405,10 +405,20 @@ static int __init quiet_kernel(char *str
 	return 1;
 }
 
+static int __init unamersfx(char *str)
+{
+	int l1 = strlen(system_utsname.release), l2 = strlen(str);
+	if ((l1 + l2) > sizeof(system_utsname.release))
+		return 0;
+	memcpy(system_utsname.release+l1, str+1, l2);
+	return 1;
+}
+
 __setup("ro", readonly);
 __setup("rw", readwrite);
 __setup("debug", debug_kernel);
 __setup("quiet", quiet_kernel);
+__setup("unamersfx", unamersfx);
 
 /*
  * This is a simple kernel command line parsing function: it parses
Index: 4.1/Documentation/kernel-parameters.txt
--- 4.1/Documentation/kernel-parameters.txt Sun, 22 Apr 2001 08:26:07 +1000 kaos (linux-2.4/V/c/21_kernel-par 1.1.1.1.1.1 644)
+++ 4.1(w)/Documentation/kernel-parameters.txt Sun, 06 May 2001 15:39:06 +1000 kaos (linux-2.4/V/c/21_kernel-par 1.1.1.1.1.1 644)
@@ -574,7 +574,11 @@ running once the system is up.
 	uart401=	[HW,SOUND]
 
 	uart6850=	[HW,SOUND]
- 
+
+	unamersfx=	[KNL] Copy the string as a suffix on the result of
+			uname -r.  Use unamersfx=.xxx if you have renamed your
+			kernel and modules from foo to foo.xxx
+
 	usbfix		[BUGS=IA-64] 
  
 	video=		[FB] frame buffer configuration.


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

* Re: [patch] 2.4 add suffix for uname -r
  2001-05-06  7:15 [patch] 2.4 add suffix for uname -r Keith Owens
@ 2001-05-06  7:35 ` Mike A. Harris
  2001-05-06  7:45   ` Keith Owens
  2001-05-07 17:29 ` Pavel Roskin
  1 sibling, 1 reply; 9+ messages in thread
From: Mike A. Harris @ 2001-05-06  7:35 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Sun, 6 May 2001, Keith Owens wrote:

>Date: Sun, 06 May 2001 17:15:45 +1000
>From: Keith Owens <kaos@ocs.com.au>
>To: linux-kernel@vger.kernel.org
>Content-Type: text/plain; charset=us-ascii
>Subject: [patch] 2.4 add suffix for uname -r
>
>A frequent requirement is to rename vmlinuz-2.x.y to 2.x.y-old or
>2.x.y.save to preserve a working kernel.  But renaming the image does
>not change the value of uname -r so it still tries to use modules
>2.x.y, which defeats the purpose of saving an working kernel.
>
>Normally I would say that this is a user space problem but it requires
>finding every program that uses uname(2) and every script that uses
>uname -r and changing them, not practical (modutils, alsa, pciutils,
>/etc/rc.d, mkinitrd etc.).  Instead this small patch to the kernel adds
>the boot time option unamersfx (uname -r suffix).  Rename a kernel
>image from 2.x.y to 2.x.y.foo, rename /lib/modules/2.x.y to 2.x.y.foo
>and boot with unamersfx=.foo to safely pick up the old kernel.
>
>Objects that "know" the value of uname -r that they were compiled with
>will not work with unamersfx.  Are there any?

I don't see how this patch is necessary when we have
"EXTRAVERSION" available.  Change EXTRAVERSION in your kernel
builds and it is totally a non issue.  No renaming of anything is
necessary.


------------------------------------------------------------------------
Signature poll:  I'm planning on getting a 12 or 16 port autosensing
10/100 ethernet switch soon for home use, and am interested in hearing
others recommendations on what to buy.  Cost isn't as important as is
functionality and quality.  Any suggestions appreciated.
------------------------------------------------------------------------


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

* Re: [patch] 2.4 add suffix for uname -r
  2001-05-06  7:35 ` Mike A. Harris
@ 2001-05-06  7:45   ` Keith Owens
  2001-05-06  8:12     ` Lars Marowsky-Bree
  2001-05-06  9:16     ` Mike A. Harris
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Owens @ 2001-05-06  7:45 UTC (permalink / raw)
  To: Mike A. Harris; +Cc: linux-kernel

On Sun, 6 May 2001 03:35:34 -0400 (EDT), 
"Mike A. Harris" <mharris@opensourceadvocate.org> wrote:
>On Sun, 6 May 2001, Keith Owens wrote:
>>A frequent requirement is to rename vmlinuz-2.x.y to 2.x.y-old or
>>2.x.y.save to preserve a working kernel.
>
>I don't see how this patch is necessary when we have
>"EXTRAVERSION" available.  Change EXTRAVERSION in your kernel
>builds and it is totally a non issue.  No renaming of anything is
>necessary.

You already have a working kernel which you want to rename to use as a
backup version.  Changing EXTRAVERSION and recompiling builds a new
kernel and adds uncertainty about whether the kernel still works - did
you change anything else before recompiling?  Look at all the install
scripts that rename vmlinuz to vmlinuz-old.


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

* Re:  [patch] 2.4 add suffix for uname -r
  2001-05-06  7:45   ` Keith Owens
@ 2001-05-06  8:12     ` Lars Marowsky-Bree
  2001-05-06  8:36       ` Mike Castle
  2001-05-06  9:16     ` Mike A. Harris
  1 sibling, 1 reply; 9+ messages in thread
From: Lars Marowsky-Bree @ 2001-05-06  8:12 UTC (permalink / raw)
  To: Keith Owens; +Cc: Mike A. Harris, linux-kernel

On 2001-05-06T17:45:06,
   Keith Owens <kaos@ocs.com.au> said:

> You already have a working kernel which you want to rename to use as a
> backup version.  Changing EXTRAVERSION and recompiling builds a new
> kernel and adds uncertainty about whether the kernel still works - did
> you change anything else before recompiling? 

You assign a new EXTRAVERSION to the new kernel you are building, and keep the
old kernel at the old name.

Problem solved.

Sincerely,
    Lars Marowsky-Brée <lmb@suse.de>

-- 
Perfection is our goal, excellence will be tolerated. -- J. Yahl


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

* Re: [patch] 2.4 add suffix for uname -r
  2001-05-06  8:12     ` Lars Marowsky-Bree
@ 2001-05-06  8:36       ` Mike Castle
  2001-05-06  9:01         ` Lars Marowsky-Bree
  2001-05-06 17:08         ` Russell King
  0 siblings, 2 replies; 9+ messages in thread
From: Mike Castle @ 2001-05-06  8:36 UTC (permalink / raw)
  To: linux-kernel

On Sun, May 06, 2001 at 10:12:17AM +0200, Lars Marowsky-Bree wrote:
> You assign a new EXTRAVERSION to the new kernel you are building, and keep the
> old kernel at the old name.

Except that some patches (ie, RAID, -ac) use EXTRAVERSION.  There needs to
be a new variable, say USERVERSION, that will *ONLY* be set during make
USERVERSION=foo.

mrc
-- 
       Mike Castle       Life is like a clock:  You can work constantly
  dalgoda@ix.netcom.com  and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

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

* Re:  [patch] 2.4 add suffix for uname -r
  2001-05-06  8:36       ` Mike Castle
@ 2001-05-06  9:01         ` Lars Marowsky-Bree
  2001-05-06 17:08         ` Russell King
  1 sibling, 0 replies; 9+ messages in thread
From: Lars Marowsky-Bree @ 2001-05-06  9:01 UTC (permalink / raw)
  To: linux-kernel

On 2001-05-06T01:36:05,
   Mike Castle <dalgoda@ix.netcom.com> said:

> On Sun, May 06, 2001 at 10:12:17AM +0200, Lars Marowsky-Bree wrote:
> > You assign a new EXTRAVERSION to the new kernel you are building, and keep the
> > old kernel at the old name.
> 
> Except that some patches (ie, RAID, -ac) use EXTRAVERSION. 

So? You can still set EXTRAVERSION to anything you like. It is just an
identifier for the admin, and not used for anything inside the kernel.

Sincerely,
    Lars Marowsky-Brée <lmb@suse.de>

-- 
Perfection is our goal, excellence will be tolerated. -- J. Yahl


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

* Re: [patch] 2.4 add suffix for uname -r
  2001-05-06  7:45   ` Keith Owens
  2001-05-06  8:12     ` Lars Marowsky-Bree
@ 2001-05-06  9:16     ` Mike A. Harris
  1 sibling, 0 replies; 9+ messages in thread
From: Mike A. Harris @ 2001-05-06  9:16 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Sun, 6 May 2001, Keith Owens wrote:

>>On Sun, 6 May 2001, Keith Owens wrote:
>>>A frequent requirement is to rename vmlinuz-2.x.y to 2.x.y-old or
>>>2.x.y.save to preserve a working kernel.
>>
>>I don't see how this patch is necessary when we have
>>"EXTRAVERSION" available.  Change EXTRAVERSION in your kernel
>>builds and it is totally a non issue.  No renaming of anything is
>>necessary.
>
>You already have a working kernel which you want to rename to use as a
>backup version.

Why?  Just use it as a backup version.  No need to rename
anything at all.  I never rename a kernel, Sysmap, module dir or
anything when trying out a new kernel.   I use EXTRAVERSION
instead - for its intended purpose - which was to eliminate these
sort of problems.

>Changing EXTRAVERSION and recompiling builds a new kernel and
>adds uncertainty about whether the kernel still works - did you
>change anything else before recompiling?

How could it possibly add any uncertainity about anything?  My
kernel is 2.4.2-2 right now.  If I build a new one, it will be
2.4.4-1asdf probably (asdf is my machine).  If I then want to try
a new kernel but am not sure if I want the old one still, the new
kernel will be 2.4.4-2asdf.  None of the kernels have files that
conflict, and the names of them never change.  I add a new stanza
to lilo for the new kernel, run lilo, and can easily boot any of
the kernels.

>Look at all the install scripts that rename vmlinuz to
>vmlinuz-old.

Better yet, rewrite those broken scripts to work with todays
kernel features.  My install-kernel script works just fine for
adding a new kernel to the system.

By using new tools you avoid old problems.


------------------------------------------------------------------------
Signature poll:  I'm planning on getting a 12 or 16 port autosensing
10/100 ethernet switch soon for home use, and am interested in hearing
others recommendations on what to buy.  Cost isn't as important as is
functionality and quality.  Any suggestions appreciated.
------------------------------------------------------------------------


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

* Re: [patch] 2.4 add suffix for uname -r
  2001-05-06  8:36       ` Mike Castle
  2001-05-06  9:01         ` Lars Marowsky-Bree
@ 2001-05-06 17:08         ` Russell King
  1 sibling, 0 replies; 9+ messages in thread
From: Russell King @ 2001-05-06 17:08 UTC (permalink / raw)
  To: Mike Castle, linux-kernel

On Sun, May 06, 2001 at 01:36:05AM -0700, Mike Castle wrote:
> On Sun, May 06, 2001 at 10:12:17AM +0200, Lars Marowsky-Bree wrote:
> > You assign a new EXTRAVERSION to the new kernel you are building, and keep the
> > old kernel at the old name.
> 
> Except that some patches (ie, RAID, -ac) use EXTRAVERSION.  There needs to
> be a new variable, say USERVERSION, that will *ONLY* be set during make
> USERVERSION=foo.

Ok, so we have $(VERSION).$(MINOR).$(PATCHLEVEL)$(EXTRAVERSION)$(USERVERSION).
Isn't this the same as $(VERSION).$(MINOR).$(PATCHLEVEL)$(EXTRAVERSION) where
$(EXTRAVERSION) has $(USERVERSION) appended?

In other words:

EXTRAVERSION=-ac4-build1

You can extend EXTRAVERSION infinitely, but after the first 10 or so
characters, it starts to get silly.

--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


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

* Re: [patch] 2.4 add suffix for uname -r
  2001-05-06  7:15 [patch] 2.4 add suffix for uname -r Keith Owens
  2001-05-06  7:35 ` Mike A. Harris
@ 2001-05-07 17:29 ` Pavel Roskin
  1 sibling, 0 replies; 9+ messages in thread
From: Pavel Roskin @ 2001-05-07 17:29 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

Hi, Keith!

> A frequent requirement is to rename vmlinuz-2.x.y to 2.x.y-old or
> 2.x.y.save to preserve a working kernel.  But renaming the image does
> not change the value of uname -r so it still tries to use modules
> 2.x.y, which defeats the purpose of saving an working kernel.

Thank you for the patch and for taking care of the problem! I've tested it
and it works for me. I'm using kernel modules and ALSA.

> Objects that "know" the value of uname -r that they were compiled with
> will not work with unamersfx.  Are there any?

"floppy" hardcodes the version but doesn't protest.

inserting floppy driver for 2.4.4-ac5
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
# uname -a
Linux fonzie 2.4.4-ac5-new #3 Mon May 7 12:06:39 EDT 2001 i686 unknown

-- 
Regards,
Pavel Roskin


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

end of thread, other threads:[~2001-05-07 17:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-06  7:15 [patch] 2.4 add suffix for uname -r Keith Owens
2001-05-06  7:35 ` Mike A. Harris
2001-05-06  7:45   ` Keith Owens
2001-05-06  8:12     ` Lars Marowsky-Bree
2001-05-06  8:36       ` Mike Castle
2001-05-06  9:01         ` Lars Marowsky-Bree
2001-05-06 17:08         ` Russell King
2001-05-06  9:16     ` Mike A. Harris
2001-05-07 17:29 ` Pavel Roskin

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