lkml.org 
[lkml]   [1998]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: How about a /proc/patches ?
On Wed, 25 Feb 1998 Mikael Pettersson <Mikael.Pettersson@sophia.inria.fr> wrote:

> Chris Fowler wrote:
> > Is there anybody out there who has thought about creating a patch for the
> > kernel that would create a file /proc/patches that would list in it all
> > the patches applied to that kernel.
>
> I like this idea, and the patch by Henning Schmiedehausen
> inspired me to go ahead and implement the /proc interface part.
> So included below is version 0.1 of my patch-proc-config patch.
[...]
> Since it was easy to do, and since I suspected it to be somewhat
> useful, I also added a /proc/config file, which contains
> (big surprise) the CONFIG* settings used to build the kernel.

Some comments.
First of all, the Makefile rule for init/patches.h should *definitely*
omit "*.orig" and "*.rej" files from init/patches. Otherwise you get a
lot of garbage in init/patches.h.

Second: I took a look at it, and decided the /proc/patches entry wasn't
necessary, as the same info was available from dmesg anyway. However, the
/proc/config file could be very useful, and it doesn't look like it adds
much code to the kernel. So my recommendation would be to keep
/proc/patches and /proc/config and ditch print_patches() at startup.
[can you format /proc/config as closely as possible to .config, so that
modules/programs that are used to scanning /usr/src/linux/.config for info
can redirect their search easily to /proc/config instead? Alternatively
it could look like include/linux/autoconf.h instead.]

For reference, attached is my own port of this patch to 2.1.88.
I would very much like something like this to be integrated into the
standard kernel, as it is unlikely that patch-makers will include the
init/patches files otherwise.

Also -- how does linus build his linux-*.tar files? It seems like a
command should be added to the distclean rule (or somewhere) to delete the
init/patches files for things that get integrated into the standard
kernel.
--Scott
@ @
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-oOO-(_)-OOo-=-=-=-=-=
C. Scott Ananian: cananian@lcs.mit.edu / Declare the Truth boldly and
Laboratory for Computer Science/Crypto / without hindrance.
Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31
-.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -.
PGP key available via finger and from http://www.pdos.lcs.mit.edu/~cananian

diff -ruHpN linux-2.1.88-orig/Makefile linux-2.1.88-patchlist/Makefile
--- linux-2.1.88-orig/Makefile Fri Feb 20 21:27:17 1998
+++ linux-2.1.88-patchlist/Makefile Wed Feb 25 14:13:12 1998
@@ -264,7 +264,20 @@ include/linux/version.h: ./Makefile
@echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
@mv -f .ver $@

-init/version.o: init/version.c include/linux/compile.h
+init/patches.h: dummy
+ @rm -f init/patches.h
+ @if [ 'x"init/patches/*"' != "x" ]; then \
+ (echo "const char *patches[] = {"; \
+ for patch in `ls init/patches/* | grep -v '\.orig$$'`; do \
+ echo -n ' "'; tr -d '\n' < $$patch; echo '",'; \
+ done; \
+ echo "};" ) > init/patches.h ; \
+ echo "Created Patch List" ;\
+ else \
+ echo "const char *patches[] = {};" > init/patches.h; \
+ fi
+
+init/version.o: init/version.c include/linux/compile.h init/patches.h
$(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c

init/main.o: init/main.c
@@ -342,7 +355,7 @@ modules modules_install: dummy
endif

clean: archclean
- rm -f kernel/ksyms.lst include/linux/compile.h
+ rm -f kernel/ksyms.lst include/linux/compile.h init/patches.h
rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
rm -f core `find . -type f -name 'core' -print`
rm -f core `find . -name '.*.flags' -print`
diff -ruHpN linux-2.1.88-orig/init/main.c linux-2.1.88-patchlist/init/main.c
--- linux-2.1.88-orig/init/main.c Mon Feb 9 19:12:56 1998
+++ linux-2.1.88-patchlist/init/main.c Wed Feb 25 14:14:18 1998
@@ -74,6 +74,7 @@ extern void sysctl_init(void);
extern void filescache_init(void);
extern void signals_init(void);
extern void dquot_init(void);
+extern void print_patches(void);

extern void smp_setup(char *str, int *ints);
extern void ioapic_pirq_setup(char *str, int *ints);
@@ -1068,3 +1069,5 @@ __initfunc(asmlinkage void start_kernel(
check_bugs();

printk("POSIX conformance testing by UNIFIX\n");
+ print_patches();
+
diff -ruHpN linux-2.1.88-orig/init/patches/output-patch linux-2.1.88-patchlist/init/patches/output-patch
--- linux-2.1.88-orig/init/patches/output-patch Wed Dec 31 19:00:00 1969
+++ linux-2.1.88-patchlist/init/patches/output-patch Wed Feb 25 14:13:12 1998
@@ -0,0 +1 @@
+Patch Printout (2.1.88, Henning Schmiedehausen, C. Scott Ananian)
diff -ruHpN linux-2.1.88-orig/init/version.c linux-2.1.88-patchlist/init/version.c
--- linux-2.1.88-orig/init/version.c Mon Jan 5 04:41:01 1998
+++ linux-2.1.88-patchlist/init/version.c Wed Feb 25 14:13:12 1998
@@ -10,6 +10,9 @@
#include <linux/utsname.h>
#include <linux/version.h>
#include <linux/compile.h>
+#include <linux/kernel.h>
+
+#include "patches.h"

#define version(a) Version_ ## a
#define version_string(a) version(a)
@@ -24,3 +27,18 @@ struct new_utsname system_utsname = {
const char *linux_banner =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+
+void print_patches(void)
+{
+ int i;
+
+ if(sizeof(patches)) {
+ printk("*** Installed patches:\n");
+
+ for(i=0; i < sizeof(patches)/sizeof(char *); i++) {
+ printk("%s\n", patches[i]);
+ }
+
+ printk("*** End of Patches\n");
+ }
+}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.122 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site