nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0219-Use-device-part-of-chainloader-target-if-present.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
27a4da
From: Raymund Will <rw@suse.com>
27a4da
Date: Fri, 10 Apr 2015 01:45:02 -0400
28f7f8
Subject: [PATCH] Use device part of chainloader target, if present.
27a4da
27a4da
Otherwise chainloading is restricted to '$root', which might not even
27a4da
be readable by EFI!
27a4da
27a4da
v1. use grub_file_get_device_name() to get device name
27a4da
27a4da
Signed-off-by: Michael Chang <mchang@suse.com>
27a4da
Signed-off-by: Peter Jones <pjones@redhat.com>
27a4da
---
27a4da
 grub-core/loader/efi/chainloader.c | 7 +++++--
27a4da
 1 file changed, 5 insertions(+), 2 deletions(-)
27a4da
27a4da
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
28f7f8
index adc85636633..14ce6ddd7ad 100644
27a4da
--- a/grub-core/loader/efi/chainloader.c
27a4da
+++ b/grub-core/loader/efi/chainloader.c
27a4da
@@ -223,8 +223,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
27a4da
   if (! file)
27a4da
     goto fail;
27a4da
 
27a4da
-  /* Get the root device's device path.  */
27a4da
-  dev = grub_device_open (0);
27a4da
+  /* Get the device path from filename. */
27a4da
+  char *devname = grub_file_get_device_name (filename);
27a4da
+  dev = grub_device_open (devname);
27a4da
+  if (devname)
27a4da
+    grub_free (devname);
27a4da
   if (! dev)
27a4da
     goto fail;
27a4da