I am using 5.8 upstream linux kernel and running it on virt machine of QEMU. The dts shows that this machine already has a flash memory :

flash@0 {
        bank-width = <0x4>;
        reg = <0x0 0x0 0x0 0x4000000 0x0 0x4000000 0x0 0x4000000>;
        compatible = "cfi-flash";

So I created partitions on it and want to use that for mtdoops. After struggling for a day, so, far, I am able to get the flash detected as mtddevice and the partitions also look ok.

/ # dmesg | grep -i mtd
[    0.000000] Kernel command line: console=ttyAMA0,115200n8 root=/dev/nfs rw nfsroot=,nolock,vers=4,tcp ip= pstore.backend=mtdoops mtdoops.mtddev=0 printk.always_kmsg_dump mtdparts=0.flash:512k(mtdoops),18m(other)
[    1.203164] mtd device must be supplied (device name is empty)
[    1.213436] Concatenating MTD devices:
[    1.215403] 2 cmdlinepart partitions found on MTD device 0.flash
[    1.215693] Creating 2 MTD partitions on "0.flash":
[    1.216056] 0x000000000000-0x000000080000 : "mtdoops"
[    1.223686] mtdoops: Attached to MTD device 0
[    1.223784] mtdoops: ready 0, 1

However, when I trigger kernel panic using echo c > /proc/sysrq-trigger, the pstore logs are not written giving the error :

/ # echo c > /proc/sysrq-trigger
[  207.196767] sysrq: Trigger a crash
[  207.197679] Kernel panic - not syncing: sysrq triggered crash
[  207.198163] CPU: 1 PID: 137 Comm: sh Not tainted 5.8.0-dirty #6
[  207.206263] mtdoops: Cannot write from panic without panic_write
[  207.207001] Rebooting in 2 seconds..

I checked the source code in drivers/mtd/chips/ and I can see that cfi_cmdset_0002.c defines the panic_write handler. Even though I have enabled them in my config, but it appears from the message that this is supported only for few chips. Can anyone please hint or guide, if whatever i am trying is really possible or do I need to emulate a different NAND chip?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.