[PATCH 1/6] uefi: uefidump: Dump out variables containing kernel messages

Colin King colin.king at canonical.com
Mon Sep 3 15:52:40 UTC 2012


From: Colin Ian King <colin.king at canonical.com>

The kernel can stash kernel log messages into UEFI variables,
so add ability to dump these out too.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/uefi/uefidump/uefidump.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index 1f71107..a9a0433 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -490,6 +490,25 @@ static void uefidump_info_bootdev(fwts_framework *fw, fwts_uefi_var *var)
 	free(path);
 }
 
+/*
+ *  Dump kernel oops log messages
+ */
+static void uefidump_info_dump_type0(fwts_framework *fw, fwts_uefi_var *var)
+{
+	char *ptr = (char*)var->data;
+
+	while (*ptr) {
+		char *start = ptr;
+		while (*ptr && *ptr != '\n')
+			ptr++;
+
+		if (*ptr == '\n') {
+			*ptr++ = 0;
+			fwts_log_info_verbatum(fw, "  KLog: %s.", start);
+		}
+	}
+}
+
 static uefidump_info uefidump_info_table[] = {
 	{ "PlatformLangCodes",	uefidump_info_platform_langcodes },
 	{ "PlatformLang",	uefidump_info_platform_lang },
@@ -507,6 +526,7 @@ static uefidump_info uefidump_info_table[] = {
 	{ "Lang",		uefidump_info_lang },
 	{ "Timeout",		uefidump_info_timeout },
 	{ "Boot0",		uefidump_info_bootdev },
+	{ "dump-type0-",	uefidump_info_dump_type0 },
 	{ NULL, NULL }
 };
 
-- 
1.7.10.4




More information about the fwts-devel mailing list