[test] Include failing code within failed test result output

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[main] Defer "initialising devices" message until initialising devices

Allow the "initialising devices" message to show up on consoles which
require initialisation, by deferring it until after initialise() has
completed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[console] Pass escape sequence context to ANSI escape sequence handlers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[pixbuf] Add generic concept of a pixel buffer

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[image] Allow for non-executable image formats

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[image] Add image_pixbuf() to create pixel buffer from image

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[pnm] Add support for PNM images

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[mucurses] Use "<ESC>[2J" ANSI escape sequence to clear screen

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[console] Allow console input and output to be disabled independently

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[console] Add concept of generic console configuration

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[cmdline] Add "console" command to configure console

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[fbcon] Add generic concept of a frame buffer console

Add support for a simple frame buffer console, using single buffering
and a fixed-width bitmap font.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[vesafb] Add VESA frame buffer console

The VESA frame buffer console uses the VESA BIOS extensions (VBE) to
enumerate video modes, selects an appropriate mode, and then hands off
to the generic frame buffer code.

The font is extracted from the VGA BIOS, avoiding the need to provide
an external font file.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[vesafb] Include raw status value within VBE error messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[vesafb] Skip modes for which we cannot get mode information

The VirtualBox BIOS fails to retrieve mode information (with status
0x0100) for some modes within the mode list.  Skip any such modes,
rather than treating this as a fatal error.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[vesafb] Return meaningful error when no suitable mode is found

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[vesafb] Select an optimal mode, rather than the first acceptable mode

There is no requirement for VBE modes to be listed in increasing order
of resolution.  With the present logic, this can cause e.g. a 1024x768
mode to be selected if the user asks for 640x480, if the 1024x768 mode
is earlier in the mode list.

Define a scoring system for modes as

  score = ( width * height - bpp )

and choose the mode with the lowest score among all acceptable modes.
This should prefer to choose the mode closest to the requested
resolution, with a slight preference for higher colour depths.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[build] Fix building on OpenBSD 5.4

OpenBSD 5.4 seems to generate dynamically linked binaries by default,
which breaks our build process.  Fix by forcing the linker to always
create static binaries.

Reported-by: Jiri B <jirib@devio.us>
Tested-by: Jiri B <jirib@devio.us>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[console] Allow '?' as an intermediate byte in ANSI escape sequences

The ANSI escape sequences to show and hide the cursor take the form
"<ESC>[?25h" and "<ESC>[?25l" respectively.  iPXE currently treats the
'?' character as the final byte.  Fix by explicitly treating '?' as an
intermediate byte.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[mucurses] Implement curs_set() to control cursor visibility

Signed-off-by: Michael Brown <mcb30@ipxe.org>