#include <grub/emu/misc.h>
#include <sys/types.h>
#include <dirent.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
grub_util_info ("... not found");
return "i386-pc";
}
+
+const char *
+grub_install_get_default_powerpc_machtype (void)
+{
+ FILE *fp;
+ char *buf = NULL;
+ size_t len = 0;
+ const char *machtype = "generic";
+
+ fp = grub_util_fopen ("/proc/cpuinfo", "r");
+ if (! fp)
+ return machtype;
+
+ while (getline (&buf, &len, fp) > 0)
+ {
+ if (strncmp (buf, "pmac-generation",
+ sizeof ("pmac-generation") - 1) == 0)
+ {
+ if (strstr (buf, "NewWorld"))
+ {
+ machtype = "pmac_newworld";
+ break;
+ }
+ if (strstr (buf, "OldWorld"))
+ {
+ machtype = "pmac_oldworld";
+ break;
+ }
+ }
+
+ if (strncmp (buf, "motherboard", sizeof ("motherboard") - 1) == 0 &&
+ strstr (buf, "AAPL"))
+ {
+ machtype = "pmac_oldworld";
+ break;
+ }
+
+ if (strncmp (buf, "machine", sizeof ("machine") - 1) == 0 &&
+ strstr (buf, "CHRP IBM"))
+ {
+ machtype = "chrp_ibm";
+ break;
+ }
+
+ if (strncmp (buf, "platform", sizeof ("platform") - 1) == 0)
+ {
+ if (strstr (buf, "Maple"))
+ {
+ machtype = "maple";
+ break;
+ }
+ if (strstr (buf, "Cell"))
+ {
+ machtype = "cell";
+ break;
+ }
+ }
+ }
+
+ free (buf);
+ fclose (fp);
+ return machtype;
+}
const char *
grub_install_get_default_x86_platform (void);
+const char *
+grub_install_get_default_powerpc_machtype (void);
+
void
grub_install_register_efi (grub_device_t efidir_grub_dev,
const char *efifile_path,
static int removable = 0;
static int recheck = 0;
static int update_nvram = 1;
+static int chrp_note = 0;
static char *install_device = NULL;
static char *debug_image = NULL;
static char *rootdir = NULL;
if (platform == GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
{
+ const char *machtype = grub_install_get_default_powerpc_machtype ();
int is_guess = 0;
+
+ if (strcmp (machtype, "pmac_oldworld") == 0)
+ update_nvram = 0;
+ else if (strcmp (machtype, "chrp_ibm") == 0)
+ {
+ update_nvram = 0;
+ chrp_note = 1;
+ }
+ else if (strcmp (machtype, "cell") == 0)
+ update_nvram = 0;
+ else if (strcmp (machtype, "generic") == 0)
+ update_nvram = 0;
+
if (!macppcdir)
{
char *d;
/* output */ imgfile,
/* memdisk */ NULL,
have_load_cfg ? load_cfg : NULL,
- /* image target */ mkimage_target, 0);
+ /* image target */ mkimage_target, chrp_note);
/* Backward-compatibility kludges. */
switch (platform)
{