83401c6
From d2863ca186a6d4ba2a56559bf522f46c18403645 Mon Sep 17 00:00:00 2001
83401c6
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
83401c6
Date: Fri, 14 Dec 2012 20:10:21 -0200
83401c6
Subject: [PATCH] Add bootpath device to the list
83401c6
83401c6
When scanning the devices, always check (and add) the bootpath device if it
83401c6
isn't in the device list.
83401c6
---
83401c6
 grub-core/disk/ieee1275/ofdisk.c | 29 +++++++++++++++++++++++++++++
83401c6
 1 file changed, 29 insertions(+)
83401c6
83401c6
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
83401c6
index b0aa7ec..99b156e 100644
83401c6
--- a/grub-core/disk/ieee1275/ofdisk.c
83401c6
+++ b/grub-core/disk/ieee1275/ofdisk.c
83401c6
@@ -213,6 +213,35 @@ scan (void)
83401c6
     return grub_children_iterate (alias->path, dev_iterate);
83401c6
   }
83401c6
 
83401c6
+  char *bootpath;
83401c6
+  int bootpath_size;
83401c6
+  char *type;
83401c6
+
83401c6
+  if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
83401c6
+					 &bootpath_size)
83401c6
+      || bootpath_size <= 0)
83401c6
+    {
83401c6
+      /* Should never happen.  */
83401c6
+      grub_printf ("/chosen/bootpath property missing!\n");
83401c6
+      return;
83401c6
+    }
83401c6
+
83401c6
+  bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
83401c6
+  if (! bootpath)
83401c6
+    {
83401c6
+      grub_print_error ();
83401c6
+      return;
83401c6
+    }
83401c6
+  grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
83401c6
+                              (grub_size_t) bootpath_size + 1, 0);
83401c6
+  bootpath[bootpath_size] = '\0';
83401c6
+
83401c6
+  type = grub_ieee1275_get_device_type (bootpath);
83401c6
+  if (type && grub_strcmp (type, "block") == 0)
83401c6
+      dev_iterate_real (bootpath, bootpath);
83401c6
+
83401c6
+  grub_free (bootpath);
83401c6
+
83401c6
   grub_devalias_iterate (dev_iterate_alias);
83401c6
   grub_children_iterate ("/", dev_iterate);
83401c6
 }
83401c6
-- 
83401c6
1.8.0
83401c6