Hi Horst. >> Before I go any further with this, I would like to ask a few >> questions relating to it: >> 1. Is there any likelihood of this making it into the official >> kernel, or am I just wasting my time? > Depends, I'd say... perhaps after a long shakeout and much use. Fair enough - I'd expect that much... >> 2. Would I be right in thinking it's too late for either the >> 2.2 or 2.4 kernels ??? > No way. Good... I've included a patch against 2.2.17 that deals with all of the existing files and implements a version of this facility that just prints "(Not yet implemented)" into the SysLog. The final version will basically consist of this patch with the printk("Not yet implemeted") replaced by a call to the routine to actually perform the dump, plus a new file kernel/dumplog.c containing the said routine. Note that this patch tweaks ALL of the current architecture config.in files to replace the CONFIG_MAGIC_SYSRQ definition with a command to include the new arch/sysrq.in file at that point, and all the options relating to SYSRQ are in this new file instead. >> 5. I was wondering about providing some means of selecting >> whether to dump to /dev/fd0 or /dev/fd1 (or others if >> present). What would be your opinion on this? > Keep it as simple as possible. I'd leave the option open if not > hard, but not implement it at all at first. OK. Initially, I'll look at dropping it strictly to /dev/fd0 and leave the /dev/fd1 code until later. >> 6. A while back, I developed a high-level floppy formatter >> that produces a non-standard DOS-compatible format that >> allows 1436k of data on a 1440k floppy, and produced a >> bash script that would produce disks formatted in this >> format. >> My current plans are for SYSRQ-D to raw write direct to >> /dev/fd0 and effectively reformat the disks in this >> format, dropping the log file thereon in the process. I >> don't plan on doing the low-level format, just the >> high-level one. > KISS, again. What use is a non-standard 1436Kb DOS format when > writing at most 1Mb? The said floppy formatter also works with other capacity disks, and always minimises the system overhead for the disk size. Also, part of my plan was to check that the disk is already in this non-standard format, and refuse to dump if not. This would ensure that doing so didn't overwrite somebody's master boot disk by accident, as such disks will not normally be in this non-standard format. > I'd just dump it raw to /dev/fd0, whoever wants to read it later > will have all kinds of tools at hand. > Remember: > - Bloat That's one reason why I was glad to note the error in the comments in kernel/printk.c that I sent a patch to correct last week - this patch will be MUCH simpler as a result. > - This will have to work even in a thoroughly hosed system to be > of any use It's for precicely that reason that I'm working on it. Best wishes from Riley.
--- linux-2.2.17/arch/alpha/config.in~ Mon Sep 4 18:39:16 2000 +++ linux-2.2.17/arch/alpha/config.in Tue Oct 31 13:18:57 2000 @@ -299,8 +299,7 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate 'Kernel FP software completion' CONFIG_MATHEMU else define_bool CONFIG_MATHEMU y fi - -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in endmenu --- linux-2.2.17/arch/arm/config.in~ Wed Jun 7 22:26:42 2000 +++ linux-2.2.17/arch/arm/config.in Tue Oct 31 13:19:11 2000 @@ -214,7 +214,7 @@ mainmenu_option next_comment comment 'Kernel hacking' bool 'Debug kernel errors' CONFIG_DEBUG_ERRORS #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in endmenu --- linux-2.2.17/arch/i386/config.in~ Mon Sep 4 18:39:16 2000 +++ linux-2.2.17/arch/i386/config.in Tue Oct 31 13:29:03 2000 @@ -204,8 +204,7 @@ mainmenu_option next_comment comment 'Kernel hacking' #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in endmenu - --- linux-2.2.17/arch/m68k/config.in~ Wed Jun 7 22:26:42 2000 +++ linux-2.2.17/arch/m68k/config.in Tue Oct 31 13:19:27 2000 @@ -448,8 +448,8 @@ mainmenu_option next_comment comment 'Kernel hacking' #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in bool 'Remote debugging support' CONFIG_KGDB endmenu --- linux-2.2.17/arch/mips/config.in~ Wed Jun 7 22:26:42 2000 +++ linux-2.2.17/arch/mips/config.in Tue Oct 31 13:19:42 2000 @@ -303,7 +303,7 @@ bool ' Build fp execption handler module' CONFIG_MIPS_FPE_MODULE fi if [ "$CONFIG_SERIAL" = "y" ]; then bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG fi -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in endmenu --- linux-2.2.17/arch/ppc/config.in~ Mon Sep 4 18:39:16 2000 +++ linux-2.2.17/arch/ppc/config.in Tue Oct 31 13:20:01 2000 @@ -195,9 +195,9 @@ endmenu mainmenu_option next_comment comment 'Kernel hacking' -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in bool 'Include kgdb kernel debugger' CONFIG_KGDB bool 'Include xmon kernel debugger' CONFIG_XMON endmenu --- linux-2.2.17/arch/s390/config.in~ Wed Jun 7 22:26:42 2000 +++ linux-2.2.17/arch/s390/config.in Tue Oct 31 13:20:30 2000 @@ -66,8 +66,9 @@ int ' Profile shift count' CONFIG_PROFILE_SHIFT 2 fi if [ "$CONFIG_CTC" = "y" ]; then bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG fi -# this does not work. bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +##### this does not work. +# source ../sysrq.in +##### endmenu - --- linux-2.2.17/arch/sparc/config.in~ Wed Jun 7 22:26:42 2000 +++ linux-2.2.17/arch/sparc/config.in Tue Oct 31 13:20:43 2000 @@ -219,8 +219,7 @@ endmenu mainmenu_option next_comment comment 'Kernel hacking' -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in endmenu - --- linux-2.2.17/arch/sparc64/config.in~ Mon Sep 4 18:39:16 2000 +++ linux-2.2.17/arch/sparc64/config.in Tue Oct 31 13:21:02 2000 @@ -282,8 +282,8 @@ endmenu mainmenu_option next_comment comment 'Kernel hacking' -bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +source ../sysrq.in #bool 'ECache flush trap support at ta 0x72' CONFIG_EC_FLUSH_TRAP endmenu --- linux-2.2.17/arch/sysrq.in~ Thu Jan 1 01:00:00 1970 +++ linux-2.2.17/arch/sysrq.in Tue Oct 31 13:23:52 2000 @@ -0,0 +1,22 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt. +# +# This section is included from the various arch-dependant +# config.in files, and provides the common SysRq options. +# This ensures that these options have a common description. +# +bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +if [ "$CONFIG_MAGIC_SYSRQ" = "y" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool ' Enable dump of syslog to floppy (EXPERIMENTAL)' +CONFIG_MAGIC_SYSRQ_DUMPLOG + if [ "$CONFIG_MAGIC_SYSRQ_DUMPLOG" = "y" ]; then + choice ' SysLog buffer size' \ + " 32k CONFIG_MAGIC_SYSRQ_LOG_32K \ + 64k CONFIG_MAGIC_SYSRQ_LOG_64K \ + 128k CONFIG_MAGIC_SYSRQ_LOG_128K \ + 256k CONFIG_MAGIC_SYSRQ_LOG_256K \ + 512k CONFIG_MAGIC_SYSRQ_LOG_512K \ + 1024k CONFIG_MAGIC_SYSRQ_LOG_1M \ + 2048k CONFIG_MAGIC_SYSRQ_LOG_2M" 32k + fi +fi --- linux-2.2.17/Documentation/Configure.help~ Mon Sep 4 18:39:15 2000 +++ linux-2.2.17/Documentation/Configure.help Tue Oct 31 13:26:43 2000 @@ -10397,10 +10397,17 @@ immediately or dump some status information). This is accomplished by pressing various keys while holding SysRq (Alt+PrintScreen). The keys are documented in Documentation/sysrq.txt. Don't say Y unless you really know what this hack does. +System Request facility to dump the SysLog to /dev/fd0 +CONFIG_MAGIC_SYSRQ_DUMPLOG + If you say Y here, you will have the ability to dump that part of + the system log that is still in the kernel buffer area to the disc + in /dev/fd0 which will normally give you the ability to capture the + kernel panic messages that normally result in a system lockup. + ISDN subsystem CONFIG_ISDN ISDN ("Integrated Services Digital Networks", called RNIS in France) is a special type of fully digital telephone service; it's mostly used to connect to your Internet service provider (with SLIP or --- linux-2.2.17/drivers/char/sysrq.c~ Thu May 4 01:16:39 2000 +++ linux-2.2.17/drivers/char/sysrq.c Tue Oct 31 13:11:35 2000 @@ -131,16 +131,25 @@ case 'l': /* L -- kill all processes including init */ printk("Kill ALL Tasks (even init)\n"); send_sig_all(SIGKILL, 1); orig_log_level = 8; break; +#ifdef CONFIG_MAGIC_SYSRQ_DUMPLOG + case 'd': /* D -- dump syslog to +/dev/fd0 */ + printk("Dump SysLog to /dev/fd0\n"); + printk("(Not yet implemented)\n"); + break; +#endif default: /* Unknown: help */ if (kbd) printk("unRaw "); #ifdef CONFIG_VT if (tty) printk("saK "); +#endif +#ifdef CONFIG_MAGIC_SYSRQ_DUMPLOG + printk("Dump "); #endif printk("Boot "); if (sysrq_power_off) printk("Off "); printk("Sync Unmount showPc showTasks showMem loglevel0-8 tErm kIll killalL\n"); --- linux-2.2.17/kernel/printk.c~ Sat Oct 28 10:01:20 2000 +++ linux-2.2.17/kernel/printk.c Tue Oct 31 13:15:01 2000 @@ -20,11 +20,36 @@ #include <linux/console.h> #include <linux/init.h> #include <asm/uaccess.h> -#define LOG_BUF_LEN (16384) +#ifndef CONFIG_MAGIC_SYSRQ_DUMPLOG +# define LOG_BUF_LEN (16 * 1024) +#else +# ifdef CONFIG_MAGIC_SYSRQ_LOG_32K +# define LOG_BUF_LEN (32 * 1024) +# endif +# ifdef CONFIG_MAGIC_SYSRQ_LOG_64K +# define LOG_BUF_LEN (64 * 1024) +# endif +# ifdef CONFIG_MAGIC_SYSRQ_LOG_128K +# define LOG_BUF_LEN (128 * 1024) +# endif +# ifdef CONFIG_MAGIC_SYSRQ_LOG_256K +# define LOG_BUF_LEN (256 * 1024) +# endif +# ifdef CONFIG_MAGIC_SYSRQ_LOG_512K +# define LOG_BUF_LEN (512 * 1024) +# endif +# ifdef CONFIG_MAGIC_SYSRQ_LOG_1M +# define LOG_BUF_LEN (1 * 1024 * 1024) +# endif +# ifdef CONFIG_MAGIC_SYSRQ_LOG_2M +# define LOG_BUF_LEN (2 * 1024 * 1024) +# endif +#endif + #define LOG_BUF_MASK (LOG_BUF_LEN-1) static char buf[1024]; /* printk's without a loglevel use this.. */