nalika / rpms / grub2

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