环境
CPU:RK3399
kernl:Linux 4.4
OS::ubuntu 18.04
配置
方式一:直接修改ipud-next/kernel/arch/arm64/configs/rk3399_linux_defconfig文件
CONFIG_PSTORE=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_RAM=y
配置dts增加相关节点:ramoops_mem
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
drm_logo: drm-logo[url=home.php?mod=space&uid=158026]@00000000[/url] {
compatible = "rockchip,drm-logo";
reg = <0x0 0x0 0x0 0x0>;
};
ramoops_mem: region[url=home.php?mod=space&uid=486996]@110000[/url] {
reg = <0x0 0x110000 0x0 0xf0000>;
reg-names = "ramoops_mem";
};
};
ramoops: ramoops {
compatible = "ramoops";
record-size = <0x0 0x40000>;
console-size = <0x0 0x80000>;
ftrace-size = <0x0 0x00000>;
pmsg-size = <0x0 0x00000>;
memory-region = <&ramoops_mem>;
};
方式二:make menuconfig 配置
$ make menuconfig
|-> File systems
|-> Miscellaneous filesystems
|-> Persistent store support
|-> Log kernel console messages # console 前端
|-> Log user space messages # pmsg 前端
|-> Persistent function tracer # ftrace 前端
|-> Log panic/oops to a RAM buffer # pstore/ram 后端
|-> Log panic/oops to a block device # pstore/blk 后端
验证
step1:echo 1 > /proc/sys/kernel/sysrq
step2:echo c > /proc/sysrq-trigger
此时会产生kernel panic。
查看日志文件
挂载:
mount -t pstore pstore /sys/fs/pstore
这一步,可以在开机时执行。
注意:出现死机后不能不能掉电,开关机也不行,可以直接通关reset按键复位。
日志文件位于/sys/fs/pstore下。
原作者:MIPSA
|