]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/efi/init.c (grub_efi_set_prefix): If the prefix
authorColin Watson <cjwatson@ubuntu.com>
Wed, 8 Sep 2010 12:53:47 +0000 (13:53 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Wed, 8 Sep 2010 12:53:47 +0000 (13:53 +0100)
starts with "(,", fill the drive containing the loaded image in
between those two characters, but expect that a full partition
specification including partition map names will follow.

ChangeLog
grub-core/kern/efi/init.c

index 7e2420c641b48a4d475e6599d9a898c0ebf85a5d..0bb728b6b6e7881cf409fcdf75fd4c3e053e73fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-08  Colin Watson  <cjwatson@ubuntu.com>
+
+       * grub-core/kern/efi/init.c (grub_efi_set_prefix): If the prefix
+       starts with "(,", fill the drive containing the loaded image in
+       between those two characters, but expect that a full partition
+       specification including partition map names will follow.
+
 2010-09-08  Robert Millan  <rmh@gnu.org>
 
        * configure.ac: Remove `--enable-grub-fstest' option.
index c124aa292759533a67e0d2626a0177b06957f8e3..1b0a872b4cafa03f16e37e58f5fd2c92cbb78b0a 100644 (file)
@@ -66,10 +66,33 @@ grub_efi_set_prefix (void)
       path = grub_strdup (pptr);
   }
 
-  if (!device || !path)
+  if ((!device || device[0] == ',' || !device[0]) || !path)
     image = grub_efi_get_loaded_image (grub_efi_image_handle);
-  if (image && !device)
-    device = grub_efidisk_get_device_name (image->device_handle);
+  if (image)
+    {
+      if (!device)
+       device = grub_efidisk_get_device_name (image->device_handle);
+      else if (device[0] == ',' || !device[0])
+       {
+         /* We have a partition, but still need to fill in the drive.  */
+         char *image_device, *comma, *new_device;
+
+         image_device = grub_efidisk_get_device_name (image->device_handle);
+         comma = grub_strchr (image_device, ',');
+         if (comma)
+           {
+             char *drive = grub_strndup (image_device, comma - image_device);
+             new_device = grub_xasprintf ("%s%s", drive, device);
+             grub_free (drive);
+           }
+         else
+           new_device = grub_xasprintf ("%s%s", image_device, device);
+
+         grub_free (image_device);
+         grub_free (device);
+         device = new_device;
+       }
+    }
 
   if (image && !path)
     {