Author: nwhitehorn
Date: Sat Jul 16 19:25:47 2011
New Revision: 224108
URL: http://svn.freebsd.org/changeset/base/224108

Log:
  Add PS3 partitioning (and framework for future pseries support) to the
  installer.

Modified:
  head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c

Modified: head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c
==============================================================================
--- head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c        Sat Jul 16 
19:11:45 2011        (r224107)
+++ head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c        Sat Jul 16 
19:25:47 2011        (r224108)
@@ -26,19 +26,42 @@
  * $FreeBSD$
  */
 
+#include <sys/types.h>
+#include <sys/sysctl.h>
 #include <string.h>
 
 #include "partedit.h"
 
+static char platform[255] = "";
+
 const char *
 default_scheme(void) {
-       return ("APM");
+       size_t platlen = sizeof(platform);
+       if (strlen(platform) == 0)
+               sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
+       if (strcmp(platform, "powermac") == 0)
+               return ("APM");
+       if (strcmp(platform, "chrp") == 0)
+               return ("MBR");
+
+       /* Pick GPT (bootable on PS3) as a generic default */
+       return ("GPT");
 }
 
 int
 is_scheme_bootable(const char *part_type) {
-       if (strcmp(part_type, "APM") == 0)
+       size_t platlen = sizeof(platform);
+       if (strlen(platform) == 0)
+               sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
+       if (strcmp(platform, "powermac") == 0 && strcmp(part_type, "APM") == 0)
                return (1);
+       if (strcmp(platform, "ps3") == 0 && strcmp(part_type, "GPT") == 0)
+               return (1);
+       if (strcmp(platform, "chrp") == 0 && strcmp(part_type, "MBR") == 0)
+               return (1);
+
        return (0);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to