[PATCH] Dump panic messages to floppy diskette with Alt-SysRq-D

Willy Tarreau (willy@novworld.Novecom.Fr)
Sun, 20 Jun 1999 00:31:53 +0200 (CEST)


Hi all,

Here comes a patch for kernel 2.2.10 (not tested with others yet) which
allows to dump the last panic message to the first track of a floppy
diskette.

Basically, the system is almost dead with a panic message on the screen and
the user wants to keep it and can choose between paper and camera. Now,
there's a new choice:
- insert a diskette in drive A ;
- press Alt-SysRq-D

The system switches to real mode, reinitializes the PIC#1, PIT and keyboard
controller, and tries to dump the last message on the diskette. If an error
occurs, it says nothing. You'll only have to set a good diskette in the drive
and hit a key again. Only 1024 bytes are dumped onto the diskette (2 sectors)
so it should be quick.

If the user presses 'B' then the system reboots.

After the system has come up again, you can read the message with a command
such as :

dd if=/dev/fd0 bs=1024 count=1 | tr -d '\000';echo ""

As you can understand, any existing file-system on the diskette will be
damaged so be careful when you choose your diskette. The sources include
a setting which lets you set the dump to another track at compile time.
Although this might allow to dump nearly without damaging a file-system,
it's very boreing to read the complete diskette with dd (yes I know, other
implementations of dd exist which know how to seek()).

On some very broken bioses, it might not work at all (hang or reboot), but
I think that even most 486s are OK. I've tested it on several PCs and have
not seen any problem.

I'd like your comments about this, and if you find it interesting, I'll try
to enhance it with new features :

- log more info (system release, CPU type, mem size, modules ...)
- dump the complete memory to a swap partition. But I don't think this
is really useful since users will not mail their swap part to developpers
:-)
- more interactivity in real mode (ask the user where to dump ...)
- output the dump to a printer
- automatic dump and reboot after a crash, when possible, of course.

If you have other ideas, I'm waiting for them. If you think this is completely
useless, please tell me it too.

Hey, last advice : just as some other SysRq commands, this one definetely
crashes your OS when used, so don't play with it when not needed, and
don't forget to sync, and umount before Dumping !

The uuencoded gzipped patch is at the end of this mail. You can also get it
(non-uuencoded) from the site below :

http://www-miaif.lip6.fr/willy/pub/linux-patches/

Willy

--
Willy Tarreau - mailto:willy@meta-x.org -  http://www-miaif.lip6.fr/willy/
System and Network Engineer at NOVECOM ( France ) - http://www.novecom.fr/ 
Magistere d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CLQ3ISEP<6C@PLG&)@4>TMV%KN.2V@ MFH9?J,`<\`?F38;B;1[37]`.%<>H0D`**`<P#E:SYS"\Z9K`:^1PV&F(A%H= M>=>GU3FT6N6K/FO`]\,/'X?7UQ9QK8J'<8('$)HC4H-G]N2VU`/+WFN+>&JN M@J/L>7M]F3`6OG!!L(SJJRSE>Q+%O.:5H4Z=2QGD3OT$I:34D%C*EELDPIIT M6_12NO27=Z:B*_R>R9@GD,NLOON0/',B6<V3$BFFEL7'_T;&;01H3<,O]['8 MBI#*MCPR_EG[G31'CA=4W,0;O*X-8IX19OZR)(2#RE+R*ZNI0?P<0=8D_27B M9!OUT68'<[$8(Z39B#T=ZTH"\NA.+8AW$/OH&OLX/+9:=F$?Y<HSKA9W=P@: MYV'=^>>;J^$'9W#[B1<5(7+W,Z+';K5??LT^EA`7+'U&:T`JN.Z?(Q>,&+=$ MBEC<NO+UH-)9*K\^Z9!*C[8/>I1=(B'/AG"9&1I@%5P;V9',(2_DY18NT_8& M4H#[/-J4%YTX!7&G)Y5';$K(>S3!+DMN,R*6;]>QVM9BX?J#2A1<?U#[A!TN MM$OM'MG'_2[B7V=;_-N`^NH[?.TNJPW7X\W`=^X,G`L.9/*?,4T^3>8Z\QUQ M*GTM-)'Q'8&5*.-(("EP(`/F9;"#\9MH\P:75#*)A.,3)@H6=6(LZ5$YTJ?5 M53)!T3P.,]'-8RH6-JZ/\K'<M7@8FIIGRH%9U(O_.>=OI1.0I^(*A:UR1^E< M?KJ\^T"['TUC)R!]^FL*D["P7M"S1Q3]";U[1QD,BWO2BM57,0VCLM>5E4CD 3W$BFL%($$F-I_P9)$NF`("H````` ` end

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/