]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub-setup.c (setup): Handle NetBSD and OpenBSD disklabels.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 7 Jan 2011 12:27:34 +0000 (13:27 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 7 Jan 2011 12:27:34 +0000 (13:27 +0100)
Reported and tested by: GrĂ©goire Sutre.

ChangeLog
util/grub-setup.c

index a727bd4ecccac6e5b791e99c61753af35487a2ab..d734d86b6e509fe32fba2a510ac5f79c91ad70a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-07  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/grub-setup.c (setup): Handle NetBSD and OpenBSD disklabels.
+       Reported and tested by: GrĂ©goire Sutre.
+
 2011-01-06  Colin Watson  <cjwatson@ubuntu.com>
 
        * tests/util/grub-shell.in: Set serial terminfo type to `dumb', to
index 5f9b29f25e977a906b556265b15985866d6fc811..b4749b433510f9a419103e6758b56264bc22063e 100644 (file)
@@ -49,6 +49,7 @@
 #include <grub/emu/getroot.h>
 #include "progname.h"
 #include <grub/reed_solomon.h>
+#include <grub/msdos_partition.h>
 
 #define _GNU_SOURCE    1
 #include <argp.h>
@@ -339,6 +340,12 @@ setup (const char *dir,
     {
       if (p->parent != container)
        return 0;
+      /* NetBSD and OpenBSD subpartitions have metadata inside a partition,
+        so they are safe to ignore.
+       */
+      if (grub_strcmp (p->partmap->name, "netbsd") == 0
+         || grub_strcmp (p->partmap->name, "openbsd") == 0)
+       return 0;
       if (dest_partmap == NULL)
        {
          dest_partmap = p->partmap;
@@ -352,6 +359,15 @@ setup (const char *dir,
 
     grub_partition_iterate (dest_dev->disk, identify_partmap);
 
+    if (container && grub_strcmp (container->partmap->name, "msdos") == 0
+       && dest_partmap
+       && (container->msdostype == GRUB_PC_PARTITION_TYPE_NETBSD
+           || container->msdostype == GRUB_PC_PARTITION_TYPE_OPENBSD))
+      {
+       grub_util_warn (_("Attempting to install GRUB to a disk with multiple partition labels or both partition label and filesystem.  This is not supported yet."));
+       goto unable_to_embed;
+      }
+
     fs = grub_fs_probe (dest_dev);
     if (!fs)
       grub_errno = GRUB_ERR_NONE;