that hang if GRUB tries to setup colors.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
colors for firmwares that don't support it.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
Recognize Open Hack'Ware, set flags to work around its
limitations.
+2008-01-24 Pavel Roskin <proski@gnu.org>
+
+ * include/grub/ieee1275/ieee1275.h: Introduce flag for firmwares
+ that hang if GRUB tries to setup colors.
+ * term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
+ colors for firmwares that don't support it.
+ * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
+ Recognize Open Hack'Ware, set flags to work around its
+ limitations.
+
2008-01-24 Robert Millan <rmh@aybabtu.com>
* kern/file.c (grub_file_open): Do not account previous failures of
/* OLPC / XO firmware hangs when accessing USB devices. */
GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
+
+ /* Open Hack'Ware stops when trying to set colors */
+ GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS,
};
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
grub_ieee1275_flags |= (1 << flag);
}
+#define SF "SmartFirmware(tm)"
+#define OHW "PPC Open Hack'Ware"
+
static void
grub_ieee1275_find_options (void)
{
grub_ieee1275_phandle_t root;
grub_ieee1275_phandle_t options;
grub_ieee1275_phandle_t openprom;
+ grub_ieee1275_phandle_t bootrom;
int rc;
int realmode = 0;
char tmp[32];
rc = grub_ieee1275_get_property (openprom, "CodeGen-copyright",
tmp, sizeof (tmp), 0);
-#define SF "SmartFirmware(tm)"
if (rc >= 0 && !grub_strncmp (tmp, SF, sizeof (SF) - 1))
is_smartfirmware = 1;
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
}
+
+ if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom))
+ {
+ rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0);
+ if (rc >= 0 && !grub_strncmp (tmp, OHW, sizeof (OHW) - 1))
+ {
+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT);
+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS);
+ }
+ }
}
+#undef SF
+#undef OHW
+
void cmain (void);
void
cmain (void)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
/* Initialize colors. */
- for (col = 0; col < 7; col++)
- grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
- colors[col].green, colors[col].blue);
+ if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
+ {
+ for (col = 0; col < 7; col++)
+ grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
+ colors[col].green, colors[col].blue);
- /* Set the right fg and bg colors. */
- grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
+ /* Set the right fg and bg colors. */
+ grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
+ }
return 0;
}