Skip to content
Snippets Groups Projects
PR393-2.patch 1.8 KiB
Newer Older
From 2a76130632fba8e5f96e9d26551b6d985abf5a16 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <julian.klode@canonical.com>
Date: Fri, 30 Jul 2021 12:48:36 +0200
Subject: [PATCH] shim: Dump load options in verbose mode

Dump the load options before parsing them so that we can
see which things are failing to parse.
---
 include/hexdump.h | 8 ++++++++
 load-options.c    | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/include/hexdump.h b/include/hexdump.h
index 381e1a685..d1554ebd0 100644
--- a/include/hexdump.h
+++ b/include/hexdump.h
@@ -137,6 +137,7 @@ hexdumpat(const char *file, int line, const char *func, const void *data, unsign
 	hexdumpf(file, line, func, L"", data, size, at);
 }
 
+#ifndef SHIM_UNIT_TEST
 #define LogHexdump(data, sz) LogHexdump_(__FILE__, __LINE__, __func__, data, sz)
 #define dhexdump(data, sz)   hexdump(__FILE__, __LINE__, __func__, data, sz)
 #define dhexdumpat(data, sz, at) \
@@ -144,5 +145,12 @@ hexdumpat(const char *file, int line, const char *func, const void *data, unsign
 #define dhexdumpf(fmt, data, sz, at, ...) \
 	hexdumpf(__FILE__, __LINE__ - 1, __func__, fmt, data, sz, at, ##__VA_ARGS__)
 
+#else
+#define LogHexdump(data, sz)
+#define dhexdump(data, sz)
+#define dhexdumpat(data, sz, at)
+#define dhexdumpf(fmt, data, sz, at, ...)
+#endif
+
 #endif /* STATIC_HEXDUMP_H */
 // vim:fenc=utf-8:tw=75:noet
diff --git a/load-options.c b/load-options.c
index e34aa3811..c6bb74276 100644
--- a/load-options.c
+++ b/load-options.c
@@ -310,6 +310,9 @@ parse_load_options(EFI_LOADED_IMAGE *li)
 	UINT32 remaining_size;
 	CHAR16 *loader_str = NULL;
 
+	dprint(L"full load options:\n");
+	dhexdumpat(li->LoadOptions, li->LoadOptionsSize, 0);
+
 	/*
 	 * Sanity check since we make several assumptions about the length
 	 * Some firmware feeds the following load option when booting from