31004e6
From a2780be06f7de35a0dd4cc19a68b151176707ae7 Mon Sep 17 00:00:00 2001
31004e6
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
31004e6
Date: Fri, 14 Dec 2012 20:10:21 -0200
f74b50e
Subject: [PATCH 458/482] Add bootpath device to the list
31004e6
31004e6
When scanning the devices, always check (and add) the bootpath device if it
31004e6
isn't in the device list.
31004e6
---
31004e6
 grub-core/disk/ieee1275/ofdisk.c | 32 ++++++++++++++++++++++++++++++++
31004e6
 1 file changed, 32 insertions(+)
31004e6
31004e6
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
31004e6
index 2a31ecd..a940771 100644
31004e6
--- a/grub-core/disk/ieee1275/ofdisk.c
31004e6
+++ b/grub-core/disk/ieee1275/ofdisk.c
31004e6
@@ -229,6 +229,10 @@ dev_iterate (const struct grub_ieee1275_devalias *alias)
31004e6
 static void
31004e6
 scan (void)
31004e6
 {
31004e6
+  char *bootpath;
31004e6
+  int bootpath_size;
31004e6
+  char *type;
31004e6
+
31004e6
   struct grub_ieee1275_devalias alias;
31004e6
   FOR_IEEE1275_DEVALIASES(alias)
31004e6
     {
31004e6
@@ -239,6 +243,34 @@ scan (void)
31004e6
 
31004e6
   FOR_IEEE1275_DEVCHILDREN("/", alias)
31004e6
     dev_iterate (&alias);
31004e6
+
31004e6
+  if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
31004e6
+					 &bootpath_size)
31004e6
+      || bootpath_size <= 0)
31004e6
+    {
31004e6
+      /* Should never happen.  */
31004e6
+      grub_printf ("/chosen/bootpath property missing!\n");
31004e6
+      return;
31004e6
+    }
31004e6
+
31004e6
+  bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
31004e6
+  if (! bootpath)
31004e6
+    {
31004e6
+      grub_print_error ();
31004e6
+      return;
31004e6
+    }
31004e6
+  grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
31004e6
+                              (grub_size_t) bootpath_size + 1, 0);
31004e6
+  bootpath[bootpath_size] = '\0';
31004e6
+
31004e6
+  type = grub_ieee1275_get_device_type (bootpath);
31004e6
+  if (type && grub_strcmp (type, "block") == 0)
31004e6
+      dev_iterate_real (bootpath, bootpath);
31004e6
+
31004e6
+  grub_free (bootpath);
31004e6
+
31004e6
+  grub_devalias_iterate (dev_iterate_alias);
31004e6
+  grub_children_iterate ("/", dev_iterate);
31004e6
 }
31004e6
 
31004e6
 static int
31004e6
-- 
31004e6
1.8.2.1
31004e6