GRUB Legacy: Difference between revisions

m
no edit summary
[unchecked revision][unchecked revision]
(Referenced GRUB error 13 page.)
mNo edit summary
 
(41 intermediate revisions by 20 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]], hasa notfull beenrewrite, finalizedcan atbe thefound timein ofa writing.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===
'''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.
 
Putting GRUB onto a USB device is as easy as following the above example of installing to a standard hard disk. There is one extra step involved, finding out under which mount point youyour USB device is located. You may even have to mount it yourself if it is not already mounted. To install use the following steps:
 
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_stage_1_5fat_stage1_5 /mnt/sdb1/boot/grub/fat_stage_1_5fat_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 (sdb1hd1,1)
setup (sdb1hd1)
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).
 
===Installing to hard disk===
Line 137 ⟶ 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 144 ⟶ 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 194 ⟶ 197:
===Wiki Pages===
*[[Grub Error 13]]
*[[Multiboot]]
 
===Tutorials===
Line 201 ⟶ 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===
*[http://grub.enbug.org/ GRUB wiki]
*[http://tldp.org/HOWTO/Linux+Win9x+Grub-HOWTO/index.html Linux+Win9x+Grub HOWTO]
*[http://promote-opensource.org/modules/mylinks/singlelink.php?cid=14&lid=94 Linux Recovery and Boot Disk Creation with Grub]
*[http://www.skyjammer.com/files/knoppix/ Win32 GRUB]
*[http://www.ameritech.net/users/gholmer/booting.html Booting with GRUB]
*[http://grub4dos.sourceforge.net/ WinGRUB]
*[http://www.geocities.com/lode_leroy/grubinstall/ Grub installer for Windows]
*[http://grub.linuxeden.com/ GRUB for DOS]
*[http://www.pixelbeat.org/docs/disk/ GRUB PC Disk details]
*[http://www.gnu.org/software/grub/manual/legacy/grub.html GRUB Legacy manual]
*[httphttps://grubgna.linuxeden.comorg/projects/grub4dos/ GRUB for DOS]
 
[[Category:Bootloaders]]
[[Category:GRUB]]
[[de:Grand Unified Bootloader]]