howto support ramoops (former crashlog.o)

Daniel Golle daniel at makrotopia.org
Tue Aug 23 10:53:53 PDT 2022


Hi Bastian,

On Tue, Aug 23, 2022 at 04:47:28PM +0000, Bastian Bittorf wrote:
> I'am trying to add ramoops support for a specific mediatek model.
> There are alreay a few commit regarding this, but i'am not apply
> to harvest a crashlog after a crash-reboot.

pstore/ramoops can only work on platforms which do NOT clear DRAM
content on (re-)boot. Many of the $vendor loaders unfortunately do that.
Archer C6U being an MT7621-based unit will probably need a replacement
bootloader in order to change that behavior. As it is a rather
straight-forward board with SPI-NOR, creating a replacement loader is
not hard (see uboot-mediatek package).

However, I haven't yet tried pstore on MT7621 and the proprietary DRAM
calibration blob may always clear DRAM content on boot without any way
to prevent that.
So maybe we simply don't have the option to use pstore/ramoops on that
platform across reboots (I can try this in about a week from now when I'm
back home and tell you more).

Another (more wastefull) option is to use kexec to restart Linux in case
of a crash instead of resetting the CPU -- more wasteful because you
will have to load the to-be-kexec'ed kernel into the RAM and hence you
have a few megabytes less available at runtime. But you can be sure that
DRAM content will be preserved.


Cheers


Daniel


> 
> # openwrt$ git grep "ramoops@"
> package/boot/uboot-mediatek/patches/050-mt7622-enable-pstore.patch:+ ramoops at 42ff0000 {
> target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi: ramoops at 42100000 {
> target/linux/mediatek/patches-5.15/105-dts-mt7622-enable-pstore.patch:+ ramoops at 42ff0000 {
> 
> This looks good, e.g. 0x42ff0000 = the upper 48 Megabyte minus 64k
> My Router Archer C6U v1 has 128mb RAM, so i go for:
> 
> 128 * 1024 * 1024 = 134217728 = 0x8000000,  
> substracting 0x10000 = 0x7ff0000 - so my dts-patch looks like:
> 
> 
> +reserved-memory {
> +	#address-cells = <2>;
> +	#size-cells = <2>;
> +	ranges;
> +
> +	/* 64 KiB reserved for ramoops/pstore */
> +	ramoops at 7ff0000 {
> +		compatible = "ramoops";
> +		reg = <0 0x7ff0000 0 0x10000>;
> +		record-size = <0x1000>;
> +	};                   
> +};
> 
> 
> It builds and the running image has 'pstore' automatically mounted,
> and the kernelmodule loads, and is visible in device-tree:
> 
> root at box:~ hexdump -C /proc/device-tree/reserved-memory/ramoops at 7ff0000/reg
> 00000000  00 00 00 00 07 ff 00 00  00 00 00 00 00 01 00 00  |................|
> 00000010
> root at box:~ hexdump -C /proc/device-tree/reserved-memory/ramoops at 7ff0000/record-size
> 00000000  00 00 10 00                                       |....|
> 00000004
> root at box:~ mount | grep pstore
> pstore on /sys/fs/pstore type pstore (rw,noatime)
> root at box:~ lsmod | grep pstore
> pstore                  9910  1 
> 
> but when crashing the kernel with: echo 'c' >/proc/sysrq-trigger
> the store is always empty:
> 
> root at box:~ ls -l /sys/fs/pstore/
> 
> Has anyone succeeded and has maybe a hint for me?
> 
> bye, bastian
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list