gfxterm

gfxterm is a graphical terminal for GRUB 2. It is being constantly improved and therefore this page will be in flux. This page contains information how to use the module.

gfxterm uses GRUB 2's VideoSubsystem to draw graphics to screen. This allow same terminal code used on all graphics adapters where there is a video driver. Currently there is only VESA Bios Extension 2.0+ support that can be used on most of the current graphic adapter on x86 platform.

In order to support international characters, there is a font system built for GRUB 2 and gfxterm uses it. Currently only loaded fonts in custom font file format are supported.

Configuring VideoSubsystem

VideoSubsystem is a graphics driver architecture for GRUB 2. It support all commonly used graphical operations in order to draw to screen. VideoSubsystem consists of core module (video.mod) and then graphics adapter drivers. You can load multiple drivers at same time, but only one of those are used at a time. When driver reports that graphical mode is being initialized correctly, that driver will be selected as active.

Example for loading VESA Bios Extension 2.0+ Driver (vbe.mod):

insmod video
insmod vbe

Configuring font system

If text is wanted to be displayed under gfxterm, there must be a font(s) loaded. Most important one is the ASCII characters so most of the grub messages can be displayed. Set covering all normally used glyphs would include Latin-1, Latin Extended A+B, Arrows, Box and Block characters. As grub uses Unicode internally, all glyphs in fonts must also use standard Unicode codes. Currently only monochrome bitmap fonts are supported.

To get started, you can get unifont.hex from Roman Czyborra's site.

As this file is gzipped, you must first unpack it:

gunzip unifont.hex.gz

This unifont.hex still cannot be used, it must first be converted to GRUB's own font format. In order to do that, there exists a ruby script unifont2pff.rb. You should also remember that you might not need whole Unicode in normal day use, so you might be better using smaller subset of glyphs. Below are examples how to get different sets of glyphs.

Example for converting all glyphs from unifont.hex to pff format:

ruby util/unifont2pff.rb unifont.hex > unifont.pff

Example for converting only ASCII characters:

ruby util/unifont2pff.rb 0-127 unifont.hex > unifont.pff

Example for converting Latin-1, Latin Extended A+B, Arrows, Box and Block characters:

ruby util/unifont2pff.rb 0x0000-0x0241 0x2190-0x21FF 0x2500-0x259f unifont.hex > unifont.pff

Example for converting Arabic characters (Please note that displaying Arabic doens't work as expected at this time)

ruby util/unifont2pff.rb 0x600-0x6ff 0x750-0x77f 0xfb50-0xfdff 0xfe70-0xfeff unifont.hex > unifont.pff

Example for converting Arabic characters with Latin-1, Latin "to have arabic with english support"

ruby util/unifont2pff.rb 0x600-0x6ff 0x750-0x77f 0xfb50-0xfdff 0xfe70-0xfeff 0x0000-0x0241 0x2190-0x21FF 0x2500-0x259f unifont.hex > unifont.pff

And now that you have fonts converted you can load them to grub. First you must load font module and then use font command to load actual font.

Example for loading font:

insmod font
font /boot/grub/unifont.pff

Configuring gfxterm

gfxterm uses grub's environment variables for configuration. Currently there is only one used variable, gfxmode controls what resolution will be chosen when terminal is being initialized. gfxterm offers this resolution information to all drivers registered in VideoSubsystem and pick's firstone to accepth this setting. If in case support for specified mode cannot be found, terminal initialization will fail and older driver will be re-initialized (this feature is still in the owen :)).

gfxmode is formatted in form <width>x<height>[x<depth>][;<another mode>], where color bitdepth can be omitted. If multime modes are provided then first mode in list will be tried first and if it cannot be initialized on any of the video drivers then next mode will be tried. Please note that gfxmode only affects gfxterm module. It will not affect mode being set for booting up OS. To initialize graphical terminal enter command "terminal gfxterm". Make sure you have fonts loaded before entering to graphics mode or you will only see blocky characters.

Example:

insmod gfxterm
set gfxmode=1024x768x32
terminal gfxterm

Example that prefer full color modes (32bit) and then as a fall-back mechanism to use any mode:

insmod gfxterm
set gfxmode="1024x768x32;800x600x32;640x480x32;1024x768;800x600;640x480"
terminal gfxterm

To get back to text console, use following:

terminal console


CategoryDocumentation

GrubWiki: gfxterm (last edited 2008-05-16 18:49:41 by VesaJääskeläinen)