diff mbox

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

Message ID 1346687565-32320-2-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Sept. 3, 2012, 3:52 p.m. UTC
From: Colin Ian King <colin.king@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@canonical.com>
---
 src/uefi/uefidump/uefidump.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Ivan Hu Sept. 5, 2012, 7:21 a.m. UTC | #1
On 09/03/2012 11:52 PM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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 }
>   };
>
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Keng-Yu Lin Sept. 11, 2012, 5:50 a.m. UTC | #2
On Mon, Sep 3, 2012 at 11:52 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@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@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 },

Is the trailing dash intentional?

>         { NULL, NULL }
>  };
>
> --
> 1.7.10.4
>
>
> --
> fwts-devel mailing list
> fwts-devel@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
Keng-Yu Lin Sept. 11, 2012, 7:54 a.m. UTC | #3
On Mon, Sep 3, 2012 at 11:52 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@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@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
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

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 }
 };