nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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