[RFC PATCH 2/2] efi/libstub: Dump command line before/after conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 .../firmware/efi/libstub/efi-stub-helper.c    | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 294958ff1ee6..fdc8d312b2e0 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -346,6 +346,26 @@ char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len)
 	int options_bytes = 0, safe_options_bytes = 0;  /* UTF-8 bytes */
 	bool in_quote = false;
 	efi_status_t status;
+	size_t i;
+	efi_input_key_t key;
+
+	efi_info("Load options: %08x @ %p\n", options_chars, options);
+
+	efi_info("Hex dump:\n");
+	i = 0;
+	do {
+		const u8 *p = (const u8 *)options;
+		size_t j;
+		efi_info("%p: ", p + i);
+		for (j = i; j < options_chars && j < i + 8; j++)
+			efi_printk("%02x ", p[j]);
+		for (; j < i + 8; j++)
+			efi_printk("%2c ", ' ');
+		for (j = i; j < options_chars && j < i + 8; j++)
+			efi_printk("%c", isprint(p[j]) ? p[j] : '.');
+		efi_printk("\n");
+		i += 8;
+	} while (i < options_chars);
 
 	efi_apply_loadoptions_quirk((const void **)&options, &options_chars);
 	options_chars /= sizeof(*options);
@@ -410,6 +430,26 @@ char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len)
 	snprintf((char *)cmdline_addr, options_bytes, "%.*ls",
 		 options_bytes - 1, options);
 
+	efi_info("Command line: %.*ls\n", options_bytes - 1, options);
+	efi_info("Hex dump:\n");
+	i = 0;
+	do {
+		const u8 *p = (const u8 *)cmdline_addr;
+		size_t j;
+		efi_info("%p: ", p + i);
+		for (j = i; j < options_bytes && j < i + 8; j++)
+			efi_printk("%02x ", p[j]);
+		for (; j < i + 8; j++)
+			efi_printk("%2c ", ' ');
+		for (j = i; j < options_bytes && j < i + 8; j++)
+			efi_printk("%c", isprint(p[j]) ? p[j] : '.');
+		efi_printk("\n");
+		i += 8;
+	} while (i < options_bytes);
+
+	efi_printk("\nPress any key to continue\n");
+	efi_wait_for_key(30 * EFI_USEC_PER_SEC, &key);
+
 	*cmd_line_len = options_bytes;
 	return (char *)cmdline_addr;
 }
-- 
2.26.2




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux