* [Patch] Do not embed with multiple partmaps
@ 2010-06-17 23:07 Grégoire Sutre
2010-07-01 20:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: Grégoire Sutre @ 2010-06-17 23:07 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
Hi,
As a (temporary) solution to the problem of embedding with multiple
top-level partmaps, the attached patch simply disables embedding when
there are multiple partmaps (i.e. apply the same behavior as when there
is no partmap).
This prevents grub-setup from overwriting e.g. a BSD label if it finds
an msdos label first.
The only drawback I see is that grub-setup may complain about an old
obsolete disklabel, but in that case the user simply has to destroy the
obsolete label, and IMHO this is more acceptable than potentially
destroying valuable data.
Grégoire
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: detect-multiple-partmaps.diff --]
[-- Type: text/x-patch; name="detect-multiple-partmaps.diff", Size: 1732 bytes --]
=== modified file 'ChangeLog'
--- ChangeLog 2010-06-17 20:54:04 +0000
+++ ChangeLog 2010-06-17 22:06:58 +0000
@@ -1,3 +1,8 @@
+2010-06-17 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-06-17 Colin Watson <cjwatson@ubuntu.com>
* util/i386/pc/grub-setup.c (usage): Pass an extra `program_name'
=== modified file 'util/i386/pc/grub-setup.c'
--- util/i386/pc/grub-setup.c 2010-06-17 20:54:04 +0000
+++ util/i386/pc/grub-setup.c 2010-06-17 22:04:48 +0000
@@ -93,6 +93,7 @@
grub_uint16_t core_sectors;
grub_device_t root_dev, dest_dev;
const char *dest_partmap;
+ int multiple_partmaps;
grub_uint8_t *boot_drive;
grub_disk_addr_t *kernel_sector;
grub_uint16_t *boot_drive_check;
@@ -354,10 +355,17 @@
{
if (p->parent)
return 0;
- dest_partmap = p->partmap->name;
- return 1;
+ if (dest_partmap == NULL)
+ dest_partmap = p->partmap->name;
+ else if (strcmp (dest_partmap, p->partmap->name) != 0)
+ {
+ multiple_partmaps = 1;
+ return 1;
+ }
+ return 0;
}
dest_partmap = 0;
+ multiple_partmaps = 0;
grub_partition_iterate (dest_dev->disk, identify_partmap);
if (! dest_partmap)
@@ -365,6 +373,11 @@
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed;
}
+ if (multiple_partmaps)
+ {
+ grub_util_warn (_("Attempting to install GRUB to a disk with multiple partition labels. This is a BAD idea."));
+ goto unable_to_embed;
+ }
if (strcmp (dest_partmap, "msdos") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] Do not embed with multiple partmaps
2010-06-17 23:07 [Patch] Do not embed with multiple partmaps Grégoire Sutre
@ 2010-07-01 20:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-07-04 12:19 ` Grégoire Sutre
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-07-01 20:52 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
On 06/18/2010 01:07 AM, Grégoire Sutre wrote:
> Hi,
>
> As a (temporary) solution to the problem of embedding with multiple
> top-level partmaps, the attached patch simply disables embedding when
> there are multiple partmaps (i.e. apply the same behavior as when there
> is no partmap).
>
> This prevents grub-setup from overwriting e.g. a BSD label if it finds
> an msdos label first.
>
> The only drawback I see is that grub-setup may complain about an old
> obsolete disklabel, but in that case the user simply has to destroy the
> obsolete label, and IMHO this is more acceptable than potentially
> destroying valuable data.
>
Go ahead. Just replace "BAD IDEA" with "not supported yet"
> Grégoire
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] Do not embed with multiple partmaps
2010-07-01 20:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-07-04 12:19 ` Grégoire Sutre
0 siblings, 0 replies; 3+ messages in thread
From: Grégoire Sutre @ 2010-07-04 12:19 UTC (permalink / raw)
To: The development of GNU GRUB
On 07/01/2010 10:52 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Go ahead. Just replace "BAD IDEA" with "not supported yet"
Thanks, I replaced "BAD IDEA" with "not supported yet" and committed.
Grégoire.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-04 12:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-17 23:07 [Patch] Do not embed with multiple partmaps Grégoire Sutre
2010-07-01 20:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-07-04 12:19 ` Grégoire Sutre
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.