ramoops.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Ramoops oops/panic logger
  2. =========================
  3. Sergiu Iordache <sergiu@chromium.org>
  4. Updated: 8 August 2011
  5. 0. Introduction
  6. Ramoops is an oops/panic logger that writes its logs to RAM before the system
  7. crashes. It works by logging oopses and panics in a circular buffer. Ramoops
  8. needs a system with persistent RAM so that the content of that area can
  9. survive after a restart.
  10. 1. Ramoops concepts
  11. Ramoops uses a predefined memory area to store the dump. The start and size of
  12. the memory area are set using two variables:
  13. * "mem_address" for the start
  14. * "mem_size" for the size. The memory size will be rounded down to a
  15. power of two.
  16. The memory area is divided into "record_size" chunks (also rounded down to
  17. power of two) and each oops/panic writes a "record_size" chunk of
  18. information.
  19. Dumping both oopses and panics can be done by setting 1 in the "dump_oops"
  20. variable while setting 0 in that variable dumps only the panics.
  21. The module uses a counter to record multiple dumps but the counter gets reset
  22. on restart (i.e. new dumps after the restart will overwrite old ones).
  23. 2. Setting the parameters
  24. Setting the ramoops parameters can be done in 2 different manners:
  25. 1. Use the module parameters (which have the names of the variables described
  26. as before).
  27. 2. Use a platform device and set the platform data. The parameters can then
  28. be set through that platform data. An example of doing that is:
  29. #include <linux/ramoops.h>
  30. [...]
  31. static struct ramoops_platform_data ramoops_data = {
  32. .mem_size = <...>,
  33. .mem_address = <...>,
  34. .record_size = <...>,
  35. .dump_oops = <...>,
  36. };
  37. static struct platform_device ramoops_dev = {
  38. .name = "ramoops",
  39. .dev = {
  40. .platform_data = &ramoops_data,
  41. },
  42. };
  43. [... inside a function ...]
  44. int ret;
  45. ret = platform_device_register(&ramoops_dev);
  46. if (ret) {
  47. printk(KERN_ERR "unable to register platform device\n");
  48. return ret;
  49. }
  50. 3. Dump format
  51. The data dump begins with a header, currently defined as "====" followed by a
  52. timestamp and a new line. The dump then continues with the actual data.
  53. 4. Reading the data
  54. The dump data can be read from memory (through /dev/mem or other means).
  55. Getting the module parameters, which are needed in order to parse the data, can
  56. be done through /sys/module/ramoops/parameters/* .