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

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