using persistant storage in linux kernel

user2910111 picture user2910111 · Feb 16, 2015 · Viewed 7.8k times · Source

I am trying to use persistent store(Pstore) available in linux kernel but somehow i am not getting the logs in case of kernel panics,i made the following kernel modules in kernel config file as built in

**CONFIG_PSTORE=y CONFIG_PSTORE_CONSOLE=y CONFIG_PSTORE_RAM=y**

now a/c to documentation pstore i should get the logs on next reboot in /sys/fs/pstore/... (or /dev/pstore/...) but couldn't find the logs present there. am i missing something...?

Answer

shadowfire picture shadowfire · Jan 10, 2018

Besides the kernel config options:

CONFIG_PSTORE=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
CONFIG_PSTORE_RAM=y

I had to reserve a part of memory in which the logs will be saved. I did this through the device tree like this:

reserved-memory {
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;

    pstore: pstore@FF00000 {
        no-map;
        reg = <0x0 0xFF00000 0x0 0x00100000>;  /* pstore/ramoops buffer
            starts at memory address 0xFF00000 and is of size 0x00100000 */
    };
};

ramoops {
    compatible = "ramoops";
    memory-region = <&pstore>;
    record-size     = <0x0 0x00020000>;
    console-size    = <0x0 0x00020000>;
    pmsg-size       = <0x0 0x00020000>;
};

Also, check if the following kernel patch is present (which is needed for the kernel to be able to parse the options given above): https://android-review.googlesource.com/#/c/kernel/common/+/195160/

Another way is to turn it on through the kernel cmdline, for example:

ramoops.mem_address=0x30000000 ramoops.mem_size=0x100000 memmap=0x100000$0x30000000