From 9de9eb9149a3756e5c80894ff8d32d8a02b56897 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Mon, 22 Nov 2010 16:10:57 +0900 Subject: [PATCH] ramoops: parse the message remove printk time Signed-off-by: Minkyu Kang --- drivers/misc/ramoops.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/misc/ramoops.c b/drivers/misc/ramoops.c index 186549b..00aa98e 100644 --- a/drivers/misc/ramoops.c +++ b/drivers/misc/ramoops.c @@ -48,18 +48,42 @@ static void ramoops_show(void) #endif } +void ramoops_parser(char *raw) +{ + int i; + int start = 0; + int offset = 0; + + for (i = 0; i < RAMOOPS_SIZE; i++) { + if (raw[i] == '[' && raw[i + 13] ==']') { + int size = i - 3 - start; + + memcpy(msg + offset, raw + start, size); + + offset += size; + start = i + 15; + i += 15; + } + } + + memcpy(msg + offset, raw + start, RAMOOPS_SIZE - start); +} + int ramoops_init(unsigned int base) { unsigned int *msg_header = (unsigned int *)base; + char raw[RAMOOPS_SIZE]; dumped = 0; if (*msg_header != RAMOOPS_HEADER) return -1; - memcpy(msg, (void *)base, RAMOOPS_SIZE); + memcpy(raw, (void *)base, RAMOOPS_SIZE); memset((void *)base, 0x0, RAMOOPS_SIZE); + ramoops_parser(raw); + dumped = 1; ramoops_show(); -- 2.7.4