oops and panic message logging to MTD
Kernel oops and panic messages are invaluable when debugging crashes. These messages often don't make it to flash based logging methods (say a syslog on jffs2) due to the overheads involved in writing to flash.
This patch allows you to turn an MTD partition into a circular log buffer where kernel oops and panic messages are written to. The messages are obtained by registering a console driver and checking oops_in_progress. Erases are performed in advance to maximise the chances of a saving messages.
To activate it, add console=ttyMTDx to the kernel commandline (where x is the mtd device number to use).
--- drivers/mtd/Kconfig | 8 + drivers/mtd/Makefile | 1 drivers/mtd/mtdoops.c | 365 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 374 insertions(+)
drivers/mtd/Kconfig +8 -0
@@ -278,6 +278,14 @@ config SSFDC This enables read only access to SmartMedia formatted NAND flash. You can mount it with FAT file system. +config MTD_OOPS + tristate "Log panic/oops to an MTD buffer" + depends on MTD + help + This enables panic and oops messages to be logged to a circular + buffer in a flash partition where it can be read back at some + later point. + source "drivers/mtd/chips/Kconfig" source "drivers/mtd/maps/Kconfig"
drivers/mtd/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_NFTL) += nftl.o obj-$(CONFIG_INFTL) += inftl.o obj-$(CONFIG_RFD_FTL) += rfd_ftl.o obj-$(CONFIG_SSFDC) += ssfdc.o +obj-$(CONFIG_MTD_OOPS) += mtdoops.o nftl-objs := nftlcore.o nftlmount.o inftl-objs := inftlcore.o inftlmount.o
drivers/mtd/mtdoops.c new file +365 -0
365 lines not on this page · raw message
Quoted 10 lines · Richard Purdie
Kernel oops and panic messages are invaluable when debugging crashes. These messages often don't make it to flash based logging methods (say a syslog on jffs2) due to the overheads involved in writing to flash.
This patch allows you to turn an MTD partition into a circular log buffer where kernel oops and panic messages are written to. The messages are obtained by registering a console driver and checking
oops_in_progress. Erases are performed in advance to maximise the chances of a saving messages.
Quoted 4 lines
To activate it, add console=ttyMTDx to the kernel commandline (where x is the mtd device number to use).
Signed-off-by Richard Purdie <[email protected]>
I meant to add, http://folks.o-hand.com/richard/oopslog.c is an example of extracting this information in userspace. It will work with an mtdblock device or a dump of the mtd partition.
Cheers,
Richard