]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Always fill bootdisk info and improve check for NetBSD disklabel.
authorsutre@tahoe <>
Fri, 16 Aug 2013 17:41:33 +0000 (19:41 +0200)
committersutre@tahoe <>
Fri, 16 Aug 2013 17:41:33 +0000 (19:41 +0200)
ChangeLog
grub-core/loader/i386/bsd.c

index e73577cdba08fdd5bd05e525e6cf766105764f86..c64faa28f31aae835e61b2019ec9f42ec3236640 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-16  GrĂ©goire Sutre  <gregoire.sutre@gmail.com>
+
+       * grub-core/loader/i386/bsd.c (grub_netbsd_add_boot_disk_and_wedge):
+       Always fill bootdisk info and improve check for NetBSD disklabel.
+
 2013-08-16  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * conf/Makefile.extra-dist: Add util/bin2h.c.
index 014b51c85b45e7a7767583bce25adba8f0f0ae35..90877a365a2771a10f04ee2d3f75517c7887c2f6 100644 (file)
@@ -1088,22 +1088,30 @@ grub_netbsd_add_boot_disk_and_wedge (void)
     grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
   }
 
-  /* Fill bootdisk if this a NetBSD disk label.  */
-  if (part->partmap != NULL &&
-      (grub_strcmp (part->partmap->name, "netbsd") == 0) &&
-      buf.label.magic == grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
-    {
-      struct grub_netbsd_btinfo_bootdisk bid;
-
-      grub_memset (&bid, 0, sizeof (bid));
-      bid.labelsector = partmapsector;
-      bid.label.type = buf.label.type;
-      bid.label.checksum = buf.label.checksum;
-      memcpy (bid.label.packname, buf.label.packname, 16);
-      bid.biosdev = biosdev;
-      bid.partition = part->number;
-      grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
-    }
+  /* Fill bootdisk.  */
+  {
+    struct grub_netbsd_btinfo_bootdisk bid;
+
+    grub_memset (&bid, 0, sizeof (bid));
+    /* Check for a NetBSD disk label.  */
+    if (part->partmap != NULL &&
+       (grub_strcmp (part->partmap->name, "netbsd") == 0 ||
+        (part->parent == NULL && grub_strcmp (part->partmap->name, "bsd") == 0)))
+      {
+       bid.labelsector = partmapsector;
+       bid.label.type = buf.label.type;
+       bid.label.checksum = buf.label.checksum;
+       memcpy (bid.label.packname, buf.label.packname, 16);
+      }
+    else
+      {
+       bid.labelsector = -1;
+      }
+    bid.biosdev = biosdev;
+    bid.partition = part->number;
+
+    grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
+  }
 
 fail:
   if (dev)