Index: grub-setup.c =================================================================== RCS file: /cvsroot/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.9 diff -u -p -r1.9 grub-setup.c --- grub-setup.c 4 Dec 2004 18:45:46 -0000 1.9 +++ grub-setup.c 23 Dec 2004 14:45:03 -0000 @@ -106,15 +106,17 @@ setup (const char *prefix, const char *d auto int find_first_partition_start (const grub_partition_t p); - int find_first_partition_start (const grub_partition_t p) + auto int find_partition_map (const grub_partition_map_t partmap); + + int find_partition_map (const grub_partition_map_t partmap) { - struct grub_pc_partition *pcdata = p->data; + return (partmap->iterate (dest_dev->disk, find_first_partition_start) == GRUB_ERR_NONE ); + } - if (! grub_pc_partition_is_empty (pcdata->dos_type) - && ! grub_pc_partition_is_bsd (pcdata->dos_type) - && first_start > p->start) - first_start = p->start; - + int find_first_partition_start (const grub_partition_t p) + { + if ( p->len && first_start > p->start ) + first_start = p->start; return 0; } @@ -159,6 +161,7 @@ setup (const char *prefix, const char *d current_segment += GRUB_DISK_SECTOR_SIZE >> 4; } + grub_pc_partition_map_init (); /* Read the boot image by the OS service. */ boot_path = grub_util_get_path (dir, boot_file); boot_size = grub_util_get_image_size (boot_path); @@ -232,7 +235,7 @@ setup (const char *prefix, const char *d try to embed the core image into after the MBR. */ if (dest_dev->disk->has_partitions && ! dest_dev->disk->partition) { - grub_partition_iterate (dest_dev->disk, find_first_partition_start); + grub_partition_map_iterate ( find_partition_map ); /* If there is enough space... */ if ((unsigned long) core_sectors + 1 <= first_start) @@ -255,16 +258,19 @@ setup (const char *prefix, const char *d /* Embed information about the installed location. */ if (root_dev->disk->partition) { - struct grub_pc_partition *pcdata = - root_dev->disk->partition->data; - if (strcmp (root_dev->disk->partition->partmap->name, "pc")) - grub_util_error ("No PC style partitions found"); + if (!strcmp (root_dev->disk->partition->partmap->name, "pc_partition_map")) + { - *install_dos_part - = grub_cpu_to_le32 (pcdata->dos_part); - *install_bsd_part - = grub_cpu_to_le32 (pcdata->bsd_part); + struct grub_pc_partition *pcdata = + root_dev->disk->partition->data; + *install_dos_part + = grub_cpu_to_le32 (pcdata->dos_part); + *install_bsd_part + = grub_cpu_to_le32 (pcdata->bsd_part); + } + else + grub_util_error ("Partition map unknown"); /* known by grub but not by grub-config */ } else *install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1); @@ -449,6 +455,7 @@ setup (const char *prefix, const char *d free (boot_img); grub_device_close (dest_dev); grub_device_close (root_dev); + grub_pc_partition_map_fini (); } static struct option options[] =