Platform: RK3399
OS: Android 7.1
Kernel: v4.4.83
rk3288平台,rk自己实现了一套机制获取上一次的kernel log.
rk3399平台,使用了内核框架中的ramoops机制。
查看方法:
#cat /sys/fs/pstore/console-ramoops-0
要开启此功能,需要做以下几点配置(rk3399默认都开启了)
打开功能:
rockchip_defconfig:
CONFIG_PSTORE=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
CONFIG_PSTORE_RAM=y
驱动对应路径:
kernel/fs/pstore
配置内存地址以及各个功能size
rk3399-android.dtsi:
ramoops_mem: ramoops_mem {
reg = <0x0 0x110000 0x0 0xf0000>;
reg-names = "ramoops_mem";
};
ramoops {
compatible = "ramoops";
record-size = <0x0 0x20000>;
console-size = <0x0 0x80000>;
ftrace-size = <0x0 0x00000>;
pmsg-size = <0x0 0x50000>;
memory-region = <&ramoops_mem>;
};
各个property意义:
- compatible: must be "ramoops"
- memory-region: phandle to a region of memory that is preserved between reboots
Optional properties:
- ecc-size: enables ECC support and specifies ECC buffer size in bytes (defaults to no ECC)
- record-size: maximum size in bytes of each dump done on oops/panic (defaults to 0)
- console-size: size in bytes of log buffer reserved for kernel messages (defaults to 0)
- ftrace-size: size in bytes of log buffer reserved for function tracing and profiling (defaults to 0)
- pmsg-size: size in bytes of log buffer reserved for userspace messages (defaults to 0)
- unbuffered: if present, use unbuffered mappings to map the reserved region (defaults to buffered mappings)
- no-dump-oops: if present, only dump panics (defaults to panics and oops)
开机后做mount:
system/core/rootdir/init.rc:
# pstore/ramoops previous console log
mount pstore pstore /sys/fs/pstore
chown system log /sys/fs/pstore/console-ramoops
chmod 0440 /sys/fs/pstore/console-ramoops
chown system log /sys/fs/pstore/pmsg-ramoops-0
chmod 0440 /sys/fs/pstore/pmsg-ramoops-0