---
 grub-core/kern/main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 9cad0c4..8352b6e 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -130,6 +130,8 @@ grub_set_prefix_and_root (void)
   if (fwdevice)
     {
       char *cmdpath;
+      char *bootdrive = NULL;
+      char *cptr;
 
       cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : "");
       if (cmdpath)
@@ -138,6 +140,19 @@ grub_set_prefix_and_root (void)
          grub_env_export ("cmdpath");
          grub_free (cmdpath);
        }
+
+      cptr = grub_strrchr (fwdevice, ',');
+      if (cptr)
+        {
+          bootdrive = grub_strndup (fwdevice, cptr - fwdevice);
+          cptr++;
+        }
+      if (bootdrive)
+        {
+          grub_env_set ("bootdrive", bootdrive);
+          grub_env_export ("bootdrive");
+          grub_free (bootdrive);
+        }
     }
 
   if (prefix)
-- 
2.1.4


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to