From cab56c0ba53bf702a7df10eb39755af0b5525088 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 27 Jun 2017 09:03:37 -0700 Subject: [PATCH 1/3] fs_mgr: check console-ramoops-0 On later kernels /sys/fs/pstore/console-ramoops becomes /sys/fs/pstore/console-ramoops-0 Test: none Bug: 63058217 Change-Id: If1422e4df09b68c44f16608b1d191aeb6378c66b --- fs_mgr/fs_mgr_verity.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs_mgr/fs_mgr_verity.cpp b/fs_mgr/fs_mgr_verity.cpp index 1d832b392..8fa93705e 100644 --- a/fs_mgr/fs_mgr_verity.cpp +++ b/fs_mgr/fs_mgr_verity.cpp @@ -348,10 +348,13 @@ out: static int was_verity_restart() { - static const char *files[] = { + static const char* files[] = { + // clang-format off + "/sys/fs/pstore/console-ramoops-0", "/sys/fs/pstore/console-ramoops", "/proc/last_kmsg", NULL + // clang-format on }; int i; From 26f1dd764c357d024d3857295970f7e51cccaf25 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 27 Jun 2017 09:19:09 -0700 Subject: [PATCH 2/3] healthd: check console-ramoops-0 On later kernels /sys/fs/pstore/console-ramoops becomes /sys/fs/pstore/console-ramoops-0 Test: none Bug: 63058217 Change-Id: I05be83e40dfc1730ed62b74a146123cdb8573ca6 --- healthd/healthd_mode_charger.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp index 91774c6bc..d7d14544d 100644 --- a/healthd/healthd_mode_charger.cpp +++ b/healthd/healthd_mode_charger.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -76,8 +77,6 @@ char *locale; #define POWER_ON_KEY_TIME (2 * MSEC_PER_SEC) #define UNPLUGGED_SHUTDOWN_TIME (10 * MSEC_PER_SEC) -#define LAST_KMSG_PATH "/proc/last_kmsg" -#define LAST_KMSG_PSTORE_PATH "/sys/fs/pstore/console-ramoops" #define LAST_KMSG_MAX_SZ (32 * 1024) #define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0) @@ -217,14 +216,21 @@ static void dump_last_kmsg(void) LOGW("\n"); LOGW("*************** LAST KMSG ***************\n"); LOGW("\n"); - buf = (char *)load_file(LAST_KMSG_PSTORE_PATH, &sz); + const char* kmsg[] = { + // clang-format off + "/sys/fs/pstore/console-ramoops-0", + "/sys/fs/pstore/console-ramoops", + "/proc/last_kmsg", + // clang-format on + }; + for (size_t i = 0; i < arraysize(kmsg); ++i) { + buf = (char*)load_file(kmsg[i], &sz); + if (buf && sz) break; + } if (!buf || !sz) { - buf = (char *)load_file(LAST_KMSG_PATH, &sz); - if (!buf || !sz) { - LOGW("last_kmsg not found. Cold reset?\n"); - goto out; - } + LOGW("last_kmsg not found. Cold reset?\n"); + goto out; } len = min(sz, LAST_KMSG_MAX_SZ); From 4eb0ba058c6fca6a5f8a81308f006b52567fc3c5 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 27 Jun 2017 09:32:32 -0700 Subject: [PATCH 3/3] init.rc: setup console-ramoops-0 On later kernels /sys/fs/pstore/console-ramoops becomes /sys/fs/pstore/console-ramoops-0 Test: none Bug: 63058217 Change-Id: Ibe1feb39ef9081b1ab2316510674bf181bdc7b0c --- rootdir/init.rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index 94f64e0b6..d9fe090e8 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -221,6 +221,8 @@ on init 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/console-ramoops-0 + chmod 0440 /sys/fs/pstore/console-ramoops-0 chown system log /sys/fs/pstore/pmsg-ramoops-0 chmod 0440 /sys/fs/pstore/pmsg-ramoops-0