Typo
[linux_from_scratch_hints.git] / OLD / grub-howto.txt
blob2f90adc552068917f20779dbd8aab4078efd6cfa
1 TITLE:          GRUB-HOWTO
2 LFS VERSION:    Any
3 AUTHOR:         Fabio Fracassi <f.fracassi@gmx.net>
4                         Modified for GRUB 0.93 by Raphael J. Schmid <raphael@arrivingarrow.net>
6 SYNOPSIS:
7         GRUB is an alternative to LILO. This explains how to make it work.
9 HINT:
11 GRUB is the GNU GRand Unified Bootloader, a project which intends to solve all 
12 bootup problems once and for all.
14 One of the most interesting features, is that you don't have to install a new 
15 partition or kernel, you can change all parameters at boottime via the GRUB 
16 console, since it knows about the filesystems.
18 Required software
19   ftp://alpha.gnu.org/pub/gnu/grub/grub-0.93.tar.gz
20   http.us.debian.org/debian/pool/main/g/grub/grub_0.93+cvs20030224-2.diff.gz
21   
22 When you've downloaded all of the above sources, let's get to work.
23   
24   (1a) Extract GRUB itself:  tar -xvzf grub-0.93.tar.gz
25   (1b) Extract the patch:    gunzip grub_0.93+cvs20030224-2.diff.gz
26   
27   (2)  Apply the patch:      patch -Np1 -i grub_0.93+cvs20030224-2.diff
28   
29   (3)  Build GRUB (as root): 
30          ./configure --prefix=/usr \
31            && make all install      \
32            && mkdir /boot/grub      \
33            && cp /usr/share/grub/i386-pc/stage{1,2} /boot/grub
34        
35        If you want, you can copy one of the stage1_5 files as well. (More on 
36        that later).
37        
38   (4)  Starting GRUB
39   
40        Now there are two ways of going on. You can start the GRUB Console 
41        directly:
42          /sbin/grub
43        
44        Or via a floppy disk, after which you have to reboot:
45          cat /boot/grub/stage{1,2} >> /dev/fd0
47   (5)  Cofiguration
48   
49     First GRUB wants to know on which partition it is installed. Its way of 
50     naming them is a little differently than done Linux's:
51       (hd<BiosNr>,<PartitionNr>)
52       
53     For example: /dev/hda is (hd0), /dev/hda1 (hd0,0), /dev/hdb2 (hd1,1), and 
54     so forth. Hopefully you'll get the clue. Otherwise try 'man grub'/'info 
55     grub'.
57     If you dont know the partition you can issue on the GRUB console: 
58     'find /boot/grub/stage1'
59     
60     Next, you tell GRUB where it is installed: 'root (hd0,1)' (In this case, 
61     /dev/hda2)
63     Install GRUB in the master boot record of the drive you just specified: 
64     'setup (hd0)'
66     Your could start your system after a reboot now, using the command
67     'kernel (hd0,1)/boot/bzImage root=/dev/hda2'
69     There is the posibility to "teach" GRUB knowlage of the filesystem, that 
70     way GRUB doesn't need a block map for the stage2 file and is thus more 
71     robust against filesystem changes. This is archieved by means of the 
72     stage1_5 files:
73     
74     After issuing 
75       root (hd0,1)
76     type
77       embed /boot/grub/reiserfs_stage1_5 (hd0) # or e2fs_stage1_5
78     and note the number of sectors.
79     Now say
80       setup (hd0)
81     or 
82       install /boot/grub/stage1 (hd0)           \
83       (hd0)1+<number of sectors embed returned> \
84       p /boot/grub/stage2 /boot/grub/menu.lst
85     
86   (6) Installing a Bootmenu:
87   
88     Simply put a file named 'grub.conf' into the /boot/grub directory. Most 
89     GRUB Console commands can be used in that file -- check the info page!
91     Here is my setup for reference:
93     ---< snip >---
94     # File /boot/grub/menu.lst - Bootmenu definition
95     #
97     # Start Entry 0 by default
98     default 0
99     timeout 10
101     # makeing it nicer ;)
102     color green/black light-green/black
104     # If you have the Pixmap patch applied you can 
105     # define a Background Picture here
106     # The nice LFS image can be found at
107     # http://linuxfromscratch.org/~gerard/lfslogos/lfs-grub-splash.xpm
108     splashimage (hd0,1)/boot/grub/lfs-grub-splash.xpm
110     #German keyboard
111     setkey y z
112     setkey z y
113     setkey Y Z
114     setkey Z Y
115     setkey equal parenright
116     setkey parenright parenleft
117     setkey parenleft asterisk 
118     setkey doublequote at
119     setkey plus bracketright
120     setkey minus slash
121     setkey slash ampersand
122     setkey ampersand percent
123     setkey percent caret
124     setkey underscore question
125     setkey question underscore
126     setkey semicolon less
127     setkey less numbersign
128     setkey numbersign backslash
129     setkey colon greater
130     setkey greater bar
131     setkey asterisk braceright  
132   
133     #Standard Linux
134     title LFS-Linux 2.4
135     kernel (hd0,1)/boot/bzImage root=/dev/hda2
137     #Old Linux
138     title Old Suse Linux 6.4
139     kernel (hd1,0)/bzImage root=/dev/hdb2
141     #Windows 98
142     title Windows 98
143     chainloader (hd0,0)+1
145     #install grup
146     title (Re)Install grup
147     root (hd0,1)
148     embed /boot/grub/reiserfs_stage1_5
149     install /boot/grub/stage1 (hd0) (hd0)1+19 \
150     p /boot/grub/stage2 /boot/grub/menu.lst
151     ---< snap >---
152     
153 This hint should have given you an idea of how powerful a tool GRUB is, yet 
154 a very comfortable one to use. I don't know much more about GRUB than what 
155 I wrote here check the Documentation (especially 'info grub') for more 
156 information.
158 Thanks to:
159  - the German C't Magazin for their great article about GRUB
160  - Gerard Beekmans for creating Linux From Scratch
162 ChangeLog:
163  - Update: 08/May/2003 Raphael J. Schmid
164      Changed the hint to work with GRUB 0.93.
165      Also took the liberty of cleaning up formatting and wording a little,
166      although I'm not a native speaker either. Please bear with me :-)
167  - Update: 17/Apr/2002 Fabio Fracassi