Add command to display or save Linux PStore dumps
v5 cover Add command to display or save Linux PStore dumps
This serie of patches 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. For kernel using Device Tree, the parameters are dynamically added to Device Tree.
Records size should be the same as the ones used by kernel, and should be a power of 2.
Changes in v5:
- Fix test_pstore.py license
- Change log level on error messages in fdt_fixup_pstore()
- Replace fdt_appendprop_?() by fdt_setprop_?() when adding a new property
Changes in v4:
- Fix PStore memory address in sandbox defconfig files for tests
Changes in v3:
- Add default value for PStore memory size
- Remove default value of PStore memory address
- Update config entry helps
- Replace calls to debug() by log_debug()
- Update documentation
- Replace 1M test file by 3 * 4K files and build pstore memory during test
- Add fdt_fixup_pstore() to pass PStore/Ramoops parameters to kernel
Changes in v2:
- Fix 64bit mode build warnings
- Add documentation
- Add function description comments
- Replace calls to pr_debug() by debug()
- Add CONFIG_CMD_PSTORE to sandbox and sandbox64
- Add unit tests
Fr?d?ric Danis (3):
cmd: Add command to display or save Linux PStore dumps
test: Add PStore command tests
cmd: Fixup DT to pass PStore Ramoops parameters
cmd/Kconfig | 71 +++ cmd/Makefile | 1 + cmd/pstore.c | 543 +++++++++++++++++++++ common/image-fdt.c | 4 + configs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + doc/index.rst | 7 + doc/pstore.rst | 76 +++ include/fdt_support.h | 3 + test/py/tests/test_pstore.py | 73 +++ test/py/tests/test_pstore_data_console.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic1.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic2.hex | Bin 0 -> 4096 bytes 13 files changed, 782 insertions(+) create mode 100644 cmd/pstore.c create mode 100644 doc/pstore.rst create mode 100644 test/py/tests/test_pstore.py create mode 100644 test/py/tests/test_pstore_data_console.hex create mode 100644 test/py/tests/test_pstore_data_panic1.hex create mode 100644 test/py/tests/test_pstore_data_panic2.hex
Signature · 1 line
2.18.0
PATCH v5 1/3 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
---
Changes in v5: None
Changes in v4: None
Changes in v3:
- Add default value for PStore memory size
- Remove default value of PStore memory address
- Update config entry helps
- Replace calls to debug() by log_debug()
- Update documentation
Changes in v2:
- Fix 64bit mode build warnings
- Add documentation
- Add function description comments
- Replace calls to pr_debug() by debug()
cmd/Kconfig | 71 +++++++ cmd/Makefile | 1 + cmd/pstore.c | 505 +++++++++++++++++++++++++++++++++++++++++++++++++ doc/index.rst | 7 + doc/pstore.rst | 74 ++++++++ 5 files changed, 658 insertions(+) create mode 100644 cmd/pstore.c create mode 100644 doc/pstore.rst
cmd/Kconfig +71 -0
@@ -1736,6 +1736,77 @@ config CMD_QFW feature is to allow easy loading of files passed to qemu-system via -kernel / -initrd +config CMD_PSTORE + bool "pstore" + help + This provides access to Linux PStore with Rammoops backend. The main + feature is to allow to display or save PStore records. + + See doc/pstore.rst for more information. + +if CMD_PSTORE + +config CMD_PSTORE_MEM_ADDR + hex "Memory Address" + depends on CMD_PSTORE + help + Base addr used for PStore ramoops memory, should be identical to + ramoops.mem_address parameter used by kernel + +config CMD_PSTORE_MEM_SIZE + hex "Memory size" + depends on CMD_PSTORE + default "0x10000" + help + Size of PStore ramoops memory, should be identical to ramoops.mem_size + parameter used by kernel, a power of 2 and larger than the sum of the + record sizes + +config CMD_PSTORE_RECORD_SIZE + hex "Dump record size" + depends on CMD_PSTORE + default "0x1000" + help + Size of each dump done on oops/panic, should be identical to + ramoops.record_size parameter used by kernel and a power of 2 + Must be non-zero + +config CMD_PSTORE_CONSOLE_SIZE + hex "Kernel console log size" + depends on CMD_PSTORE + default "0x1000" + help + Size of kernel console log, should be identical to + ramoops.console_size parameter used by kernel and a power of 2 + Must be non-zero + +config CMD_PSTORE_FTRACE_SIZE + hex "FTrace log size" + depends on CMD_PSTORE + default "0x1000" + help + Size of ftrace log, should be identical to ramoops.ftrace_size + parameter used by kernel and a power of 2 + +config CMD_PSTORE_PMSG_SIZE + hex "User space message log size" + depends on CMD_PSTORE + default "0x1000" + help + Size of user space message log, should be identical to + ramoops.pmsg_size parameter used by kernel and a power of 2 + +config CMD_PSTORE_ECC_SIZE + int "ECC size" + depends on CMD_PSTORE + default "0" + help + if non-zero, the option enables ECC support and specifies ECC buffer + size in bytes (1 is a special value, means 16 bytes ECC), should be + identical to ramoops.ramoops_ecc parameter used by kernel + +endif + source "cmd/mvebu/Kconfig" config CMD_TERMINAL
cmd/Makefile +1 -0
@@ -110,6 +110,7 @@ obj-$(CONFIG_CMD_PCI) += pci.o endif obj-$(CONFIG_CMD_PINMUX) += pinmux.o obj-$(CONFIG_CMD_PMC) += pmc.o +obj-$(CONFIG_CMD_PSTORE) += pstore.o obj-$(CONFIG_CMD_PXE) += pxe.o pxe_utils.o obj-$(CONFIG_CMD_WOL) += wol.o obj-$(CONFIG_CMD_QFW) += qfw.o
cmd/pstore.c new file +505 -0
505 lines not on this page · raw message
doc/index.rst +7 -0
@@ -98,6 +98,13 @@ Android-specific features available in U-Boot. android/index +Command line +------------ +.. toctree:: + :maxdepth: 2 + + pstore.rst + Indices and tables ==================
doc/pstore.rst new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v5 1/3 cmd: Add command to display or save Linux PStore dumps
Quoted 16 lines · Fr?d?ric Danis
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
Quoted 5 lines
Signed-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/64705ec6/attachment.sig>
PATCH v5 2/3 test: Add PStore command tests
In reply to Frédéric DanisAdd PStore command to sandbox and sandbox64 defconfigs. Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all records
---
Changes in v5:
- Fix test_pstore.py license
Changes in v4:
- Fix PStore memory address in sandbox defconfig files for tests
Changes in v3:
- Replace 1M test file by 3 * 4K files and build pstore memory during test
New in v2:
- Add unit tests
configs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + test/py/tests/test_pstore.py | 73 +++++++++++++++++++++ test/py/tests/test_pstore_data_console.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic1.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic2.hex | Bin 0 -> 4096 bytes 6 files changed, 77 insertions(+) create mode 100644 test/py/tests/test_pstore.py create mode 100644 test/py/tests/test_pstore_data_console.hex create mode 100644 test/py/tests/test_pstore_data_panic1.hex create mode 100644 test/py/tests/test_pstore_data_panic2.hex
configs/sandbox64_defconfig +2 -0
@@ -68,6 +68,8 @@ CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_PSTORE=y +CONFIG_CMD_PSTORE_MEM_ADDR=0x3000000 CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y
configs/sandbox_defconfig +2 -0
@@ -77,6 +77,8 @@ CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_PSTORE=y +CONFIG_CMD_PSTORE_MEM_ADDR=0x3000000 CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y
test/py/tests/test_pstore.py new file +73 -0
73 lines not on this page · raw message
test/py/tests/test_pstore_data_console.hex new file binary +0 -0
zcmcgv%TnVw6lJ!(nP0e*4NyZ8zvNd{7IX(_s%e at b&{Z=OMcI}D8f?ie*$MgYGC1f z?1ZL6Cktj4lpUjc?>YA&9Sz@~d<cKp+4<+!ogJz&$oSm@K6cyiWPFg4nS8)#lU-a z1K>Db&-IDxkz1&BYW{HH_2 at lNt}hF%c=vQY{D}JqApUVz+M^#mQS38q21kR=dA1k z656*dwDxHrn#gIb!N!=1-E&>xgDwrjz_Af2FP at z4lvdzaX=YhgZ%XBT48sLX{ZLm_ zPDKnyPbK0<-l>$;Z%Z$c>pK{J at i~S|h6zy>7x$oN7_fK;cGUADG6$&=L1hs0QKS( zril``cu(&!L?=-Xw9IKpfIgDFSv1Kf*Ch~>qQYlPHMl7^+#x2DWEeiw}D?30&Lu zqsYURQS9u;kd$Sj3aJL2(beJA^{4}~WayepG3b;^j(NRa+%N$G|L&T41flTrm77 zl7bC7{aUMj%0)j*1m-ZU)vU{&ScXQN4qV at YOcuqU(?+|)pqi=961Pu$5^ROr3u5<e zapyekE1qT#SQ)0Cy>>IHSVMt?8z_X9<$KXq6bOmEx2Ld5{qrht!K;=+w26WfMv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lines · Fr?d?ric Danis
Add PStore command to sandbox and sandbox64 defconfigs. Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all recordsSigned-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes in v5:
- Fixtest_pstore.pylicenseChanges in v4:
- Fix PStore memory address in sandbox defconfig files for testsChanges in v3:
- Replace 1M test file by 3 * 4K files and build pstore memory during testNew in v2:
- Add unit tests
Quoted 11 lines
configs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + test/py/tests/test_pstore.py | 73 +++++++++++++++++++++ test/py/tests/test_pstore_data_console.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic1.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic2.hex | Bin 0 -> 4096 bytes 6 files changed, 77 insertions(+) create mode 100644 test/py/tests/test_pstore.py create mode 100644 test/py/tests/test_pstore_data_console.hex create mode 100644 test/py/tests/test_pstore_data_panic1.hex create mode 100644 test/py/tests/test_pstore_data_panic2.hex
Sorry for the delay here. When I run the tests I see:
------------------------------------ Captured stdout call ------------------------------------- =>
=> => host load hostfs - 0x3000000 test/py/tests/test_pstore_data_panic1.hex 4096 bytes read in 0 ms
=> => host load hostfs - 0x3001000 test/py/tests/test_pstore_data_panic2.hex
0 bytes read in 0 ms
=> => host load hostfs - 0x30fd000 test/py/tests/test_pstore_data_console.hex 4096 bytes read in 0 ms
=> => pstore set 0x3000000 0x100000
=> => pstore save hostfs - /tmp/tmp1xx0rahx
3798 bytes written in 1 ms (3.6 MiB/s)
4084 bytes written in 0 ms
=> => load hostfs - 1000008 /tmp/tmp1xx0rahx/dmesg-ramoops-0
3798 bytes read in 0 ms
=> => printenv filesize
filesize=ed6
=> => md5sum 1000008 $filesize
md5 for 01000008 ... 01000edd ==> 8059335ab4cfa62c77324c491659c503
=> => setenv filesize
=> => load hostfs - 1000008 /tmp/tmp1xx0rahx/dmesg-ramoops-1
Failed to load '/tmp/tmp1xx0rahx/dmesg-ramoops-1'
=> => printenv filesize
## Error: "file
=================================== short test summary info ===================================
So I'm not sure why the second one fails to load.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201013/fdd8b78c/attachment.sig>
PATCH v5 2/3 test: Add PStore command tests
Hi Tom,
Quoted 63 lines · Tom Rini
Quoted 31 lines · Fr?d?ric Danis
Add PStore command to sandbox and sandbox64 defconfigs. Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all recordsSigned-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes in v5:
- Fixtest_pstore.pylicenseChanges in v4:
- Fix PStore memory address in sandbox defconfig files for testsChanges in v3:
- Replace 1M test file by 3 * 4K files and build pstore memory during testNew in v2:
- Add unit testsconfigs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + test/py/tests/test_pstore.py | 73 +++++++++++++++++++++ test/py/tests/test_pstore_data_console.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic1.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic2.hex | Bin 0 -> 4096 bytes 6 files changed, 77 insertions(+)Quoted 4 lines
create mode 100644
test/py/tests/test_pstore.pycreate mode 100644 test/py/tests/test_pstore_data_console.hex create mode 100644 test/py/tests/test_pstore_data_panic1.hex create mode 100644 test/py/tests/test_pstore_data_panic2.hexSorry for the delay here. When I run the tests I see:
------------------------------------ Captured stdout call ------------------------------------- =>
=> => host load hostfs -0x3000000test/py/tests/test_pstore_data_panic1.hex 4096 bytes read in 0 ms
=> => host load hostfs -0x3001000test/py/tests/test_pstore_data_panic2.hex
0 bytes read in 0 ms
=> => host load hostfs -0x30fd000test/py/tests/test_pstore_data_console.hex 4096 bytes read in 0 ms
=> => pstore set0x30000000x100000
=> => pstore save hostfs -/tmp/tmp1xx0rahx
3798 bytes written in 1 ms (3.6 MiB/s)
4084 bytes written in 0 ms
=> => load hostfs - 1000008/tmp/tmp1xx0rahx/dmesg-ramoops-0
3798 bytes read in 0 ms
=> => printenv filesize
filesize=ed6
=> => md5sum 1000008 $filesize
md5 for 01000008 ...01000edd==>8059335ab4cfa62c77324c491659c503
=> => setenv filesize
=> => load hostfs - 1000008/tmp/tmp1xx0rahx/dmesg-ramoops-1
Failed to load '/tmp/tmp1xx0rahx/dmesg-ramoops-1'
=> => printenv filesize
## Error: "file
=================================== short test summary info ===================================
Quoted 2 lines
So I'm not sure why the second one fails to load.
It seems that the "test_pstore_data_panic2.hex" test file was not loaded correctly in memory, so the "dmesg-ramoops-1" was not generated
Regards,
Fred
PATCH v5 2/3 test: Add PStore command tests
Quoted 66 lines · Fr?d?ric Danis
Hi Tom,
Quoted 63 lines · Tom Rini
Quoted 31 lines · Fr?d?ric Danis
Add PStore command to sandbox and sandbox64 defconfigs. Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all recordsSigned-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes in v5:
- Fixtest_pstore.pylicenseChanges in v4:
- Fix PStore memory address in sandbox defconfig files for testsChanges in v3:
- Replace 1M test file by 3 * 4K files and build pstore memory during testNew in v2:
- Add unit testsconfigs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + test/py/tests/test_pstore.py | 73 +++++++++++++++++++++ test/py/tests/test_pstore_data_console.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic1.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic2.hex | Bin 0 -> 4096 bytes 6 files changed, 77 insertions(+)Quoted 4 lines
create mode 100644
test/py/tests/test_pstore.pycreate mode 100644 test/py/tests/test_pstore_data_console.hex create mode 100644 test/py/tests/test_pstore_data_panic1.hex create mode 100644 test/py/tests/test_pstore_data_panic2.hexSorry for the delay here. When I run the tests I see:
------------------------------------ Captured stdout call ------------------------------------- =>
=> => host load hostfs -0x3000000test/py/tests/test_pstore_data_panic1.hex 4096 bytes read in 0 ms
=> => host load hostfs -0x3001000test/py/tests/test_pstore_data_panic2.hex
0 bytes read in 0 ms
=> => host load hostfs -0x30fd000test/py/tests/test_pstore_data_console.hex 4096 bytes read in 0 ms
=> => pstore set0x30000000x100000
=> => pstore save hostfs -/tmp/tmp1xx0rahx
3798 bytes written in 1 ms (3.6 MiB/s)
4084 bytes written in 0 ms
=> => load hostfs - 1000008/tmp/tmp1xx0rahx/dmesg-ramoops-0
3798 bytes read in 0 ms
=> => printenv filesize
filesize=ed6
=> => md5sum 1000008 $filesize
md5 for 01000008 ...01000edd==>8059335ab4cfa62c77324c491659c503
=> => setenv filesize
=> => load hostfs - 1000008/tmp/tmp1xx0rahx/dmesg-ramoops-1
Failed to load '/tmp/tmp1xx0rahx/dmesg-ramoops-1'
=> => printenv filesize
## Error: "file
=================================== short test summary info ===================================
Quoted 4 lines
Quoted 2 lines
So I'm not sure why the second one fails to load.
It seems that the "test_pstore_data_panic2.hex" test file was not loaded correctly in memory, so the "dmesg-ramoops-1" was not generated
So there's two problems. One of which is that we need to do something like this:
test/py/tests/test_pstore.py +4 -3
@@ -4,6 +4,7 @@ import pytest import u_boot_utils +import os import tempfile import shutil
@@ -18,9 +19,9 @@ def load_pstore(u_boot_console): """Load PStore records from sample files""" output = u_boot_console.run_command_list([ - 'host load hostfs - 0x%x %s' % (PSTORE_ADDR, PSTORE_PANIC1), - 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 4096, PSTORE_PANIC2), - 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 253 * 4096, PSTORE_CONSOLE), + 'host load hostfs - 0x%x %s' % (PSTORE_ADDR, os.path.join(u_boot_console.config.source_dir, PSTORE_PANIC1)), + 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 4096, os.path.join(u_boot_console.config.source_dir, PSTORE_PANIC2)), + 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 253 * 4096, os.path.join(u_boot_console.config.source_dir, PSTORE_CONSOLE)), 'pstore set 0x%x 0x%x' % (PSTORE_ADDR, PSTORE_LENGTH)]) def checkfile(u_boot_console, path, filesize, checksum):
to ensure that we load from the source directory and not relative directory. The other problem is that the patch results in a zero byte file for that second one.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201013/1a582d00/attachment.sig>
PATCH v5 2/3 test: Add PStore command tests
Quoted 100 lines · Tom Rini
Quoted 66 lines · Fr?d?ric Danis
Hi Tom,
Quoted 63 lines · Tom Rini
Quoted 31 lines · Fr?d?ric Danis
Add PStore command to sandbox and sandbox64 defconfigs. Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all recordsSigned-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes in v5:
- Fixtest_pstore.pylicenseChanges in v4:
- Fix PStore memory address in sandbox defconfig files for testsChanges in v3:
- Replace 1M test file by 3 * 4K files and build pstore memory during testNew in v2:
- Add unit testsconfigs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + test/py/tests/test_pstore.py | 73 +++++++++++++++++++++ test/py/tests/test_pstore_data_console.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic1.hex | Bin 0 -> 4096 bytes test/py/tests/test_pstore_data_panic2.hex | Bin 0 -> 4096 bytes 6 files changed, 77 insertions(+)Quoted 4 lines
create mode 100644
test/py/tests/test_pstore.pycreate mode 100644 test/py/tests/test_pstore_data_console.hex create mode 100644 test/py/tests/test_pstore_data_panic1.hex create mode 100644 test/py/tests/test_pstore_data_panic2.hexSorry for the delay here. When I run the tests I see:
------------------------------------ Captured stdout call ------------------------------------- =>
=> => host load hostfs -0x3000000test/py/tests/test_pstore_data_panic1.hex 4096 bytes read in 0 ms
=> => host load hostfs -0x3001000test/py/tests/test_pstore_data_panic2.hex
0 bytes read in 0 ms
=> => host load hostfs -0x30fd000test/py/tests/test_pstore_data_console.hex 4096 bytes read in 0 ms
=> => pstore set0x30000000x100000
=> => pstore save hostfs -/tmp/tmp1xx0rahx
3798 bytes written in 1 ms (3.6 MiB/s)
4084 bytes written in 0 ms
=> => load hostfs - 1000008/tmp/tmp1xx0rahx/dmesg-ramoops-0
3798 bytes read in 0 ms
=> => printenv filesize
filesize=ed6
=> => md5sum 1000008 $filesize
md5 for 01000008 ...01000edd==>8059335ab4cfa62c77324c491659c503
=> => setenv filesize
=> => load hostfs - 1000008/tmp/tmp1xx0rahx/dmesg-ramoops-1
Failed to load '/tmp/tmp1xx0rahx/dmesg-ramoops-1'
=> => printenv filesize
## Error: "file
=================================== short test summary info ===================================Quoted 4 lines
Quoted 2 lines
So I'm not sure why the second one fails to load.
It seems that the "test_pstore_data_panic2.hex" test file was not loaded correctly in memory, so the "dmesg-ramoops-1" was not generated
So there's two problems. One of which is that we need to do something like this:
test/py/tests/test_pstore.py +4
-3@@ -4,6 +4,7 @@ import pytest import u_boot_utils +import os import tempfile import shutil@@ -18,9 +19,9 @@ def load_pstore(u_boot_console): """Load PStore records from sample files""" output = u_boot_console.run_command_list([ - 'host load hostfs - 0x%x %s' % (PSTORE_ADDR, PSTORE_PANIC1), - 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 4096, PSTORE_PANIC2), - 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 253 * 4096, PSTORE_CONSOLE), + 'host load hostfs - 0x%x %s' % (PSTORE_ADDR, os.path.join(u_boot_console.config.source_dir, PSTORE_PANIC1)), + 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 4096, os.path.join(u_boot_console.config.source_dir, PSTORE_PANIC2)), + 'host load hostfs - 0x%x %s' % (PSTORE_ADDR + 253 * 4096, os.path.join(u_boot_console.config.source_dir, PSTORE_CONSOLE)), 'pstore set 0x%x 0x%x' % (PSTORE_ADDR, PSTORE_LENGTH)]) def checkfile(u_boot_console, path, filesize, checksum):
Quoted 3 lines
to ensure that we load from the source directory and not relative directory. The other problem is that the patch results in a zero byte file for that second one.
To be clear-er, patchwork is missing the last part of the file and I can't quite grab it from
https://lists.denx.de/pipermail/u-boot/2020-March/403645.html directly. If you just want to email me the file off-list, I can fix it up. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201013/ea96f85d/attachment.sig>
PATCH v5 2/3 test: Add PStore command tests
In reply to Frédéric DanisQuoted 11 lines · Fr?d?ric Danis
Add PStore command to sandbox and sandbox64 defconfigs. Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all recordsSigned-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>
With the test files supplied off-list and some minor changes to ensure it works reliably with separate source/build/run directories:
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/3aa04e11/attachment.sig>
PATCH v5 3/3 cmd: Fixup DT to pass PStore Ramoops parameters
In reply to Frédéric DanisTo simplify configuration and keep synchronized the PStore/Ramoops between U-Boot and the Linux kernel, this commit dynamically adds the Ramoops parameters defined in the U-Boot session to the Device Tree.
---
Changes in v5:
- Change log level on error messages in fdt_fixup_pstore()
- Replace fdt_appendprop_?() by fdt_setprop_?() when adding a new property
Changes in v4: None
New in v3:
- Add fdt_fixup_pstore() to pass PStore/Ramoops parameters to kernel
cmd/pstore.c | 38 ++++++++++++++++++++++++++++++++++++++ common/image-fdt.c | 4 ++++ doc/pstore.rst | 2 ++ include/fdt_support.h | 3 +++ 4 files changed, 47 insertions(+)
cmd/pstore.c +38 -0
@@ -479,6 +479,44 @@ static int do_pstore(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])return c->cmd (cmdtp, flag, argc, argv); } +void fdt_fixup_pstore (void *blob) +{ +char node[32 ]; +int nodeoffset;/* node offset from libfdt */ + + nodeoffset =fdt_path_offset (blob,"/" ); +if (nodeoffset <0 ) { +/* Not found or something else bad happened. */ +log_err ("fdt_path_offset() returned %s\n" ,fdt_strerror (nodeoffset)); +return ; + } + + nodeoffset =fdt_add_subnode (blob, nodeoffset,"reserved-memory" ); +if (nodeoffset <0 ) { +log_err ("Add 'reserved-memory' node failed: %s\n" , +fdt_strerror (nodeoffset)); +return ; + } +fdt_setprop_u32 (blob, nodeoffset,"#address-cells" ,2 ); +fdt_setprop_u32 (blob, nodeoffset,"#size-cells" ,2 ); +fdt_setprop_empty (blob, nodeoffset,"ranges" ); + +sprintf (node,"ramoops@%llx" , (unsigned long long )pstore_addr); + nodeoffset =fdt_add_subnode (blob, nodeoffset, node); +if (nodeoffset <0 ) { +log_err ("Add '%s' node failed: %s\n" , node,fdt_strerror (nodeoffset)); +return ; + } +fdt_setprop_string (blob, nodeoffset,"compatible" ,"ramoops" ); +fdt_setprop_u64 (blob, nodeoffset,"reg" , pstore_addr); +fdt_appendprop_u64 (blob, nodeoffset,"reg" , pstore_length); +fdt_setprop_u32 (blob, nodeoffset,"record-size" , pstore_record_size); +fdt_setprop_u32 (blob, nodeoffset,"console-size" , pstore_console_size); +fdt_setprop_u32 (blob, nodeoffset,"ftrace-size" , pstore_ftrace_size); +fdt_setprop_u32 (blob, nodeoffset,"pmsg-size" , pstore_pmsg_size); +fdt_setprop_u32 (blob, nodeoffset,"ecc-size" , pstore_ecc_size); +} +U_BOOT_CMD (pstore,10 ,0 , do_pstore,"Manage Linux Persistent Storage" , "set <addr> <len> [record-size] [console-size] [ftrace-size] [pmsg_size] [ecc-size]\n"
common/image-fdt.c +4 -0
@@ -547,6 +547,10 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, }/* Update ethernet nodes */ fdt_fixup_ethernet (blob); +#if CONFIG_IS_ENABLED (CMD_PSTORE ) +/* Append PStore configuration */ +fdt_fixup_pstore (blob); +#endif if (IMAGE_OF_BOARD_SETUP ) { fdt_ret =ft_board_setup (blob, gd->bd);if (fdt_ret) {
doc/pstore.rst +2 -0
@@ -24,6 +24,8 @@ i.e.:: 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. +U-Boot automatically patches the Device Tree to pass the Ramoops parameters to +the kernel. The PStore configuration parameters are:
include/fdt_support.h +3 -0
@@ -350,4 +350,7 @@ int fdt_update_ethernet_dt(void *blob);#ifdef CONFIG_FSL_MC_ENET void fdt_fixup_board_enet (void *blob);#endif +#ifdef CONFIG_CMD_PSTORE +void fdt_fixup_pstore (void *blob); +#endif #endif /* ifndef __FDT_SUPPORT_H */
Signature · 1 line
2.18.0
PATCH v5 3/3 cmd: Fixup DT to pass PStore Ramoops parameters
Quoted 9 lines · Fr?d?ric Danis
To simplify configuration and keep synchronized the PStore/Ramoops between U-Boot and the Linux kernel, this commit dynamically adds the Ramoops parameters defined in the U-Boot session to the Device Tree.
Signed-off-by Fr?d?ric Danis <[email protected]>Cc Tom Rini <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Wolfgang Denk <[email protected]>Cc Heiko Schocher <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/a811a661/attachment.sig>