linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: linux-kernel@vger.kernel.org
Subject: [patch] 2.4 add suffix for uname -r
Date: Sun, 06 May 2001 17:15:45 +1000	[thread overview]
Message-ID: <3024.989133345@ocs3.ocs-net> (raw)

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.


             reply	other threads:[~2001-05-06  7:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-06  7:15 Keith Owens [this message]
2001-05-06  7:35 ` [patch] 2.4 add suffix for uname -r 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3024.989133345@ocs3.ocs-net \
    --to=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).