diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2014-07-04 15:55:32 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2014-07-04 15:55:32 +0000 |
commit | 6fa381c0bf4943c64c238b23b3b3f85534786588 (patch) | |
tree | 86e3e90fab77df08e7453d6048f215852172ca90 /usr.sbin/bsdinstall/partedit | |
parent | fa1bbb761808bc564ea2d03b9a474917dd6bc915 (diff) | |
download | FreeBSD-src-6fa381c0bf4943c64c238b23b3b3f85534786588.zip FreeBSD-src-6fa381c0bf4943c64c238b23b3b3f85534786588.tar.gz |
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.
Diffstat (limited to 'usr.sbin/bsdinstall/partedit')
-rw-r--r-- | usr.sbin/bsdinstall/partedit/partedit_powerpc.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/usr.sbin/bsdinstall/partedit/partedit_powerpc.c b/usr.sbin/bsdinstall/partedit/partedit_powerpc.c index 4fa2e05..77c682a 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_powerpc.c +++ b/usr.sbin/bsdinstall/partedit/partedit_powerpc.c @@ -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); } |