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