GRUB: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
mNo edit summary
(Removed comment note, re IRC)
Line 37: Line 37:
You can create the <tt>core.img</tt> by typing the following in the terminal (assuming you already have either built GRUB2 or have it installed):
You can create the <tt>core.img</tt> by typing the following in the terminal (assuming you already have either built GRUB2 or have it installed):


<!--
grub-mkimage -c/path/to/config/file -ocore.img multiboot.mod
What does the -c option do? It doesn't seem to be documented.
-->
<source lang="bash">
<source lang="bash">
# This module is required to load a multiboot-compliant kernel; other modules are also available
# This module is required to load a multiboot-compliant kernel; other modules are also available

Revision as of 00:24, 25 February 2010

This page is a work in progress.
This page may thus be incomplete. Its content may be changed in the near future.

GRUB 2 is the GNU Project's next-generation bootloader. It has a more complete feature set than GRUB 0.97 (commonly referred to as "GRUB Legacy"). Still, all things considered, GRUB Legacy is more mature and most of the available documentation is for GRUB Legacy (hence the brief page).


History

GRUB 2 started its life as the PUPA (note the pun) research project and was rewritten from the ground up. Since then GRUB 2 (actually at time of update 1.97) has grown more stable and even hobby operating systems are starting to make use of the new bootloader instead of GRUB Legacy.

Features

  • Basic scripting support
  • GUI (better bootsplash support, custom colors, custom themes, ...)
  • Memory management
  • Cleaner design
  • Better portability
  • Internationalization
  • Rescue mode

Upgrading for GRUB Legacy

WARNING: These steps have not been tested very well yet. Use at your own risk!

Since GRUB 2 is very different from GRUB Legacy, the directions for getting your kernel up and running are different. This section gives you an overview of the process you need to go through when you want to have GRUB 2 load your kernel.


Since GRUB 2 itself is a multiboot-compliant kernel, you can start it in GRUB Legacy by simply adding the following to your current GRUB Legacy config:

title GRUB2
kernel /boot/core.img   # This is the GRUB 2 kernel binary; you must copy it to your disk image first!
boot


You can create the core.img by typing the following in the terminal (assuming you already have either built GRUB2 or have it installed):

# This module is required to load a multiboot-compliant kernel; other modules are also available
grub-mkimage -p /boot -o core.img multiboot.mod

# NOTE: Modules such as multiboot.mod are different to the modules GRUB2 loads for your kernel!


Here's a sample configuration file (NOTE: This file should be placed into the /boot folder of your disk image, and be named grub.cfg):

menuentry "My OS Name here" {
  multiboot /boot/kernel-file   # The multiboot command replaces the kernel command
  boot
}

That's it. Copy these files to a disk image, pop it in an emulator, and you're finished!

See Also

External Links