Difference between revisions of "Talk:GRUB2"

From coreboot
Jump to: navigation, search
(New page: History section's phrasing is controversial. Let's see if we can get this sorted out. == History == Patrick Georgi has been working on GRUB2 for coreboot during th...)
 
m
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
History section's phrasing is controversial. Let's see if we can get this sorted out.
+
'''[http://www.gnu.org/software/grub/ GRUB2]''' is a modular, multiboot-capable bootloader for many operating systems that can be used as a payload for coreboot.  
  
== History ==
+
== Status ==
  
[[User:PatrickGeorgi|Patrick Georgi]] has been working on GRUB2 for coreboot during the Google Summer of Code 2007. He made an [http://coreboot.org/~oxygene/lbgrub2-20070820-1.tar.bz2 original code submission] on August 20th 2007. If you care, there is [http://coreboot.org/~oxygene/lbgrub2-instructions.txt documentation on how to use it], but that work is based on a very old version of GRUB2.
+
* The mainline version of GRUB2 supports coreboot, and has a [http://grub.enbug.org/CoreBoot 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.
  
For various reasons, Robert Millan of the GRUB project did another original implementation, which got merged, so we moved our effort to their new code base and continued from there.
+
== How to build GRUB2 as a payload ==
 +
 
 +
It's recommended that you use the latest [https://savannah.gnu.org/svn/?group=grub 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 [http://www.sun.com/software/solaris/ Solaris])
 +
*linux: Loader for [http://www.kernel.org/ Linux] bzImages.
 +
*boot: Needed by all loaders.
 +
 
 +
You might also want to check the [http://grub.enbug.org/CommandList 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 ==
 +
 
 +
* [http://grub.enbug.org/USBSupport USB stack integration] (in progress).
 +
 
 +
== How to help? ==
 +
 
 +
Contact the GRUB upstream [mailto:grub-devel@gnu.org mailing list] for more information.

Latest revision as of 14:35, 26 September 2010

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.