Do not embed when there are multiple (top-level) partmaps.

This commit is contained in:
Grégoire Sutre 2010-07-04 11:13:31 +02:00
parent df3eb88f04
commit 6b654bb0a5
2 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2010-07-04 Grégoire Sutre <gregoire.sutre@gmail.com>
* util/i386/pc/grub-setup.c (setup): Do not embed when there are
multiple (top-level) partmaps.
2010-07-02 Vladimir Serbinenko <phcoder@gmail.com> 2010-07-02 Vladimir Serbinenko <phcoder@gmail.com>
Bidi and diacritics support. Bidi and diacritics support.

View file

@ -95,6 +95,7 @@ setup (const char *dir,
grub_uint16_t core_sectors; grub_uint16_t core_sectors;
grub_device_t root_dev, dest_dev; grub_device_t root_dev, dest_dev;
const char *dest_partmap; const char *dest_partmap;
int multiple_partmaps;
grub_uint8_t *boot_drive; grub_uint8_t *boot_drive;
grub_disk_addr_t *kernel_sector; grub_disk_addr_t *kernel_sector;
grub_uint16_t *boot_drive_check; grub_uint16_t *boot_drive_check;
@ -356,10 +357,17 @@ setup (const char *dir,
{ {
if (p->parent) if (p->parent)
return 0; return 0;
if (dest_partmap == NULL)
dest_partmap = p->partmap->name; dest_partmap = p->partmap->name;
else if (strcmp (dest_partmap, p->partmap->name) != 0)
{
multiple_partmaps = 1;
return 1; return 1;
} }
return 0;
}
dest_partmap = 0; dest_partmap = 0;
multiple_partmaps = 0;
grub_partition_iterate (dest_dev->disk, identify_partmap); grub_partition_iterate (dest_dev->disk, identify_partmap);
if (! dest_partmap) if (! dest_partmap)
@ -367,6 +375,11 @@ setup (const char *dir,
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea.")); grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed; goto unable_to_embed;
} }
if (multiple_partmaps)
{
grub_util_warn (_("Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet."));
goto unable_to_embed;
}
if (strcmp (dest_partmap, "msdos") == 0) if (strcmp (dest_partmap, "msdos") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos); grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);