Talk:GRUB2

From coreboot
Revision as of 14:35, 26 September 2010 by Uwe (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GRUB2 is a modular, multiboot-capable bootloader for many operating systems that can be used as a payload for coreboot.

Status

  • The mainline version of GRUB2 supports coreboot, and has a wiki page on the coreboot port.
  • A derivative version of GRUB2, specially targetted at use with coreboot, is available in our monotone repository (Update: no longer available). It includes additional features not yet present in official GRUB, such as USB or Crypto support. Note, however, that this branch has been declared stable and is no longer under heavy development.

How to build GRUB2 as a payload

It's recommended that you use the latest SVN version of GRUB, since coreboot support is being actively developed and evolves rapidly.

$ svn co svn://svn.savannah.gnu.org/grub/trunk/grub2
$ ./autogen.sh
$ ./configure --with-platform=coreboot
$ make
$ ./grub-mkimage -d . $modules -o ..../coreboot-v3/payload.elf --prefix='(ata0)/boot/grub'

See below about module selection.

GRUB2 modules

GRUB2 is a modular system, you can include whichever modules you need into the image. A few noteworthy ones are:

  • normal, ls, cat, help: These make the user interface more complete/usable.
  • ext2, iso9660, reiserfs, xfs, fat: Commonly used filesystems.
  • pc, gpt: Commonly used partition maps.
  • ata: Driver for ATA / ATAPI disks.
  • serial: Driver for serial terminal.
  • memdisk: Allows you to embed a virtual disk into the GRUB image (see below)
  • multiboot: Loader for Multiboot kernels (such as the kernel of NetBSD or Solaris)
  • linux: Loader for Linux bzImages.
  • boot: Needed by all loaders.

You might also want to check the full list of available modules in GRUB2.

Building a memdisk image

Build your memory disk using your preferred filesystem. For example, tar. Then load the memdisk module, and include the image in your build.

$ tar -cf memdisk.tar my-dir
$ grub-mkimage .... memdisk cpio -m memdisk.tar

GRUB will automaticaly use the the memdisk for finding modules and the grub.cfg file.

Hints and Tricks

Loading grub.cfg from disk

It is suggested that grub.cfg is contained in a memdisk/tar image. This grub.cfg can be used to load other configuration files from any mass storage media. If you want to load a grub.cfg from the first device that contains one, your in-flash grub.cfg can look like this:

search -f -s /grub.cfg
configfile /grub.cfg

To Do

How to help?

Contact the GRUB upstream mailing list for more information.