Graphical boot with grub2

Matt Housh jaeger at morpheus.net
Mon Nov 19 15:40:50 UTC 2012


On 11/19/2012 07:46 AM, Bernd Eggink wrote:
> Hi all, has anybody successfully configured a graphical grub-2.00
> boot in Crux 2.8 - with a nice background image, a correct font and
> all? I gave up after 2 days of experimenting and approx. 100 reboots.
> Either I got an image, but with an ugly frame around it (the font
> missing the line and corner characters), or I got a text mode menu
> anyway. I also spent some time in searching the web for a grub2
> documentation, but it seems that any good documentation about grub2
> is automatically Ubuntu-specific. So if anybody has such a
> configuration, I'd appreciate if he could send me his grub.cfg and
> etc/default/grub. - Thanks in advance!

Hi, Bernd,

This is indeed possible with a little bit of work. Here's an example
grub.cfg:

-----
set default=0
set timeout=5

set menu_color_normal=white/black
set menu_color_highlight=white/blue

loadfont /boot/grub/unifont.pf2
set gfxmode=1024x768
insmod all_video
insmod gfxterm
terminal_output gfxterm
insmod jpeg
background_image -m stretch /boot/grub/artorias.jpg

# set the root variable
search --fs-uuid --no-floppy --set root aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

menuentry "CRUX 2.8 x86_64-multilib (3.5.4)" {
	set gfxpayload=keep
	linux /boot/vmlinuz-3.5.4 root=/dev/sdc2 ro quiet
}

menuentry "CRUX 2.8 x86_64-multilib (3.5.4) single-user rescue" {
	linux /boot/vmlinuz-3.5.4 root=/dev/sdc2 ro single
}
-----

First things first, the unifont.pf2 file is created by downloading
unifont in BDF format from http://unifoundry.com/unifont.html, then
converting it via grub-mkfont:

$ wget http://unifoundry.com/unifont-5.1.20080820.bdf.gz
$ gzip -d unifont-5.1.20080820.bdf.gz
$ grub-mkfont -o unifont.pf2 unifont-5.1.20080820.bdf
$ sudo install -o root -g root -m 0644 unifont.pf2 /boot/grub/

You can use a different font if you like, this is the one I use.

Next up, 'set gfxmode=1024x768' sets the video mode as you might guess.
The modes this command supports are the VBE modes supported by your
video card's BIOS, NOT the modes that your X.org driver can support!

If you need a list of those modes, at the grub menu press 'c' to get a
command prompt, then type 'vbeinfo' and grub will show you the modes
that are available. If you set a mode that isn't supported grub2 will
switch to one that is, in my experience. For example, if I use 'set
gfxmode=1920x1080' it will end up using 1280x1024 instead. Even though
1920x1080 is the native resolution of my monitor, it is NOT supported by
the video card's VBE BIOS.

'insmod all_video' loads grub2's 'all_video' module. You could probably
use 'vbe' or something here, I didn't test that.

'insmod gfxterm' and 'terminal_output gfxterm' load and enable grub2's
graphical display support.

'insmod jpeg' loads grub2's jpeg module. If your splash is in one of the
other supported formats, load that module instead. The supported formats
seem to be jpeg, png, and tga.

'background_image -m stretch /boot/grub/artorias.jpg' loads the image
itself. There are two options for the mode (-m), 'stretch' and 'normal'.
'stretch' does what you'd expect, I believe 'normal' just aligns the
image to the top right corner without scaling but I didn't test that either.

The rest of the options are not related to the graphical splash setup.

Hope this helps.

Matt



More information about the CRUX mailing list