* include/grub/disk.h (grub_disk): Remove has_partitions.

All users updated.
	* disk/loopback.c (grub_loopback): Remove has_partitions.
	All users updated.
	(options): Remove partitions. All users updated.
	* util/grub-fstest.c (fstest): Don't pass "-p" to loopback.
	* util/i386/pc/grub-setup.c (setup): copy partition table only when
	actual partition table is found.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-13 23:59:22 +02:00
parent 3352800b99
commit 94564f81a8
21 changed files with 49 additions and 71 deletions

View file

@ -259,13 +259,11 @@ fstest (char **images, int num_disks, int cmd, int n, char **args)
{
char *host_file;
char *loop_name;
char *argv[3];
int i;
argv[0] = "-p";
for (i = 0; i < num_disks; i++)
{
char *argv[2];
loop_name = grub_xasprintf ("loop%d", i);
if (!loop_name)
grub_util_error (grub_errmsg);
@ -274,10 +272,10 @@ fstest (char **images, int num_disks, int cmd, int n, char **args)
if (!host_file)
grub_util_error (grub_errmsg);
argv[1] = loop_name;
argv[2] = host_file;
argv[0] = loop_name;
argv[1] = host_file;
if (execute_command ("loopback", 3, argv))
if (execute_command ("loopback", 2, argv))
grub_util_error ("loopback command fails");
grub_free (loop_name);
@ -312,15 +310,16 @@ fstest (char **images, int num_disks, int cmd, int n, char **args)
execute_command ("blocklist", n, args);
grub_printf ("\n");
}
argv[0] = "-d";
for (i = 0; i < num_disks; i++)
{
char *argv[2];
loop_name = grub_xasprintf ("loop%d", i);
if (!loop_name)
grub_util_error (grub_errmsg);
argv[0] = "-d";
argv[1] = loop_name;
execute_command ("loopback", 2, argv);

View file

@ -252,14 +252,6 @@ setup (const char *dir,
tmp_img + GRUB_BOOT_MACHINE_BPB_START,
GRUB_BOOT_MACHINE_BPB_END - GRUB_BOOT_MACHINE_BPB_START);
/* Copy the possible partition table. */
if (dest_dev->disk->has_partitions)
memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC);
free (tmp_img);
/* If DEST_DRIVE is a hard disk, enable the workaround, which is
for buggy BIOSes which don't pass boot drive correctly. Instead,
they pass 0x00 or 0x01 even when booted from 0x80. */
@ -300,12 +292,6 @@ setup (const char *dir,
grub_util_info ("dos partition is %d, bsd partition is %d",
dos_part, bsd_part);
if (! dest_dev->disk->has_partitions)
{
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed;
}
if (dest_dev->disk->partition)
{
grub_util_warn (_("Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea."));
@ -345,6 +331,14 @@ setup (const char *dir,
goto unable_to_embed;
}
/* Copy the partition table. */
if (dest_partmap)
memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC);
free (tmp_img);
if (strcmp (dest_partmap, "msdos") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);
else if (strcmp (dest_partmap, "gpt") == 0)