After EFI support was added to the installer, it needed to allow boot

partitions of types other than "freebsd-boot" (in particular, "efi").
This allows the removal of some nasty hacks for supporting PowerPC systems,
in particular aliasing freebsd-boot to apple-boot on APM and an IBM-specific
code on MBR.

This changes the installer to use the correct names, which also breaks a
degeneracy in the meaning of "freebsd-boot" that allows the addition
of support for some newer IBM systems that can boot from GPT in addition to
MBR. Since I have no idea how to detect which those systems are, leave
the default on IBM PPC systems as MBR for now.
This commit is contained in:
Nathan Whitehorn
2014-07-04 15:55:32 +00:00
parent 962ce8cf82
commit 1ee0f08975
8 changed files with 49 additions and 9 deletions
+19 -1
View File
@@ -553,6 +553,16 @@ for partition types that do not have symbolic names.
Symbolic names currently understood and used by
.Fx are:
.Bl -tag -width ".Cm dragonfly-disklabel64"
.It Cm apple-boot
The system partition dedicated to storing boot loaders on some Apple
systems.
The scheme-specific types are
.Qq Li "!171"
for MBR,
.Qq Li "!Apple_Bootstrap"
for APM, and
.Qq Li "!426f6f74-0000-11aa-aa11-00306543ecac"
for GPT.
.It Cm bios-boot
The system partition dedicated to second stage of the boot loader program.
Usually it is used by the GRUB 2 loader for GPT partitioning schemes.
@@ -823,6 +833,14 @@ A partition that contains a NTFS or exFAT filesystem.
The scheme-specific type is
.Qq Li "!7"
for MBR.
.It Cm prep-boot
The system partition dedicated to storing boot loaders on some PowerPC systems,
notably those made by IBM.
The scheme-specific types are
.Qq Li "!65"
for MBR and
.Qq Li "!0x9e1a2d38-c612-4316-aa26-8b49521e5a8b"
for GPT.
.It Cm vmware-vmfs
A partition that contains a VMware File System (VMFS).
The scheme-specific types are
@@ -1018,7 +1036,7 @@ Instead, the 800 KBytes bootstrap code image
should be written with the
.Cm gpart bootcode
command to a partition of type
.Cm freebsd-boot ,
.Cm apple-boot ,
which should also be 800 KB in size.
.Sh OPERATIONAL FLAGS
Actions other than the
+1
View File
@@ -117,6 +117,7 @@ struct g_part_alias_list {
{ "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY },
{ "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER },
{ "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 },
{ "prep-boot", G_PART_ALIAS_PREP_BOOT },
};
SYSCTL_DECL(_kern_geom);
+1
View File
@@ -84,6 +84,7 @@ enum g_part_alias {
G_PART_ALIAS_DFBSD_LEGACY, /* A DfBSD legacy partition entry */
G_PART_ALIAS_DFBSD_HAMMER, /* A DfBSD HAMMER FS partition entry */
G_PART_ALIAS_DFBSD_HAMMER2, /* A DfBSD HAMMER2 FS partition entry */
G_PART_ALIAS_PREP_BOOT, /* A PREP/CHRP boot partition entry. */
/* Keep the following last */
G_PART_ALIAS_COUNT
};
-5
View File
@@ -149,11 +149,6 @@ apm_parse_type(const char *type, char *buf, size_t bufsz)
strcpy(buf, APM_ENT_TYPE_APPLE_UFS);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_BOOT);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_APPLE_BOOT);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_FREEBSD);
+2
View File
@@ -190,6 +190,7 @@ static struct uuid gpt_uuid_dfbsd_hammer = GPT_ENT_TYPE_DRAGONFLY_HAMMER;
static struct uuid gpt_uuid_dfbsd_hammer2 = GPT_ENT_TYPE_DRAGONFLY_HAMMER2;
static struct uuid gpt_uuid_dfbsd_label32 = GPT_ENT_TYPE_DRAGONFLY_LABEL32;
static struct uuid gpt_uuid_dfbsd_label64 = GPT_ENT_TYPE_DRAGONFLY_LABEL64;
static struct uuid gpt_uuid_prep_boot = GPT_ENT_TYPE_PREP_BOOT;
static struct g_part_uuid_alias {
struct uuid *uuid;
@@ -240,6 +241,7 @@ static struct g_part_uuid_alias {
{ &gpt_uuid_dfbsd_hammer2, G_PART_ALIAS_DFBSD_HAMMER2, 0 },
{ &gpt_uuid_dfbsd_label32, G_PART_ALIAS_DFBSD, 0xa5 },
{ &gpt_uuid_dfbsd_label64, G_PART_ALIAS_DFBSD64, 0xa5 },
{ &gpt_uuid_prep_boot, G_PART_ALIAS_PREP_BOOT, 0x41 },
{ NULL, 0, 0 }
};
+1 -1
View File
@@ -127,7 +127,7 @@ static struct g_part_mbr_alias {
{ DOSPTYP_LINUX, G_PART_ALIAS_LINUX_DATA },
{ DOSPTYP_LINLVM, G_PART_ALIAS_LINUX_LVM },
{ DOSPTYP_LINRAID, G_PART_ALIAS_LINUX_RAID },
{ DOSPTYP_PPCBOOT, G_PART_ALIAS_FREEBSD_BOOT },
{ DOSPTYP_PPCBOOT, G_PART_ALIAS_PREP_BOOT },
{ DOSPTYP_VMFS, G_PART_ALIAS_VMFS },
{ DOSPTYP_VMKDIAG, G_PART_ALIAS_VMKDIAG },
};
+2
View File
@@ -91,6 +91,8 @@ struct gpt_ent {
{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_ZFS \
{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_PREP_BOOT \
{0x9e1a2d38,0xc612,0x4316,0xaa,0x26,{0x8b,0x49,0x52,0x1e,0x5a,0x8b}}
/*
* The following are unused but documented here to avoid reuse.
@@ -60,7 +60,8 @@ is_scheme_bootable(const char *part_type) {
if (strcmp(platform, "ps3") == 0 && strcmp(part_type, "GPT") == 0)
return (1);
if (strcmp(platform, "chrp") == 0 &&
(strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0))
(strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0 ||
strcmp(part_type, "GPT") == 0))
return (1);
return (0);
@@ -68,13 +69,28 @@ is_scheme_bootable(const char *part_type) {
size_t
bootpart_size(const char *part_type) {
size_t platlen = sizeof(platform);
if (strlen(platform) == 0)
sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
if (strcmp(part_type, "APM") == 0 || strcmp(part_type, "MBR") == 0)
return (800*1024);
if (strcmp(platform, "chrp") == 0 && strcmp(part_type, "GPT") == 0)
return (800*1024);
return (0);
}
const char *
bootpart_type(const char *scheme) {
size_t platlen = sizeof(platform);
if (strlen(platform) == 0)
sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
if (strcmp(platform, "chrp") == 0)
return ("prep-boot");
if (strcmp(platform, "powermac") == 0)
return ("apple-boot");
return ("freebsd-boot");
}
@@ -85,9 +101,14 @@ bootcode_path(const char *part_type) {
const char *
partcode_path(const char *part_type) {
size_t platlen = sizeof(platform);
if (strlen(platform) == 0)
sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
if (strcmp(part_type, "APM") == 0)
return ("/boot/boot1.hfs");
if (strcmp(part_type, "MBR") == 0)
if (strcmp(part_type, "MBR") == 0 ||
(strcmp(platform, "chrp") == 0 && strcmp(part_type, "GPT") == 0))
return ("/boot/boot1.elf");
return (NULL);
}