From 014b68068d4136812f2e3dc16c986351e6fb2779 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 7 Jan 2011 13:27:34 +0100 Subject: [PATCH] =?UTF-8?q?=09*=20util/grub-setup.c=20(setup):=20Handle=20?= =?UTF-8?q?NetBSD=20and=20OpenBSD=20disklabels.=20=09Reported=20and=20test?= =?UTF-8?q?ed=20by:=20Gr=C3=A9goire=20Sutre.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 5 +++++ util/grub-setup.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index a727bd4ec..d734d86b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-01-07 Vladimir Serbinenko + + * util/grub-setup.c (setup): Handle NetBSD and OpenBSD disklabels. + Reported and tested by: Grégoire Sutre. + 2011-01-06 Colin Watson * tests/util/grub-shell.in: Set serial terminfo type to `dumb', to diff --git a/util/grub-setup.c b/util/grub-setup.c index 5f9b29f25..b4749b433 100644 --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -49,6 +49,7 @@ #include #include "progname.h" #include +#include #define _GNU_SOURCE 1 #include @@ -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;