Use ramoops for logging under Linux (2021)

https://news.ycombinator.com/rss Hits: 4
Summary

Unfortunately, an embedded system is not free of crashes. To analyze and log such crashes it is useful to have a file system where we can store such information between reboots. One interface which is meant to do that is pstore and its current single implementation ramoops. Ramoops can store log messages inside a reserved memory area in RAM. The nice thing about RAM is, that it should almost always be available when the CPU is still running. Flash memory on the other hand could not be available because e.g. the eMMC or NAND flash driver crashed. Further, by using RAM instead of flash memory we can write faster and don’t fill our persistent memory. The disadvantage of storing information in RAM is that the information will not survive a power cycle. For this article an Apalis iMX8QM from Toradex was used with Reference Multimedia Image 5.1.0. Ramoops The ramoops driver allows us to store kernel oopses, the kernel console output and user messages in a reserved memory region inside RAM. In normal hardware designs RAM will not power off when we just do a reboot and therefore the data will survive a restart. By defining a reserved memory region the kernel will not touch this memory area and therefore not overwrite data stored there. We have to find a free memory region in RAM which we can use. For this we read /proc/iommem on the device. root@apalis-imx8:~$ cat /proc/iomem .... 80200000-83ffffff : System RAM 80280000-8161ffff : Kernel code 81620000-8188ffff : reserved 81890000-81a85fff : Kernel data 86400000-87ffffff : System RAM 90000000-901fffff : System RAM 90500000-91ffffff : System RAM 94c00000-94ffffff : System RAM 95400000-ffffffff : System RAM 96000000-d1ffffff : reserved f9603000-fd62afff : reserved 880000000-8ffffffff : System RAM 8fae00000-8fb5fffff : reserved 8fb7fe000-8ff5fffff : reserved 8ff6db000-8ff73afff : reserved 8ff73b000-8ff73bfff : reserved 8ff73c000-8ff7cbfff : reserved 8ff7ce000-8ff7cefff : reserved 8ff7cf000-8ff7d3fff : reserved 8ff7d4000-8ff7d4f...

First seen: 2025-05-24 20:42

Last seen: 2025-05-24 23:42