|(5 intermediate revisions by 4 users not shown)|
History section' s phrasing is controversial. Let' s see if we can get this sorted out.
[[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.
, is : . . , that is .
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.
GRUB2 is a modular, multiboot-capable bootloader for many operating systems that can be used as a payload for coreboot.
- 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
$ ./configure --with-platform=coreboot
$ ./grub-mkimage -d . $modules -o ..../coreboot-v3/payload.elf --prefix='(ata0)/boot/grub'
See below about module selection.
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
How to help?
Contact the GRUB upstream mailing list for more information.