Merge changes Ibe1feb39,I05be83e4,If1422e4d am: a4f086ab20
am: 3a156e6c2b
Change-Id: I8c75910845dbf6dfbb50ad38eb234dcd68dce70f
This commit is contained in:
commit
ca0c0bb96e
3 changed files with 20 additions and 9 deletions
|
|
@ -348,10 +348,13 @@ out:
|
||||||
|
|
||||||
static int was_verity_restart()
|
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",
|
"/sys/fs/pstore/console-ramoops",
|
||||||
"/proc/last_kmsg",
|
"/proc/last_kmsg",
|
||||||
NULL
|
NULL
|
||||||
|
// clang-format on
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
|
#include <android-base/macros.h>
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
@ -76,8 +77,6 @@ char *locale;
|
||||||
#define POWER_ON_KEY_TIME (2 * MSEC_PER_SEC)
|
#define POWER_ON_KEY_TIME (2 * MSEC_PER_SEC)
|
||||||
#define UNPLUGGED_SHUTDOWN_TIME (10 * 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 LAST_KMSG_MAX_SZ (32 * 1024)
|
||||||
|
|
||||||
#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
|
#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
|
||||||
|
|
@ -217,14 +216,21 @@ static void dump_last_kmsg(void)
|
||||||
LOGW("\n");
|
LOGW("\n");
|
||||||
LOGW("*************** LAST KMSG ***************\n");
|
LOGW("*************** LAST KMSG ***************\n");
|
||||||
LOGW("\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) {
|
if (!buf || !sz) {
|
||||||
buf = (char *)load_file(LAST_KMSG_PATH, &sz);
|
LOGW("last_kmsg not found. Cold reset?\n");
|
||||||
if (!buf || !sz) {
|
goto out;
|
||||||
LOGW("last_kmsg not found. Cold reset?\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
len = min(sz, LAST_KMSG_MAX_SZ);
|
len = min(sz, LAST_KMSG_MAX_SZ);
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,8 @@ on init
|
||||||
mount pstore pstore /sys/fs/pstore
|
mount pstore pstore /sys/fs/pstore
|
||||||
chown system log /sys/fs/pstore/console-ramoops
|
chown system log /sys/fs/pstore/console-ramoops
|
||||||
chmod 0440 /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
|
chown system log /sys/fs/pstore/pmsg-ramoops-0
|
||||||
chmod 0440 /sys/fs/pstore/pmsg-ramoops-0
|
chmod 0440 /sys/fs/pstore/pmsg-ramoops-0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue