GRUB - GRand Unified Boot loader
It is the boot loader that takes over control from System BIOS and loads the Operating system Kernel(eg : Linux)
System BIOS -> MBR(Grub
Stage1) ->Stage 1.5/2 (in Filesystem)- OS kernel
Stage 1 loads only the first sector of Stage 2 (or Stage 1.5) and Stage 2 itself loads the rest.
The flow of Stage 1 is:
1. Initialize the system briefly.
2. Detect the geometry and the accessing mode of the loading drive.
3. Load the first sector of Stage 2.
4. Jump to the starting address of the Stage 2.
The flow of Stage 2 (and Stage 1.5) is:
1. Load the rest of itself to the real starting address, that is, the starting address plus 512 bytes. The block lists are stored in the last part of the first sector.
2. Long jump to the real starting address.
Stage1 has the The details of stage2 embedded in it and
Stage2 has the saved entry number of the kernel embedded in it
To test n th kernel stanza only for onetime;A reboot will load the default one specified in grub.conf/menu.lst:
grub
savedefault --default=n --once
quit
To automatically reboot after n seconds in case of kernel panic:
vi /boot/grub/grub.conf
kernel /vmlinuz-2.6.15-23-386 root=/dev/hda5 panic=n
Booting fallback kernel:
Here A is the kernel to be tested and B is something you are confident will work
edit /boot/grub/grub.conf
default saved # This is important!
timeout 10
fallback 1 # This is important!
title A
root (hd1,0)
kernel /kernel-2.6.7 panic=10
savedefault fallback # This is important!
title B
root (hd2,0)
kernel /kernel-2.6.5
savedefault
Now set the default kernel to be entry 0
grub
savedefault --default=0
quit
On Fail
If the kernel fails the default kernel will be incremented to 1 and therefore revert to the old kernel. This will be done next reboot.
On Success
If the kernel is successful you should have nothing to worry about. But next reboot it will still fallback to the old kernel, so you can now re-edit your config or set grub stanza to be booted by savedefault again
Install GRUB(native method):
Caution: Installing GRUB's stage1 in this manner will erase the normal boot-sector used by an OS.
GRUB can currently boot GNU Mach, Linux,
FreeBSD,
NetBSD, and
OpenBSD directly, so using it on a boot sector (the first sector of a partition) should be okay. But generally, it would be a good idea to back up the first sector of the partition on which you are installing GRUB's stage1. This isn't as important if you are installing GRUB on the first sector of a hard disk, since it's easy to reinitialize it (e.g. by running `FDISK /MBR' from DOS).
If you decide to install GRUB in the native environment, which is definitely desirable, you'll need to create a GRUB boot disk, and reboot your computer with it.
Once started, GRUB will show the command-line interface First, set the GRUB's root device1 to the partition containing the boot directory, like this:
grub> root (hd0,0)
If you are not sure which partition actually holds this directory, use the command find (see find), like this:
grub> find /boot/grub/stage1
This will search for the file name /boot/grub/stage1 and show the devices which contain the file.
Once you've set the root device correctly, run the command setup
grub> setup (hd0)
This command will install the GRUB boot loader on the Master Boot Record (MBR) of the first drive. If you want to put GRUB into the boot sector of a partition instead of putting it in the MBR, specify the partition into which you want to install GRUB:
grub> setup (hd0,0)
If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader.
There are no comments on this page. [Add comment]