wiki:SF_Ch_pstore

Version 6 (modified by admin, 6 years ago) (diff)

--

pstore

see also https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/ramoops.rst

do debug the boot process the pstore driver is used to create a persitant storage area that survives boot.

The principle idea is:

  • boot the boot image that you want to debug and write the boot log to pstore
  • generate a kernel panic
  • boot a recovery boot image that also has pstore enabled to analyze the log

In the TWRP recovery image for the chiron pstore is enabled and pstore is automatically mounted to /sys/fs/pstore/

Kernel

The following options have to be enabled in the kernel config (in both boot images)

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

Mounting pstore

To read the info in pstore it has to be mounted (in the boot image that is used to analyze the pstore) with something like

mount -t pstore pstore /sys/fs/pstore

Writing to pstore

When CONFIG_PSTORE_PMSG is enabled it defines a device /dev/pmsg0 to which one can write messages

echo "Hello Guhl" > /dev/pmsg0

After the kernel panic and reboot the result should be in /sys/fs/pstore/pmsg-ramoops-X

Kernel panic

For what ever reason the standard way to generate a kernel panic

echo c > /proc/sysrq-trigger

did not work for me so I created a kernel module that I can modprobe to generate a panic.

I am using the attached kernel module to create a kernel panic (modprobe the module) See also https://github.com/guhl/android_kernel_xiaomi_msm8998-1/commit/50c8d7f1ba19002b6743b96b6ce043470e4bbb87 The files are placed in a directory "panic" in the kernel directory and enabled in kernel config with

CONFIG_GUHL_PANIC=m

In addition the following line has to be added to the Makefile in the kernel directory.

obj-y += panic/

and the following line has to be added to the to the Kconfig in the root of the kernel directory

source "kernel/panic/Kconfig"

Attachments (3)

Download all attachments as: .zip