GRUB Legacy: Difference between revisions

m
no edit summary
[unchecked revision][unchecked revision]
m (moved GRUB to GRUB Legacy over redirect: GRUB refers to the current release, not ancient releases. GRUB means the current release, GRUB Legacy means the old one.)
mNo edit summary
 
(8 intermediate revisions by 6 users not shown)
Line 1:
{{You}}
GRUB stands for GRand Unified Bootloader and is a [[bootloader]] and the reference implementation of the [[Multiboot|Multiboot Specification]]. GRUB can boot any Multiboot-compliant OS (e.g. Hurd, [http://grub.enbug.org/MultibootSystems among others]), however it can also boot some non-Multiboot-compliant OSes, e.g. Windows, via a chain-loading function, and some others via special support, e.g. Linux. mbchk can be used to determine if a file is Multiboot-compliant.
 
This article concentrates on GRUB Legacy. Information regarding modern [[GRUB 2]], a full rewrite, can be found in a separate article.
 
==Features==
Line 32 ⟶ 33:
Remove the boot disk from the floppy drive and insert the auxiliary disk. The files <code>stage1</code> and <code>stage2</code> from the GRUB distribution must be written to this disk, to sector 0 and sector 1+ respectively. In your shell (for Windows users, this means the [[Cygwin]] shell), type:
 
<sourcesyntaxhighlight lang="bash">
dd if=<stage1> of=/dev/fd0 bs=512 count=1
dd if=<stage2> of=/dev/fd0 bs=512 seek=1
</syntaxhighlight>
</source>
 
Now GRUB will be able to boot stage1 and stage2 from this disk. We cannot use it as our boot disk, though, since writing stage2 to sector 1 destroyed the floppy's format structure (you can't write files to the disk anymore, and any previously written <code>boot</code> directory could no longer be found). That's why we will now set up the other disk to boot GRUB and have a valid structure.
Line 44 ⟶ 45:
GRUB will boot into its command shell. (If your system does boot from hard drive instead, check your BIOS boot drive settings.) When the <code>grub ></code> prompt appears, remove the auxiliary disk from the drive and replace the boot disk. From the GRUB shell, you can now complete the installation on the boot disk:
 
<sourcesyntaxhighlight lang="bash">
install (fd0)/boot/stage1 (fd0) (fd0)/boot/stage2 (fd0)/boot/menu.cfg
</syntaxhighlight>
</source>
 
The parameters tell GRUB:
Line 73 ⟶ 74:
 
===Installing to USB===
'''UPDATE''': You may wish to look into [https://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-using-grub_002dinstall.html grub-install] if using GRUB2.
 
'''NOTE''': I have tried many tools to install GRUB onto a USB device under windows, however, I have not been able to figure out how. So, to install, either use a Linux distro on your PC of use a Linux Live CD.
 
Line 81 ⟶ 80:
If you need to mount your USB device: (Exchange <code>sdb1</code> with your device name.)
 
<sourcesyntaxhighlight lang="bash">
mkdir /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
</syntaxhighlight>
</source>
 
Create required directories:
 
<sourcesyntaxhighlight lang="bash">
mkdir /mnt/sdb1/boot
mkdir /mnt/sdb1/boot/grub
</syntaxhighlight>
</source>
 
Locate the <code>stage1</code>, <code>stage2</code>, and <code>*_stage1_5</code> files:
 
<sourcesyntaxhighlight lang="bash">
find / -name stage1
</syntaxhighlight>
</source>
 
Copy stage1 and stage2 files, <code>/usr/lib/grub/</code> is an example location, use the location returned by the find command:
 
<sourcesyntaxhighlight lang="bash">
cp /usr/lib/grub/stage1 /mnt/sdb1/boot/grub/stage1
cp /usr/lib/grub/stage2 /mnt/sdb1/boot/grub/stage2
</syntaxhighlight>
</source>
 
For FAT formatted USB device use:
 
<sourcesyntaxhighlight lang="bash">
cp /usr/lib/grub/fat_stage1_5 /mnt/sdb1/boot/grub/fat_stage1_5
</syntaxhighlight>
</source>
 
For ext2 formatted USB device use:
 
<sourcesyntaxhighlight lang="bash">
cp /usr/lib/grub/e2fs_stage_1_5 /mnt/sdb1/boot/grub/e2fs_stage_1_5
</syntaxhighlight>
</source>
 
Then execute the GRUB install application:
 
<sourcesyntaxhighlight lang="bash">
sudo grub
</syntaxhighlight>
</source>
 
Enter the following commands:
 
<sourcesyntaxhighlight lang="bash">
root (hd1,1)
setup (hd1)
quit
</syntaxhighlight>
</source>
if you don't know where your kernel is, you can use the command "find /boot/grub/e2fs_stage_1_5" to get the parameters which would be used in the command root (sdb1,1) and setup (sdb1).
 
Line 140 ⟶ 139:
 
==Load your kernel over network (TFTP)==
{{FirstPerson|section=1}}
You can also use GRUB's builtin network support to increase your build/test turn around time. You can boot another machine with a kernel directly from your build directory without having to copy it over manually. See also, [http://www.gnu.org/software/grub/manual/html_node/General-usage-of-network-support.html#General-usage-of-network-support How to set up your network] in the official GRUB manual.
 
Line 147:
Run
 
<sourcesyntaxhighlight lang="bash">
./configure --help
</syntaxhighlight>
</source>
 
to see a list of options. In my case, I use Netgear tulip cards, so I execute:
 
<sourcesyntaxhighlight lang="bash">
./configure --enable-tulip
make
make install
</syntaxhighlight>
</source>
 
You may want to consider using the <code>--prefix</code> option if you don't want to overwrite your existing GRUB install or do not have root access.
Line 205:
*[[Topic:9548|Switching back to real mode from GRUB]]
*[[Topic:9586|Setting boot-time graphic video mode with GRUB]]
*[[Topic:1744118255|GRUB VBE Patch]]
 
===External Links===
Line 214:
 
[[Category:Bootloaders]]
[[Category:GRUB]]
[[de:Grand Unified Bootloader]]