aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorFrédéric Danis <frederic.danis@collabora.com>2020-03-20 10:59:22 +0100
committerTom Rini <trini@konsulko.com>2020-10-14 11:16:19 -0400
commit9744d1a547847dea89277b00606fe4c837c1b4ea (patch)
treed473ca3cbd4032fc990850875b2f328ae16438d7 /doc
parent55fca74a5ba9bb0a101b247f421e81322b945a7b (diff)
downloadu-boot-9744d1a547847dea89277b00606fe4c837c1b4ea.zip
u-boot-9744d1a547847dea89277b00606fe4c837c1b4ea.tar.gz
u-boot-9744d1a547847dea89277b00606fe4c837c1b4ea.tar.bz2
cmd: Add command to display or save Linux PStore dumps
This patch adds a new pstore command allowing to display or save ramoops logs (oops, panic, console, ftrace and user) generated by a previous kernel crash. PStore parameters can be set in U-Boot configuration file, or at run-time using "pstore set" command. Records size should be the same as the ones used by kernel, and should be a power of 2. This command allows: - to display uncompressed logs - to save compressed or uncompressed logs, compressed logs are saved as a compressed stream, it may need some work to be able to decompress it, e.g. adding a fake header: "printf "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x00" | cat - dmesg-ramoops-0.enc.z | gzip -dc" - ECC part is not used to check memory corruption - only 1st FTrace log is displayed or saved Signed-off-by: Frédéric Danis <frederic.danis@collabora.com> [trini: Minor updates for current design, correct spacing in rST] Signed-off-by: Tom Rini <trini@konsulko.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'doc')
-rw-r--r--doc/index.rst7
-rw-r--r--doc/pstore.rst80
2 files changed, 87 insertions, 0 deletions
diff --git a/doc/index.rst b/doc/index.rst
index fd9f10f..68a083b 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -109,6 +109,13 @@ Android-specific features available in U-Boot.
android/index
+Command line
+------------
+.. toctree::
+ :maxdepth: 2
+
+ pstore.rst
+
Indices and tables
==================
diff --git a/doc/pstore.rst b/doc/pstore.rst
new file mode 100644
index 0000000..4fceb2d
--- /dev/null
+++ b/doc/pstore.rst
@@ -0,0 +1,80 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+PStore command
+==============
+
+Design
+------
+
+Linux PStore and Ramoops modules (Linux config options PSTORE and PSTORE_RAM)
+allow to use memory to pass data from the dying breath of a crashing kernel to
+its successor. This command allows to read those records from U-Boot command
+line.
+
+Ramoops is an oops/panic logger that writes its logs to RAM before the system
+crashes. It works by logging oopses and panics in a circular buffer. Ramoops
+needs a system with persistent RAM so that the content of that area can survive
+after a restart.
+
+Ramoops uses a predefined memory area to store the dump.
+
+Ramoops parameters can be passed as kernel parameters or through Device Tree,
+i.e.::
+
+ ramoops.mem_address=0x30000000 ramoops.mem_size=0x100000 ramoops.record_size=0x2000 ramoops.console_size=0x2000 memmap=0x100000$0x30000000
+
+The same values should be set in U-Boot to be able to retrieve the records.
+This values can be set at build time in U-Boot configuration file, or at runtime.
+
+The PStore configuration parameters are:
+
+======================= ==========
+ Name Default
+======================= ==========
+CMD_PSTORE_MEM_ADDR
+CMD_PSTORE_MEM_SIZE 0x10000
+CMD_PSTORE_RECORD_SIZE 0x1000
+CMD_PSTORE_CONSOLE_SIZE 0x1000
+CMD_PSTORE_FTRACE_SIZE 0x1000
+CMD_PSTORE_PMSG_SIZE 0x1000
+CMD_PSTORE_ECC_SIZE 0
+======================= ==========
+
+Records sizes should be a power of 2.
+The memory size and the record/console size must be non-zero.
+
+Multiple 'dump' records can be stored in the memory reserved for PStore.
+The memory size has to be larger than the sum of the record sizes, i.e.::
+
+ MEM_SIZE >= RECORD_SIZE * n + CONSOLE_SIZE + FTRACE_SIZE + PMSG_SIZE
+
+Usage
+-----
+
+Generate kernel crash
+~~~~~~~~~~~~~~~~~~~~~
+
+For test purpose, you can generate a kernel crash by setting reboot timeout to
+10 seconds and trigger a panic::
+
+ $ sudo sh -c "echo 1 > /proc/sys/kernel/sysrq"
+ $ sudo sh -c "echo 10 > /proc/sys/kernel/panic"
+ $ sudo sh -c "echo c > /proc/sysrq-trigger"
+
+Retrieve logs in U-Boot
+~~~~~~~~~~~~~~~~~~~~~~~
+
+First of all, unless PStore parameters as been set during U-Boot configuration
+and match kernel ramoops parameters, it needs to be set using 'pstore set', e.g.::
+
+ => pstore set 0x30000000 0x100000 0x2000 0x2000
+
+Then all available dumps can be displayed
+using::
+
+ => pstore display
+
+Or saved to an existing directory in an Ext2 or Ext4 partition, e.g. on root
+directory of 1st partition of the 2nd MMC::
+
+ => pstore save mmc 1:1 /