nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0229-Add-some-grub_dprintf-in-the-linuxefi-path.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Peter Jones <pjones@redhat.com>
f725e3
Date: Mon, 9 May 2016 14:15:17 -0400
f725e3
Subject: [PATCH] Add some grub_dprintf() in the linuxefi path.
f725e3
f725e3
Signed-off-by: Peter Jones <pjones@redhat.com>
f725e3
---
f725e3
 grub-core/loader/efi/linux.c      | 16 +++++++++++++---
f725e3
 grub-core/loader/i386/efi/linux.c | 10 +++++++++-
f725e3
 2 files changed, 22 insertions(+), 4 deletions(-)
f725e3
f725e3
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
f725e3
index 8890bdf059a..dbf63e20ed8 100644
f725e3
--- a/grub-core/loader/efi/linux.c
f725e3
+++ b/grub-core/loader/efi/linux.c
f725e3
@@ -43,12 +43,22 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
f725e3
   shim_lock = grub_efi_locate_protocol(&guid, NULL);
f725e3
   grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock);
f725e3
   if (!shim_lock)
f725e3
-    return 0;
f725e3
+    {
f725e3
+      grub_dprintf ("secureboot", "shim not available\n");
f725e3
+      return 0;
f725e3
+    }
f725e3
 
f725e3
-  status = shim_lock->verify(data, size);
f725e3
+  grub_dprintf ("secureboot", "Asking shim to verify kernel signature\n");
f725e3
+  status = shim_lock->verify (data, size);
f725e3
   grub_dprintf ("secureboot", "shim_lock->verify(): %ld\n", status);
f725e3
   if (status == GRUB_EFI_SUCCESS)
f725e3
-    return 1;
f725e3
+    {
f725e3
+      grub_dprintf ("secureboot", "Kernel signature verification passed\n");
f725e3
+      return 1;
f725e3
+    }
f725e3
+
f725e3
+  grub_dprintf ("secureboot", "Kernel signature verification failed (0x%lx)\n",
f725e3
+		(unsigned long) status);
f725e3
 
f725e3
   return -1;
f725e3
 }
f725e3
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
f725e3
index 010bf982d80..a95e29700c5 100644
f725e3
--- a/grub-core/loader/i386/efi/linux.c
f725e3
+++ b/grub-core/loader/i386/efi/linux.c
f725e3
@@ -114,6 +114,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
f725e3
       goto fail;
f725e3
     }
f725e3
 
f725e3
+  grub_dprintf ("linuxefi", "initrd_mem = %lx\n", (unsigned long) initrd_mem);
f725e3
+
f725e3
   params->ramdisk_size = size;
f725e3
   params->ramdisk_image = (grub_uint32_t)(grub_uint64_t) initrd_mem;
f725e3
 
f725e3
@@ -202,6 +204,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
f725e3
       goto fail;
f725e3
     }
f725e3
 
f725e3
+  grub_dprintf ("linuxefi", "params = %lx\n", (unsigned long) params);
f725e3
+
f725e3
   grub_memset (params, 0, 16384);
f725e3
 
f725e3
   grub_memcpy (&lh, kernel, sizeof (lh));
f725e3
@@ -239,6 +243,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
f725e3
       goto fail;
f725e3
     }
f725e3
 
f725e3
+  grub_dprintf ("linuxefi", "linux_cmdline = %lx\n",
f725e3
+		(unsigned long)linux_cmdline);
f725e3
+
f725e3
   grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
f725e3
   grub_create_loader_cmdline (argc, argv,
f725e3
                               linux_cmdline + sizeof (LINUX_IMAGE) - 1,
f725e3
@@ -272,9 +279,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
f725e3
   grub_memcpy (params, &lh, 2 * 512);
f725e3
 
f725e3
   params->type_of_loader = 0x21;
f725e3
+  grub_dprintf("linuxefi", "kernel_mem: %p handover_offset: %08x\n",
f725e3
+	       kernel_mem, handover_offset);
f725e3
 
f725e3
  fail:
f725e3
-
f725e3
   if (file)
f725e3
     grub_file_close (file);
f725e3