Support some annoying BSD and Minix subpartitions.
* Makefile.util.def (libgrub.a): Add grub-core/partmap/bsdlabel.c. * grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name): Properly handle concatenation. * grub-core/kern/device.c (grub_device_iterate): Likewise. * grub-core/normal/completion.c (iterate_partition): Likewise. * grub-core/kern/disk.c (grub_disk_open): Make disk->name not contain partition. All users updated. * grub-core/partmap/bsdlabel.c (grub_netbsdlabel_partition_map): New struct. (grub_openbsdlabel_partition_map): Likewise. (bsdlabel_partition_map_iterate): Rename to .. (iterate_real): ... this. New arguments sector, freebsd and pmap. (bsdlabel_partition_map_iterate): New function. (netopenbsdlabel_partition_map_iterate): Likewise. (netbsdlabel_partition_map_iterate): Likewise. (openbsdlabel_partition_map_iterate): Likewise. (GRUB_MOD_INIT): Register new partmaps. (GRUB_MOD_FINI): Unregister new partmaps. * grub-core/partmap/msdos.c (pc_partition_map_iterate): Rename to ... (grub_partition_msdos_iterate): ... this. All users updated. Don't support embedding other than in a minix partition. * include/grub/msdos_partition.h (grub_partition_msdos_iterate): New proto. * include/grub/partition.h (grub_partition): New field msdostype. * util/grub-install.in: Handle openbsd and netbsd types being in part_bsd module.
This commit is contained in:
commit
74342e312f
11 changed files with 225 additions and 57 deletions
|
@ -27,16 +27,25 @@
|
|||
static struct grub_partition_map grub_msdos_partition_map;
|
||||
|
||||
|
||||
static grub_err_t
|
||||
pc_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
const grub_partition_t partition))
|
||||
grub_err_t
|
||||
grub_partition_msdos_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition p;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
int labeln = 0;
|
||||
grub_disk_addr_t lastaddr;
|
||||
grub_disk_addr_t ext_offset;
|
||||
grub_disk_addr_t delta = 0;
|
||||
|
||||
if (disk->partition && disk->partition->partmap == &grub_msdos_partition_map)
|
||||
{
|
||||
if (disk->partition->msdostype == GRUB_PC_PARTITION_TYPE_LINUX_MINIX)
|
||||
delta = disk->partition->start;
|
||||
else
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no embedding supported");
|
||||
}
|
||||
|
||||
p.offset = 0;
|
||||
ext_offset = 0;
|
||||
|
@ -81,8 +90,9 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
{
|
||||
e = mbr.entries + p.index;
|
||||
|
||||
p.start = p.offset + grub_le_to_cpu32 (e->start);
|
||||
p.start = p.offset + grub_le_to_cpu32 (e->start) - delta;
|
||||
p.len = grub_le_to_cpu32 (e->length);
|
||||
p.msdostype = e->type;
|
||||
|
||||
grub_dprintf ("partition",
|
||||
"partition %d: flag 0x%x, type 0x%x, start 0x%llx, len 0x%llx\n",
|
||||
|
@ -251,7 +261,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int nsectors,
|
|||
static struct grub_partition_map grub_msdos_partition_map =
|
||||
{
|
||||
.name = "msdos",
|
||||
.iterate = pc_partition_map_iterate,
|
||||
.iterate = grub_partition_msdos_iterate,
|
||||
#ifdef GRUB_UTIL
|
||||
.embed = pc_partition_map_embed
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue