lkml.org 
[lkml]   [2001]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch] 2.4 add suffix for uname -r
Date
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.045 / U:0.404 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site