a5bd9f6
From 68cae0b32cf36c7a8ccd0b2344afdb8ad5f9c473 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
a5bd9f6
Subject: [PATCH 360/364] 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
---
a5bd9f6
 grub-core/disk/ieee1275/ofdisk.c | 32 ++++++++++++++++++++++++++++++++
a5bd9f6
 1 file changed, 32 insertions(+)
83401c6
83401c6
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
a5bd9f6
index ec92c4d..f056466 100644
83401c6
--- a/grub-core/disk/ieee1275/ofdisk.c
83401c6
+++ b/grub-core/disk/ieee1275/ofdisk.c
a5bd9f6
@@ -229,6 +229,10 @@ dev_iterate (const struct grub_ieee1275_devalias *alias)
a5bd9f6
 static void
a5bd9f6
 scan (void)
a5bd9f6
 {
83401c6
+  char *bootpath;
83401c6
+  int bootpath_size;
83401c6
+  char *type;
83401c6
+
a5bd9f6
   struct grub_ieee1275_devalias alias;
a5bd9f6
   FOR_IEEE1275_DEVALIASES(alias)
a5bd9f6
     {
a5bd9f6
@@ -239,6 +243,34 @@ scan (void)
a5bd9f6
 
a5bd9f6
   FOR_IEEE1275_DEVCHILDREN("/", alias)
a5bd9f6
     dev_iterate (&alias);
a5bd9f6
+
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
+
a5bd9f6
+  grub_devalias_iterate (dev_iterate_alias);
a5bd9f6
+  grub_children_iterate ("/", dev_iterate);
83401c6
 }
a5bd9f6
 
a5bd9f6
 static int
83401c6
-- 
a5bd9f6
1.8.1.4
83401c6