2009-11-14 Vladimir Serbinenko <phcoder@gmail.com>
Support for gfxterm in a window.
* include/grub/gfxterm.h: New file.
* include/grub/video.h (struct grub_video_rect): New declaration.
(grub_video_rect_t): Likewise.
* term/gfxterm.c (struct grub_gfxterm_window): New type.
(refcount): New variable.
(render_target): Likewise.
(window): Likewise.
(repaint_callback): Likewise.
(grub_virtual_screen_setup): Use 'render_target'.
(init_window): New function.
(grub_gfxterm_init_window): Likewise.
(grub_gfxterm_init): Check reference counter.
Use init_window.
(destroy_window): New function.
(grub_gfxterm_destroy_window): Likewise.
(grub_gfxterm_fini): Check reference counter.
Use destroy_window.
(redraw_screen_rect): Restore viewport.
Use 'render_target' and 'window'.
Call 'repaint_callback'.
(write_char): Use 'render_target'.
(draw_cursor): Likewise.
(scroll_up): Restore viewport.
Use 'render_target' and 'window'.
Call 'repaint_callback'.
(grub_gfxterm_cls): Likewise.
(grub_gfxterm_refresh): Use 'window'.
(grub_gfxterm_set_repaint_callback): New function.
(grub_gfxterm_background_image_cmd): Use 'window'.
(grub_gfxterm_get_term): New function.
(GRUB_MOD_INIT(term_gfxterm)): Set 'refcount' to 0.
Also-By: Vladimir Serbinenko <phcoder@gmail.com>
Fix "lost keypress" bug in at_keyboard.
* term/i386/pc/at_keyboard.c (grub_at_keyboard_checkkey): New function.
Checks for readyness of input buffer (without flushing it).
(grub_at_keyboard_term): Use grub_at_keyboard_checkkey() rather
than grub_at_keyboard_getkey_noblock() for `checkkey' struct member.
* term/usb_keyboard.c (grub_usb_keyboard_getreport): Make
`report' grub_uint8_t *.
(grub_usb_keyboard_checkkey): Make `data' elements grub_uint8_t.
Use a 50-millisecond timeout rather than just repeating
grub_usb_keyboard_getreport 50 times.
(grub_usb_keyboard_getkey): Make `data' elements grub_uint8_t.
* term/i386/pc/serial.c (serial_translate_key_sequence): Avoid
casts to short - they are not portable and cause warnings. Fix
use of uninitialized values in input_buf. Use ARRAY_SIZE.
gfxpayload support
* commands/videotest.c (grub_cmd_videotest): use grub_video_set_mode
* include/grub/video.h (GRUB_VIDEO_MODE_TYPE_PURE_TEXT): new definition
(grub_video_setup): remove
(grub_video_set_mode): new prototype
* loader/i386/linux.c (DEFAULT_VIDEO_MODE): new definition
(vid_mode): remove
(linux_vesafb_res): compile only on PCBIOS
(grub_linux_boot): support gfxpayload
* loader/i386/pc/xnu.c (video_hook): new function
(grub_xnu_set_video): support gfxpayload
* term/gfxterm.c (DEFAULT_VIDEO_WIDTH): removed
(DEFAULT_VIDEO_HEIGHT): likewise
(DEFAULT_VIDEO_FLAGS): likewise
(DEFAULT_VIDEO_MODE): new definition
(video_hook): new function
(grub_gfxterm_init): use grub_video_set_mode
* util/grub.d/30_os-prober.in: remove explicit modesetting before
loading xnu
* video/video.c (grub_video_setup): removed
(grub_video_set_mode): new function based on grub_gfxterm_init and
grub_video_setup
* term/gfxterm.c (draw_cursor): Ensure character is redrawn.
(grub_gfxterm_putchar): Extract pairs of identical calls to
draw_cursor out of conditional blocks.
Implement USB keyboard support (based on patch by Marco Gerards)
* conf/i386-pc.rmk (pkglib_MODULES): Add `usb_keyboard.mod'.
(usb_keyboard_mod_SOURCES, usb_keyboard_mod_CFLAGS)
(usb_keyboard_mod_LDFLAGS): New variables.
* term/usb_keyboard.c: New file.
Fix breakage on coreboot due to declaration missmatch.
* term/i386/pc/vga_text.c (grub_vga_text_init_fini): New function.
(grub_vga_text_term): Use grub_vga_text_init_fini() instead of
grub_vga_text_cls().
Fix build problems on i386-ieee1275 and *-efi (introduced by vga_text
split).
* include/grub/i386/pc/console.h: Include `<grub/i386/vga_common.h>'.
(grub_console_cur_color, grub_console_real_putchar)
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* include/grub/i386/vga_common.h: ... to here (new file).
* term/i386/pc/vga_text.c: Replace `<grub/machine/console.h>' with
`<grub/i386/vga_common.h>' and `<grub/cpu/io.h>' with
`<grub/i386/io.h>'.
* term/i386/vga_common.c: Replace `<grub/machine/console.h>' with
`<grub/i386/vga_common.h>'.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
Fix a regression introduced by the at_keyboard.mod split. Because
some terminals are default on some platforms and non-default on
others, the first terminal being registered determines which is
going to be default.
* kern/term.c (grub_term_register_input): If this is the first
terminal being registered, set it as the current one.
(grub_term_register_output): Likewise.
* term/efi/console.c (grub_console_init): Do not call
grub_term_set_current_output() or grub_term_set_current_input().
* term/ieee1275/ofconsole.c (grub_console_init): Likewise.
* term/i386/pc/console.c (grub_console_init): Likewise.
(grub_console_fini): Do not call grub_term_set_current_input()
(but leave grub_term_set_current_output() to restore text mode).
* term/i386/pc/vesafb.c (grub_vesafb_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* util/console.c (grub_ncurses_term): Split in ...
(grub_ncurses_term_input): ... this, and ...
(grub_ncurses_term_output): ... this. Update all users.
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
* term/i386/pc/vga_text.c (grub_console_cls): Use
grub_console_gotoxy() to go back to beginning of the screen.
Found by Patrick Georgi <patrick.georgi@coresystems.de>
* term/i386/pc/serial.c (GRUB_SERIAL_PORT_NUM): New constant.
[!GRUB_MACHINE_PCBIOS] (serial_hw_io_addr): Add COM2 and COM3.
(serial_hw_get_port): Check validity of the port number.
(grub_cmd_serial): Check return value of serial_hw_get_port().
* include/grub/ieee1275.h (grub_ieee1275_flag): New constant
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
and GRUB_IEEE1275_FLAG_NO_ANSI.
* kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set flag
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
and GRUB_IEEE1275_FLAG_NO_ANSI for Open Hackware.
* kern/ieee1275/ieee1275.c (grub_ieee1275_interpret): Return
immediately if GRUB_IEEE1275_FLAG_CANNOT_INTERPRET is set.
* kern/ieee1275/init.c (grub_claim_heap): Claim memory directly if
GRUB_IEEE1275_FLAG_FORCE_CLAIM is set.
* term/ieee1275/ofconsole.c (grub_ofconsole_writeesc): Don't output
esc sequence on non ANSI terminal.
(grub_ofconsole_gotoxy): Emulate backspace key on non ANSI terminal.
* util/elf/grub-mkimage.c (add_segments): Move ELF header to the
beginning of file.
* term/ieee1275/ofconsole.c (fgcolor, bgcolor): Remove variables.
(grub_ofconsole_normal_color, grub_ofconsole_highlight_color): New
variables.
(grub_ofconsole_setcolor, grub_ofconsole_getcolor): Load/store
values in grub_ofconsole_normal_color and
grub_ofconsole_highlight_color (they're not directly related to
background and foreground).
(grub_ofconsole_setcolorstate): Extract background and foreground
from grub_ofconsole_normal_color and grub_ofconsole_highlight_color.
* term/i386/pc/console.c [GRUB_MACHINE_LINUXBIOS] (grub_console_init):
Initialize keyboard controller after registering the terminal, so that
grub_printf() can be called from grub_keyboard_controller_init().
* term/ieee1275/ofconsole.c (grub_ofconsole_setcursor): Implement
using "cursor-on" and "cursor-off" commands (understood at least by
the Open Firmware flavour on OLPC).
* Makefile.in (RMKFILES): Add missing arch i386-ieee1275 and
i386-linuxbios.
* commands/hexdump.c (grub_cmd_hexdump): Support dumping of device,
change the buffer size to 4096 for cdrom device.
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod, linux.mod
and nand.mod.
(_linux_mod_SOURCES): New variable.
(_linux_mod_CFLAGS): Likewise.
(_linux_mod_LDFLAGS): Likewise.
(linux_mod_SOURCES): Likewise.
(linux_mod_CFLAGS): Likewise.
(linux_mod_LDFLAGS): Likewise.
(nand_mod_SOURCES): Likewise.
(nand_mod_CFLAGS): Likewise.
(nand_mod_LDFLAGS): Likewise.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Return
GRUB_ERR_UNKNOWN_DEVICE instead of GRUB_ERR_BAD_DEVICE if no device
type property. (nand device in olpc don't have this property)
* include/grub/disk.h (grub_disk_dev_id): New macro
GRUB_DISK_DEVICE_NAND_ID.
* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New
function prototype.
(grub_rescue_cmd_initrd): Likewise.
* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro.
(linux_kernel_params): Add new member ofw_signature, ofw_num_items,
ofw_cif_handler and ofw_idt, adjust padding number.
* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if
GRUB_MACHINE_IEEE1275 is defined.
* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
Use NESTED_FUNC_ATTR attribute on the hook parameter.
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR
on nested function heap_init.
(grub_upper_mem): New variable for i386-ieee1275.
(grub_get_extended_memory): New function for i386-ieee1275.
(grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use
NESTED_FUNC_ATTR on the hook parameter. Don't quit if no device type
property.
* loader/i386/ieee1275/linux.c: New file.
* loader/i386/ieee1275/linux_normal.c: New file.
* disk/ieee1275/nand.c: New file.
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
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.
* term/i386/pc/at_keyboard.c (grub_keyboard_isr): #ifdef out
grub_dprintf calls, since they make "debug=all" mode unusable.
(grub_console_checkkey): Likewise.
* conf/i386-pc.rmk (GRUB_MEMORY_MACHINE_LINK_ADDR): New variable.
(kernel_img_LDFLAGS): Use `GRUB_MEMORY_MACHINE_LINK_ADDR' as link
address.
(grub_mkimage_CFLAGS): Propagate `GRUB_MEMORY_MACHINE_LINK_ADDR' as
a C macro.
* include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_UPPER): New macro.
Indicates start of upper memory.
* util/i386/pc/grub-mkimage.c: Include `<grub/machine/memory.h>'.
(generate_image): Abort when image size is big enough to corrupt
upper memory.
* include/grub/i386/pc/vga.h: Include `<grub/machine/memory.h>'.
(GRUB_MEMORY_MACHINE_VGA_ADDR): Alias for `GRUB_MEMORY_MACHINE_UPPER'.
* term/i386/pc/vga.c (VGA_MEM): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
* video/i386/pc/vbe.c: Include `<grub/machine/vga.h>'.
(grub_vbe_set_video_mode): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
Get rid of confusing function (superceeded by
`grub_ieee1275_get_integer_property')
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_decode_int_4): Remove
prototype.
* kern/ieee1275/ieee1275.c (grub_ieee1275_decode_int_4): Remove
function.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid use of
grub_ieee1275_decode_int_4(), by obtaining integer properties directly
in native endianess from grub_ieee1275_get_integer_property().
* kern/i386/linuxbios/init.c: Put "void" to all function
declarations with no arguments.
* kern/powerpc/ieee1275/init.c: Likewise.
* term/i386/pc/at_keyboard.c: Likewise.
* term/i386/pc/vga_text.c: Likewise.
* util/grub-mkdevicemap.c: Likewise.
* include/grub/video.h: Added grub_video_unmap_color and
grub_video_get_active_render_target.
(grub_video_adapter): Added unmap_color and get_active_render_target.
* video/video.c: Added grub_video_unmap_color and
grub_video_get_active_render_target.
(grub_video_get_info): Changed method to accept NULL pointer as an
argument to allow detection of active video adapter.
* video/i386/pc/vbe.c: Renamed grub_video_vbe_unmap_color as
grub_video_vbe_unmap_color_int.
Added grub_video_vbe_unmap_color and
grub_video_vbe_get_active_render_target.
(grub_video_vbe_adapter): Added unmap_color and
get_active_render_target.
* video/i386/pc/vbeblit.c: Replaced grub_video_vbe_unmap_color usage
with grub_video_vbe_unmap_color_int.
* term/gfxterm.c (DEFAULT_STANDARD_COLOR): Added.
(DEFAULT_NORMAL_COLOR): Likewise.
(DEFAULT_HIGHLIGHT_COLOR) Likewise.
(DEFAULT_FG_COLOR): Removed.
(DEFAULT_BG_COLOR): Likewise.
(DEFAULT_CURSOR_COLOR): Changed value.
(grub_virtual_screen): Added standard_color_setting,
normal_color_setting, highlight_color_setting and term_color.
(grub_virtual_screen): Removed fg_color_setting and bg_color_setting.
(bitmap_width): Added.
(bitmap_height): Likewise.
(bitmap): Likewise.
(set_term_color): Likewise.
(grub_virtual_screen_setup): Changed to use new terminal coloring
settings.
(grub_gfxterm_init): Added init for bitmap.
(grub_gfxterm_fini): Added destroy for bitmap.
(redraw_screen_rect): Updated to use background bitmap and new
terminal coloring.
(scroll_up): Added optimization for case when there is no bitmap.
(grub_gfxterm_cls): Fixed to use correct background color.
(grub_virtual_screen_setcolorstate): Changed to use new terminal
coloring.
(grub_virtual_screen_setcolor): Likewise.
(grub_virtual_screen_getcolor): Added.
(grub_gfxterm_background_image_cmd): Likewise.
(grub_video_term): Added setcolor and getcolor.
(MOD_INIT): Added registration of background_image command.
(MOD_TERM): Added unregistration for background_image command.
* include/grub/term.h (struct grub_term): Add `getcolor' function.
(grub_getcolor): New function.
* kern/term.c (grub_getcolor): New function.
* normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
(GRUB_COLOR_MENU_HIGHLIGHT): New macro.
(print_entry): Set normal and highlight colors to
`GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
respectively, before printing and restore them to old
values afterwards.
(grub_menu_init_page): Likewise. Fill an additional colored space
that would otherwise be left blank.
* term/efi/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* include/grub/i386/efi/machine.h: New file.
* include/grub/i386/linuxbios/machine.h: Likewise.
* include/grub/i386/pc/machine.h: Likewise.
* include/grub/powerpc/ieee1275/machine.h: Likewise.
* include/grub/sparc64/ieee1275/machine.h: Likewise.
* term/i386/pc/serial.c: Include <grub/machine/machine.h>.
(serial_hw_io_addr): New variable.
(serial_hw_get_port): Obtain port address from `serial_hw_io_addr'
instead of `(unsigned short *) 0x400'.
* term/i386/pc/vga_text.c: Include <grub/cpu/io.h>.
(CRTC_ADDR_PORT): New macro.
(CRTC_DATA_PORT): Likewise.
(CRTC_CURSOR): Likewise.
(CRTC_CURSOR_ADDR_HIGH): Likewise.
(CRTC_CURSOR_ADDR_LOW): Likewise.
(update_cursor): New function.
(grub_console_real_putchar): Call `update_cursor'.
(grub_console_gotoxy): Likewise.
(grub_console_cls): Set the default color when clearing the
screen.
(grub_console_setcursor): Implemented.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
flag when running on SmartFirmware.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
"output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
was set.
* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
rather than decreasing it.
* util/i386/pc/grub-setup.c (setup): When embedding is required, but
there's not enough space to do it, fail in the same way as when it
can't be done because there are no partitions.
* util/powerpc/ieee1275/grub-install.in: Improve error message shown
when nvsetenv failed.