diff --git a/crashlog/panic.c b/crashlog/panic.c index 08ea97e..62e9421 100644 --- a/crashlog/panic.c +++ b/crashlog/panic.c @@ -392,7 +392,9 @@ int crashlog_check_ram_panic(char *reason, const char *extrastring) { const char *panic_kw[] = {"Kernel panic - not syncing:", "BUG: unable to handle kernel"}; char crash_ramconsole_name[PATHMAX] = {'\0'}; + char crash_ramdmesg_name[PATHMAX] = {'\0'}; char ram_console[PATHMAX] = {'\0'}; + char ram_dmesg[PATHMAX] = {'\0'}; char crashtype[32] = {'\0'}; char *dir; int ret; @@ -410,6 +412,11 @@ int crashlog_check_ram_panic(char *reason, const char *extrastring) { // no file found, should return return 1; } + + if (file_exists(DMESG_RAMOOPS_NUM(0))) { + strcpy(ram_dmesg, DMESG_RAMOOPS_NUM(0)); + } + ret = crashlog_check_ram_panic_found(ram_console, panic_kw, DIM(panic_kw), extrastring); if (ret < 0) { return -1; @@ -422,12 +429,13 @@ int crashlog_check_ram_panic(char *reason, const char *extrastring) { dir = generate_crashlog_dir(MODE_CRASH, key); copy_to_crash = (dir != NULL); - if (copy_to_crash) { snprintf(crash_ramconsole_name, sizeof(crash_ramconsole_name), "%s/%s_%s.txt", dir, CONSOLE_RAMOOPS_FILE, dateshort); - // to be homogeneous with do_last_kmsg_copy, we use do_copy_tail - do_copy_tail(ram_console, crash_ramconsole_name, MAXFILESIZE); + do_copy_eof(ram_console, crash_ramconsole_name); + snprintf(crash_ramdmesg_name, sizeof(crash_ramdmesg_name), + "%s/%s_%s.txt", dir, DMESG_RAMOOPS_FILE, dateshort); + do_copy_eof(ram_dmesg, crash_ramdmesg_name); } else { LOGE("%s: Cannot get a valid new crash directory...\n", __FUNCTION__); // use temp file diff --git a/crashlog/privconfig.h b/crashlog/privconfig.h index da37747..0ce6ce5 100755 --- a/crashlog/privconfig.h +++ b/crashlog/privconfig.h @@ -414,7 +414,9 @@ extern enum crashlog_mode g_crashlog_mode; #define CONSOLE_NAME "console" #define LAST_KMSG_FILE "last_kmsg" #define CONSOLE_RAMOOPS_FILE "console-ramoops" +#define DMESG_RAMOOPS_FILE "dmesg-ramoops" #define CONSOLE_RAMOOPS_FILE_NUM(x) "console-ramoops-"#x"" +#define DMESG_RAMOOPS_FILE_NUM(x) "dmesg-ramoops-"#x"" #define FTRACE_RAMOOPS_FILE "ftrace-ramoops" #define EMMC_HEADER_NAME "emmc_ipanic_header" #define EMMC_CONSOLE_NAME "emmc_ipanic_console" @@ -433,6 +435,7 @@ extern enum crashlog_mode g_crashlog_mode; #define LAST_KMSG PROC_DIR "/" LAST_KMSG_FILE #define CONSOLE_RAMOOPS PSTORE_DIR "/" CONSOLE_RAMOOPS_FILE #define CONSOLE_RAMOOPS_NUM(x) PSTORE_DIR "/" CONSOLE_RAMOOPS_FILE_NUM(x) +#define DMESG_RAMOOPS_NUM(x) PSTORE_DIR "/" DMESG_RAMOOPS_FILE_NUM(x) #define FTRACE_RAMOOPS PSTORE_DIR "/" FTRACE_RAMOOPS_FILE #define PANIC_HEADER_NAME PROC_DIR "/" EMMC_HEADER_NAME #define PANIC_CONSOLE_NAME PROC_DIR "/" EMMC_CONSOLE_NAME