Rendezvous with GRUB2

I recently upgraded my boot-loader to GNU GRUB 2. It has several new interesting features which sets it apart it from the older version, now termed GRUB Legacy


Another reason for my upgrade to GNU GRUB 2 was that GRUB legacy it no longer being under active development – no new features will be added to it, ever. The GNU website cites messy code as the primary reason for this decision. GRUB 2, as of now, is relatively stable and will probably run properly on your system unless you happen to have a really weird configuration.


On a typical Arch GNU/Linux system a simple sudo pacman -S grub2 will do the job. The sweet little package manager actually will tell you about the new grub2 package conflicting with the older grub package and will offer to remove the older package for you.


One very important difference between GRUB Legacy and GRUB 2 is the configuration file – instead of /boot/grub/menu.lst the configuration file is stored at /boot/grub/grub.cfg. The format is also very different, a sample grub.cfg would look like



# Timeout for menu
set timeout=10

# Set default boot entry as Entry 0
set default=0

# Entry 0 - Load Linux kernel
menuentry "My Linux Kernel on (hd0,1)" {
set root=(hd0,1)
linux /vmlinuz root=/dev/hda1
initrd /initrd
}

# Entry 1 - Chainload another bootloader
menuentry "Chainload my OS" {
set root=(hd0,3)
chainloader +1
}

The numbering of the hard drives is also different – what was (hd0,8) on my system with GRUB legacy is now (hd0,9).


Coming to the more interesting stuff – you have the option of setting the font for the GRUB interface. You need to convert your fonts to the pf2 format before you can use them. GRUB 2 provides an utility for this conversion – grub-mkfont. I tried converting my favorite Monaco from ttf to pf2 but the menu seems not to like the height of the font – I probably need to pass some extra parameters to grub-mkfont, will work that out later. If your graphics card is currently supported you can actually display a high-resolution GNU menu and maybe even a nice background image (not those 14 color pictures supported by GRUB legacy but a proper JPEG or TGA image). You can do all this by something like the following:



if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode="1024x768"
insmod gfxterm
insmod vbe
terminal_output gfxterm
if terminal_output gfxterm; then true ; else
terminal gfxterm
fi
fi

insmod tga
background_image /boot/grub/GrubSplash.tga

Overall the GNU GRUB 2 gives a nice feeling, it is stable on my Acer Aspire 4720z and when I boot up I get a nice 1024×768 background image (it is still unable to display a 1280×800 native resolution) and a nice and smooth font. The new GRUB is also slightly slower – you might notice a slight latency as the bootloader loads itself. In short, the new GRUB looks very promising and coupled with things like scripting support and real memory management one can guess how interesting the future will be.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

1 Comment »

 
 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>