linux - Why my MTD driver becomes a normal file? -


i using phram , ramoops store latest system log in reserved memory, once machine crashed dump panic log after reboot. mtd driver phram , module ramoops used automatically record system log memory:

/# insmod /lib/modules/phram.ko phram=phram-oops,<addr>,<len>     /# ls -l /dev/mtdchar/param-oops crw-r--r--    1 root     root       90,  24 jul 20 16:34 phram-oops 

it worked until reused driver backup boot loader log - during boot, phram-oops backs u-boot log 1 reserved memory area; , after linux shell up, dump u-boot log, clear phram-oops dd if=/dev/zero bs=65536 count=1 of=/dev/mtdchar/param-oops, rmmod phram , insmod phram new memory area panic log. dumping system logs of last boot. until step, /dev/mtdchar/phram-oops still works fine:

/# ls -l /dev/mtdchar/phram-oops crw-r--r--    1 root     root       90,  24 jul 20 16:34 /dev/mtdchar/phram-oops 

however, after running dd if=/dev/zero bs=65536 count=1 of=/dev/mtdchar/phram-oops” again clear memory, driver/dev/mtdchar/phram-oops` becomes file!!!

/# ls -l /dev/mtdchar/phram-oops -rw-r--r--    1 root     root         65536 jul 20 16:34 /dev/mtdchar/phram-oops 

and result previous logs remains in memory , not cleared. idea how driver turns file? , how fix it?

it seems problem caused hotplug - requires delay after rmmod phram , before insmod phram new address. otherwise, device driver not correctly loaded , result dd command create normal file.


Comments