Saving panic logs in nonvolatile memory based on Pstore and ramoops implementations
The steps are as follows
0. Determine the address range
Demand knows in advance the starting address and length of nonvolatile memory used to hold the panic log. For example, the author used the part of the memory of the starting address is 0x11ff000000, the length is 16M.
2. Modifying the kernel
ramoops driver Support:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8A/2A/wKioL1gpthDCVFJKAABpX8oyDlw237.png "title=" Pstore _menu_config.png "alt=" wkiol1gpthdcvfjkaabpx8oydlw237.png "/> Build driver load process, if you find that the independent non-volatile storage load driver fails, check whether you need to modify the kernel driver, especially The request_mem_region() function in fs/pstore/ram_core.c , and then determine whether persistent_ram_vmap() is selected or Persistent_ram_iomap () to map the physical address to the kernel linear address space.
3. specify the relevant startup parameters on the command line
For the kernel of the ramoops module buildin , add the above startup parameters directly to the kernel command line:
ramoops.mem_address=0x11ff000000ramoops.mem_size=0x1000000 Pstore.backend=ramoops
For the kernel of the ramoops module buildout , the following parameters are required on the kernel command line:
Pstore.backend=ramoops
Also, after the kernel is booted, you need to refer to the following command to load the ramoops driver:
Modproberamoops.ko ramoops.mem_address=0x11ff000000ramoops.mem_size=0x1000000
Note that Ramoops.ko relies on the module Reed_solomon.koand needs to be installed in advance,Reed_solomon.ko can refer to the following command generation:
Cdlib/reed_solomon && make-c/lib/modules/' uname-r '/buildmodules
&&modprobe Reed_solomon
Then load the ramoops driver, and through the DMESG you can see it succeed:
[301.921706] console [pstore-1] enabled
[301.921841] pstore:registered ramoops as persistent store backend
[301.921862] ramoops:attached [email protected], ecc:0/0
4. Run the test
reboot Machine, you can see oopsmessage details when you get back up :
[Email protected]pstore]# pwd
/sys/fs/pstore
[[Email protected]pstore]# LS-ALRT
Total0
drwxr-xr-x.5 root root 0 Nov 7 01:04..
Drwxr-xr-x.2 root root 0 Nov 7 01:04.
-r--r--r--. 1 root root 4084 Nov 7 01:17 dmesg-ramoops-0
-r--r--r--. 1 root root 4084 Nov 7 01:17 console-ramoops
5. Reference Documentation:
[Email protected]lsd-linux-kernel]# ls documentation/ramoops.txt
Documentation/ramoops.txt
[Email protected]lsd-linux-kernel]# ls Documentation/abi/testing/pstore
Documentation/abi/testing/pstore
This article is from the "Store Chef" blog, so be sure to keep this source http://xiamachao.blog.51cto.com/10580956/1872790
Saving panic logs in nonvolatile memory based on Pstore and Ramoops implementations