1This is grub.info, produced by makeinfo version 4.0 from grub.texi.
2
3INFO-DIR-SECTION Kernel
4START-INFO-DIR-ENTRY
5* GRUB: (grub).                 The GRand Unified Bootloader
6* grub-install: (grub)Invoking grub-install.    Install GRUB on your drive
7* grub-md5-crypt: (grub)Invoking grub-md5-crypt.        Encrypt a password
8                                                        in MD5 format
9* grub-terminfo: (grub)Invoking grub-terminfo.  Generate a terminfo
10                                                command from a
11                                                terminfo name
12* grub-set-default: (grub)Invoking grub-set-default.    Set a default boot
13                                                        entry
14* mbchk: (grub)Invoking mbchk.  Check for the format of a Multiboot kernel
15END-INFO-DIR-ENTRY
16
17   Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
18
19   Permission is granted to make and distribute verbatim copies of this
20manual provided the copyright notice and this permission notice are
21preserved on all copies.
22
23   Permission is granted to copy and distribute modified versions of
24this manual under the conditions for verbatim copying, provided also
25that the entire resulting derived work is distributed under the terms
26of a permission notice identical to this one.
27
28   Permission is granted to copy and distribute translations of this
29manual into another language, under the above conditions for modified
30versions.
31
32
33File: grub.info,  Node: Bootstrap tricks,  Next: I/O ports detection,  Prev: Command interface,  Up: Internals
34
35The bootstrap mechanism used in GRUB
36====================================
37
38   The disk space can be used in a boot loader is very restricted
39because a MBR (*note MBR::) is only 512 bytes but it also contains a
40partition table (*note Partition table::) and a BPB. So the question is
41how to make a boot loader code enough small to be fit in a MBR.
42
43   However, GRUB is a very large program, so we break GRUB into 2 (or 3)
44distinct components, "Stage 1" and "Stage 2" (and optionally "Stage
451.5"). *Note Memory map::, for more information.
46
47   We embed Stage 1 in a MBR or in the boot sector of a partition, and
48place Stage 2 in a filesystem. The optional Stage 1.5 can be installed
49in a filesystem, in the "boot loader" area in a FFS or a ReiserFS, and
50in the sectors right after a MBR, because Stage 1.5 is enough small and
51the sectors right after a MBR is normally an unused region. The size of
52this region is the number of sectors per head minus 1.
53
54   Thus, all Stage1 must do is just load Stage2 or Stage1.5. But even if
55Stage 1 needs not to support the user interface or the filesystem
56interface, it is impossible to make Stage 1 less than 400 bytes, because
57GRUB should support both the CHS mode and the LBA mode (*note Low-level
58disk I/O::).
59
60   The solution used by GRUB is that Stage 1 loads only the first
61sector of Stage 2 (or Stage 1.5) and Stage 2 itself loads the rest. The
62flow of Stage 1 is:
63
64  1. Initialize the system briefly.
65
66  2. Detect the geometry and the accessing mode of the "loading drive".
67
68  3. Load the first sector of Stage 2.
69
70  4. Jump to the starting address of the Stage 2.
71
72   The flow of Stage 2 (and Stage 1.5) is:
73
74  1. Load the rest of itself to the real starting address, that is, the
75     starting address plus 512 bytes. The block lists are stored in the
76     last part of the first sector.
77
78  2. Long jump to the real starting address.
79
80   Note that Stage 2 (or Stage 1.5) does not probe the geometry or the
81accessing mode of the "loading drive", since Stage 1 has already probed
82them.
83
84
85File: grub.info,  Node: I/O ports detection,  Next: Memory detection,  Prev: Bootstrap tricks,  Up: Internals
86
87How to probe I/O ports used by INT 13H
88======================================
89
90   FIXME: I will write this chapter after implementing the new
91technique.
92
93
94File: grub.info,  Node: Memory detection,  Next: Low-level disk I/O,  Prev: I/O ports detection,  Up: Internals
95
96How to detect all installed RAM
97===============================
98
99   FIXME: I doubt if Erich didn't write this chapter only himself
100wholly, so I will rewrite this chapter.
101
102
103File: grub.info,  Node: Low-level disk I/O,  Next: MBR,  Prev: Memory detection,  Up: Internals
104
105INT 13H disk I/O interrupts
106===========================
107
108   FIXME: I'm not sure where some part of the original chapter is
109derived, so I will rewrite this chapter.
110
111
112File: grub.info,  Node: MBR,  Next: Partition table,  Prev: Low-level disk I/O,  Up: Internals
113
114The structure of Master Boot Record
115===================================
116
117   FIXME: Likewise.
118
119
120File: grub.info,  Node: Partition table,  Next: Submitting patches,  Prev: MBR,  Up: Internals
121
122The format of partition tables
123==============================
124
125   FIXME: Probably the original chapter is derived from "How It Works",
126so I will rewrite this chapter.
127
128
129File: grub.info,  Node: Submitting patches,  Prev: Partition table,  Up: Internals
130
131Where and how you should send patches
132=====================================
133
134   When you write patches for GRUB, please send them to the mailing list
135<bug-grub@gnu.org>. Here is the list of items of which you should take
136care:
137
138   * Please make your patch as small as possible. Generally, it is not
139     a good thing to make one big patch which changes many things.
140     Instead, segregate features and produce many patches.
141
142   * Use as late code as possible, for the original code. The CVS
143     repository always has the current version (*note Obtaining and
144     Building GRUB::).
145
146   * Write ChangeLog entries. *Note Change Logs: (standards)Change
147     Logs, if you don't know how to write ChangeLog.
148
149   * Make patches in unified diff format. `diff -urN' is appropriate in
150     most cases.
151
152   * Don't make patches reversely. Reverse patches are difficult to
153     read and use.
154
155   * Be careful enough of the license term and the copyright. Because
156     GRUB is under GNU General Public License, you may not steal code
157     from software whose license is incompatible against GPL. And, if
158     you copy code written by others, you must not ignore their
159     copyrights. Feel free to ask GRUB maintainers, whenever you are
160     not sure what you should do.
161
162   * If your patch is too large to send in e-mail, put it at somewhere
163     we can see. Usually, you shouldn't send e-mail over 20K.
164
165
166File: grub.info,  Node: Index,  Prev: Internals,  Up: Top
167
168Index
169*****
170
171* Menu:
172
173* blocklist:                             blocklist.
174* boot:                                  boot.
175* bootp:                                 bootp.
176* cat:                                   cat.
177* chainloader:                           chainloader.
178* cmp:                                   cmp.
179* color:                                 color.
180* configfile:                            configfile.
181* current_drive:                         Filesystem interface.
182* current_partition:                     Filesystem interface.
183* current_slice:                         Filesystem interface.
184* debug:                                 debug.
185* default:                               default.
186* device:                                device.
187* devread:                               Filesystem interface.
188* dhcp:                                  dhcp.
189* disk_read_func:                        Filesystem interface.
190* displayapm:                            displayapm.
191* displaymem:                            displaymem.
192* embed:                                 embed.
193* fallback:                              fallback.
194* filemax:                               Filesystem interface.
195* filepos:                               Filesystem interface.
196* find:                                  find.
197* fstest:                                fstest.
198* FSYS_BUF:                              Filesystem interface.
199* geometry:                              geometry.
200* grub_read:                             Filesystem interface.
201* halt:                                  halt.
202* help:                                  help.
203* hiddenmenu:                            hiddenmenu.
204* hide:                                  hide.
205* ifconfig:                              ifconfig.
206* impsprobe:                             impsprobe.
207* initrd:                                initrd.
208* install:                               install.
209* ioprobe:                               ioprobe.
210* kernel:                                kernel.
211* lock:                                  lock.
212* makeactive:                            makeactive.
213* map:                                   map.
214* md5crypt:                              md5crypt.
215* module:                                module.
216* modulenounzip:                         modulenounzip.
217* pager:                                 pager.
218* part_length:                           Filesystem interface.
219* part_start:                            Filesystem interface.
220* partnew:                               partnew.
221* parttype:                              parttype.
222* password:                              password.
223* pause:                                 pause.
224* print_a_completion:                    Filesystem interface.
225* print_possibilities:                   Filesystem interface.
226* quit:                                  quit.
227* rarp:                                  rarp.
228* read:                                  read.
229* reboot:                                reboot.
230* root:                                  root.
231* rootnoverify:                          rootnoverify.
232* saved_drive:                           Filesystem interface.
233* saved_partition:                       Filesystem interface.
234* savedefault:                           savedefault.
235* serial:                                serial.
236* setkey:                                setkey.
237* setup:                                 setup.
238* terminal:                              terminal.
239* terminfo:                              terminfo.
240* testload:                              testload.
241* testvbe:                               testvbe.
242* tftpserver:                            tftpserver.
243* timeout:                               timeout.
244* title:                                 title.
245* unhide:                                unhide.
246* uppermem:                              uppermem.
247* vbeprobe:                              vbeprobe.
248
249
250