lkml.org 
[lkml]   [1998]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectProposal and Patch: Listing of Patches while Booting
Hi!

Yesterday I toyed around a little with the 2.0.30 kernel and its
various pre-2.0.30, buffer cache and other patches which are available
from www.linuxhq.com. Of course I got lost in the middle of patching
and ended up with a mess where I was not able to track any longer
which of my kernels booted up with what patch and release because they
all called itself "2.0.30". Even the usage of
"2030-pre-2-cache-menu-n-stuff" as filenames was not _that_
satisfying. So I mused about some kind of scheme where each patch
could register itself at compile time and report when booting.

In fact I came up with the following patch. The idea is:

You get a directory called init/patches where each (official,
unofficial or RedHat :-) ) patch can put a file with one line of
description. IŽll show you for the prominent pre-2.0.30-2. You add
this to the pre-patch file:

--- cut ---
diff -u --recursive --new-file linux-2.0.30/init/patches/pre2.0.30 linux-2.0.30p/init/patches/pre2.0.30-2
--- linux-2.0.30/init/patches/pre2.0.30 Thu Jan 1 01:00:00 1970
+++ linux-2.0.30p/init/patches/pre2.0.30 Mon Jul 7 09:06:07 1997
@@ -0,0 +1 @@
+Linux 2.0.31 Pre-Patch 2 (David S. Miller)
--- cut ---
So you get, when applying the pre-patch, a file called "pre2.0.30" in
the init/patches directory, which contains one line:

Linux 2.0.31 Pre-Patch 2 (David S. Miller)


Same goes for all other patches that you use and/or apply. You have to
change the name of the created file (of course) and, after applying
serveral patches, you end up with a description file for each patch.

This is even nice if you donŽt apply the kernel patch below (against a
clean 2.0.30 tree it works, I see no reason why it shouldnŽt work
against other 2.0.x trees (I donŽt do 2.1.x yet) but I didnŽt actually
tried out.

If you apply the patch you get the following while booting:

Jul 7 17:41:37 forge kernel: Linux version 2.0.30 (henning@forge) (gcc version 2.7.2.1) #3 Mon Jul 7 17:28:26 MET DST 1997
Jul 7 17:41:37 forge kernel: *** Installed patches:
Jul 7 17:41:37 forge kernel: Linux Config IP Route Patch
Jul 7 17:41:37 forge kernel: Linux Ext2 Filesystem Immuteable Flag Fix
Jul 7 17:41:37 forge kernel: Clear inode Race fix (Bill Hawes, 4.7.97)
Jul 7 17:41:37 forge kernel: Linux Menu Config Patch (Official Release)
Jul 7 17:41:37 forge kernel: Linux Unofficial Patch Printout (2.0.30)
Jul 7 17:41:37 forge kernel: Linux Page Cache Swapper (Dr. Werner Fink)
Jul 7 17:41:37 forge kernel: Linux 2.0.31 Pre-Patch 2 (David S. Miller)
Jul 7 17:41:37 forge kernel: *** End of Patches

As you may have guessed, everything between "*** Installed patches:"
and "*** End of patches" are the contents of the files in
init/patches. So you can see while booting what you currently did to
your kernel and see which patches are installed.

I thought of this as useful (well more useful than naming a kernel :-)
), maybe someone else will think of this too. I doubt that this should
be integrated into mainline 2.0.x kernels at this stage but it would
be nice to see an unified patch documentation scheme in 2.1.x and
beyond. Yes, I know thatŽs what the release number was intended for
but face it: There are and will always be "unofficial" patches or
patches that are not part of the official kernel tree for some or
other reason (look what RedHat did to the 2.0.x kernes) and I would
think of it as nice if there is some way to actually document these
changes and patches at some central place in the kernel.

[steps off his soap box]

Regards
Henning

diff -u --recursive --new-file linux-2.0.30/init/patches/output-patch linux-2.0.30p/init/patches/output-patch
--- linux-2.0.30/init/patches/output-patch Thu Jan 1 01:00:00 1970
+++ linux-2.0.30p/init/patches/output-patch Mon Jul 7 09:06:07 1997
@@ -0,0 +1 @@
+Linux Unofficial Patch Printout (2.0.30)
diff -u --recursive --new-file linux-2.0.30/Makefile linux-2.0.30p/Makefile
--- linux-2.0.30/Makefile Tue May 6 20:27:40 1997
+++ linux-2.0.30p/Makefile Mon Jul 7 09:16:21 1997
@@ -233,7 +233,20 @@
@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 init/patches/*; 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
@@ -308,7 +321,7 @@
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 vmlinux System.map
diff -u --recursive --new-file linux-2.0.30/init/main.c linux-2.0.30p/init/main.c
--- linux-2.0.30/init/main.c Tue May 6 20:27:18 1997
+++ linux-2.0.30p/init/main.c Mon Jul 7 08:45:56 1997
@@ -67,6 +67,7 @@
extern void sock_init(void);
extern unsigned long pci_init(unsigned long, unsigned long);
extern void sysctl_init(void);
+extern void print_patches(void);

extern void no_scroll(char *str, int *ints);
extern void swap_setup(char *str, int *ints);
@@ -840,6 +841,8 @@
check_bugs();

printk(linux_banner);
+ print_patches();
+
#ifdef __SMP__
smp_init();
#endif
diff -u --recursive --new-file linux-2.0.30/init/version.c linux-2.0.30p/init/version.c
--- linux-2.0.30/init/version.c Sun Nov 19 16:45:02 1995
+++ linux-2.0.30p/init/version.c Mon Jul 7 09:40:21 1997
@@ -10,6 +10,9 @@
#include <linux/utsname.h>
#include <linux/version.h>
#include <linux/compile.h>
+#include <linux/kernel.h>
+
+#include "patches.h"

/* make the "checkconfig" script happy: we really need to include config.h */
#ifdef CONFIG_BOGUS
@@ -28,3 +31,18 @@
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");
+ }
+}


--
Dipl.-Inf. Henning Schmiedehausen
henning@knf.de ObDisc: Ich spreche weder fuer ICONSULT noch
henning@forge.franken.de fuer sonst jemanden. Ich arbeite da nicht mal.

"We're geeks. We seek. Get use to it" - Helen, Sweetheart of the Internet


-
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.035 / U:0.368 seconds]
©2003-2014 Jasper Spaans. Advertise on this site