* 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.
This commit is contained in:
parent
605e36ed3e
commit
d08bbb491e
4 changed files with 38 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
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>
|
2008-01-24 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
* kern/file.c (grub_file_open): Do not account previous failures of
|
* kern/file.c (grub_file_open): Do not account previous failures of
|
||||||
|
|
|
@ -86,6 +86,9 @@ enum grub_ieee1275_flag
|
||||||
|
|
||||||
/* OLPC / XO firmware hangs when accessing USB devices. */
|
/* OLPC / XO firmware hangs when accessing USB devices. */
|
||||||
GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
|
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);
|
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
|
||||||
|
|
|
@ -46,12 +46,16 @@ grub_ieee1275_set_flag (enum grub_ieee1275_flag flag)
|
||||||
grub_ieee1275_flags |= (1 << flag);
|
grub_ieee1275_flags |= (1 << flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SF "SmartFirmware(tm)"
|
||||||
|
#define OHW "PPC Open Hack'Ware"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grub_ieee1275_find_options (void)
|
grub_ieee1275_find_options (void)
|
||||||
{
|
{
|
||||||
grub_ieee1275_phandle_t root;
|
grub_ieee1275_phandle_t root;
|
||||||
grub_ieee1275_phandle_t options;
|
grub_ieee1275_phandle_t options;
|
||||||
grub_ieee1275_phandle_t openprom;
|
grub_ieee1275_phandle_t openprom;
|
||||||
|
grub_ieee1275_phandle_t bootrom;
|
||||||
int rc;
|
int rc;
|
||||||
int realmode = 0;
|
int realmode = 0;
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
|
@ -69,7 +73,6 @@ grub_ieee1275_find_options (void)
|
||||||
|
|
||||||
rc = grub_ieee1275_get_property (openprom, "CodeGen-copyright",
|
rc = grub_ieee1275_get_property (openprom, "CodeGen-copyright",
|
||||||
tmp, sizeof (tmp), 0);
|
tmp, sizeof (tmp), 0);
|
||||||
#define SF "SmartFirmware(tm)"
|
|
||||||
if (rc >= 0 && !grub_strncmp (tmp, SF, sizeof (SF) - 1))
|
if (rc >= 0 && !grub_strncmp (tmp, SF, sizeof (SF) - 1))
|
||||||
is_smartfirmware = 1;
|
is_smartfirmware = 1;
|
||||||
|
|
||||||
|
@ -133,8 +136,21 @@ grub_ieee1275_find_options (void)
|
||||||
|
|
||||||
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
|
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);
|
||||||
void
|
void
|
||||||
cmain (void)
|
cmain (void)
|
||||||
|
|
|
@ -333,12 +333,15 @@ grub_ofconsole_init (void)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
||||||
|
|
||||||
/* Initialize colors. */
|
/* Initialize colors. */
|
||||||
|
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
|
||||||
|
{
|
||||||
for (col = 0; col < 7; col++)
|
for (col = 0; col < 7; col++)
|
||||||
grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
|
grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
|
||||||
colors[col].green, colors[col].blue);
|
colors[col].green, colors[col].blue);
|
||||||
|
|
||||||
/* Set the right fg and bg colors. */
|
/* Set the right fg and bg colors. */
|
||||||
grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
|
grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue