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: install, Next: ioprobe, Prev: initrd, Up: Command-line and menu entry commands 34*1b8adde7SWilliam Kucharski 35*1b8adde7SWilliam Kucharskiinstall 36*1b8adde7SWilliam Kucharski------- 37*1b8adde7SWilliam Kucharski 38*1b8adde7SWilliam Kucharski - Command: install [`--force-lba'] [`--stage2=os_stage2_file'] 39*1b8adde7SWilliam Kucharski stage1_file [`d'] dest_dev stage2_file [addr] [`p'] 40*1b8adde7SWilliam Kucharski [config_file] [real_config_file] 41*1b8adde7SWilliam Kucharski This command is fairly complex, and you should not use this command 42*1b8adde7SWilliam Kucharski unless you are familiar with GRUB. Use `setup' (*note setup::) 43*1b8adde7SWilliam Kucharski instead. 44*1b8adde7SWilliam Kucharski 45*1b8adde7SWilliam Kucharski In short, it will perform a full install presuming the Stage 2 or 46*1b8adde7SWilliam Kucharski Stage 1.5(1) (*note install-Footnote-1::) is in its final install 47*1b8adde7SWilliam Kucharski location. 48*1b8adde7SWilliam Kucharski 49*1b8adde7SWilliam Kucharski In slightly more detail, it will load STAGE1_FILE, validate that 50*1b8adde7SWilliam Kucharski it is a GRUB Stage 1 of the right version number, install in it a 51*1b8adde7SWilliam Kucharski blocklist for loading STAGE2_FILE as a Stage 2. If the option `d' 52*1b8adde7SWilliam Kucharski is present, the Stage 1 will always look for the actual disk 53*1b8adde7SWilliam Kucharski STAGE2_FILE was installed on, rather than using the booting drive. 54*1b8adde7SWilliam Kucharski The Stage 2 will be loaded at address ADDR, which must be `0x8000' 55*1b8adde7SWilliam Kucharski for a true Stage 2, and `0x2000' for a Stage 1.5. If ADDR is not 56*1b8adde7SWilliam Kucharski present, GRUB will determine the address automatically. It then 57*1b8adde7SWilliam Kucharski writes the completed Stage 1 to the first block of the device 58*1b8adde7SWilliam Kucharski DEST_DEV. If the options `p' or CONFIG_FILE are present, then it 59*1b8adde7SWilliam Kucharski reads the first block of stage2, modifies it with the values of 60*1b8adde7SWilliam Kucharski the partition STAGE2_FILE was found on (for `p') or places the 61*1b8adde7SWilliam Kucharski string CONFIG_FILE into the area telling the stage2 where to look 62*1b8adde7SWilliam Kucharski for a configuration file at boot time. Likewise, if 63*1b8adde7SWilliam Kucharski REAL_CONFIG_FILE is present and STAGE2_FILE is a Stage 1.5, then 64*1b8adde7SWilliam Kucharski the Stage 2 CONFIG_FILE is patched with the configuration file 65*1b8adde7SWilliam Kucharski name REAL_CONFIG_FILE. This command preserves the DOS BPB (and for 66*1b8adde7SWilliam Kucharski hard disks, the partition table) of the sector the Stage 1 is to 67*1b8adde7SWilliam Kucharski be installed into. 68*1b8adde7SWilliam Kucharski 69*1b8adde7SWilliam Kucharski *Caution:* Several buggy BIOSes don't pass a booting drive 70*1b8adde7SWilliam Kucharski properly when booting from a hard disk drive. Therefore, you will 71*1b8adde7SWilliam Kucharski unfortunately have to specify the option `d', whether your Stage2 72*1b8adde7SWilliam Kucharski resides at the booting drive or not, if you have such a BIOS. We 73*1b8adde7SWilliam Kucharski know these are defective in this way: 74*1b8adde7SWilliam Kucharski 75*1b8adde7SWilliam Kucharski 76*1b8adde7SWilliam Kucharski Fujitsu LifeBook 400 BIOS version 31J0103A 77*1b8adde7SWilliam Kucharski 78*1b8adde7SWilliam Kucharski 79*1b8adde7SWilliam Kucharski HP Vectra XU 6/200 BIOS version GG.06.11 80*1b8adde7SWilliam Kucharski 81*1b8adde7SWilliam Kucharski *Caution2:* A number of BIOSes don't return a correct LBA support 82*1b8adde7SWilliam Kucharski bitmap even if they do have the support. So GRUB provides a 83*1b8adde7SWilliam Kucharski solution to ignore the wrong bitmap, that is, the option 84*1b8adde7SWilliam Kucharski `--force-lba'. Don't use this option if you know that your BIOS 85*1b8adde7SWilliam Kucharski doesn't have LBA support. 86*1b8adde7SWilliam Kucharski 87*1b8adde7SWilliam Kucharski *Caution3:* You must specify the option `--stage2' in the grub 88*1b8adde7SWilliam Kucharski shell, if you cannot unmount the filesystem where your stage2 file 89*1b8adde7SWilliam Kucharski resides. The argument should be the file name in your operating 90*1b8adde7SWilliam Kucharski system. 91*1b8adde7SWilliam Kucharski 92*1b8adde7SWilliam Kucharski 93*1b8adde7SWilliam KucharskiFile: grub.info, Node: install-Footnotes, Up: install 94*1b8adde7SWilliam Kucharski 95*1b8adde7SWilliam Kucharski (1) They're loaded the same way, so we will refer to the Stage 1.5 96*1b8adde7SWilliam Kucharskias a Stage 2 from now on. 97*1b8adde7SWilliam Kucharski 98*1b8adde7SWilliam Kucharski 99*1b8adde7SWilliam KucharskiFile: grub.info, Node: ioprobe, Next: kernel, Prev: install, Up: Command-line and menu entry commands 100*1b8adde7SWilliam Kucharski 101*1b8adde7SWilliam Kucharskiioprobe 102*1b8adde7SWilliam Kucharski------- 103*1b8adde7SWilliam Kucharski 104*1b8adde7SWilliam Kucharski - Command: ioprobe drive 105*1b8adde7SWilliam Kucharski Probe I/O ports used for the drive DRIVE. This command will list 106*1b8adde7SWilliam Kucharski the I/O ports on the screen. For technical information, *Note 107*1b8adde7SWilliam Kucharski Internals::. 108*1b8adde7SWilliam Kucharski 109*1b8adde7SWilliam Kucharski 110*1b8adde7SWilliam KucharskiFile: grub.info, Node: kernel, Next: lock, Prev: ioprobe, Up: Command-line and menu entry commands 111*1b8adde7SWilliam Kucharski 112*1b8adde7SWilliam Kucharskikernel 113*1b8adde7SWilliam Kucharski------ 114*1b8adde7SWilliam Kucharski 115*1b8adde7SWilliam Kucharski - Command: kernel [`--type=type'] [`--no-mem-option'] file ... 116*1b8adde7SWilliam Kucharski Attempt to load the primary boot image (Multiboot a.out or ELF, 117*1b8adde7SWilliam Kucharski Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from 118*1b8adde7SWilliam Kucharski FILE. The rest of the line is passed verbatim as the "kernel 119*1b8adde7SWilliam Kucharski command-line". Any modules must be reloaded after using this 120*1b8adde7SWilliam Kucharski command. 121*1b8adde7SWilliam Kucharski 122*1b8adde7SWilliam Kucharski This command also accepts the option `--type' so that you can 123*1b8adde7SWilliam Kucharski specify the kernel type of FILE explicitly. The argument TYPE must 124*1b8adde7SWilliam Kucharski be one of these: `netbsd', `freebsd', `openbsd', `linux', 125*1b8adde7SWilliam Kucharski `biglinux', and `multiboot'. However, you need to specify it only 126*1b8adde7SWilliam Kucharski if you want to load a NetBSD ELF kernel, because GRUB can 127*1b8adde7SWilliam Kucharski automatically determine a kernel type in the other cases, quite 128*1b8adde7SWilliam Kucharski safely. 129*1b8adde7SWilliam Kucharski 130*1b8adde7SWilliam Kucharski The option `--no-mem-option' is effective only for Linux. If the 131*1b8adde7SWilliam Kucharski option is specified, GRUB doesn't pass the option `mem=' to the 132*1b8adde7SWilliam Kucharski kernel. This option is implied for Linux kernels 2.4.18 and newer. 133*1b8adde7SWilliam Kucharski 134*1b8adde7SWilliam Kucharski 135*1b8adde7SWilliam KucharskiFile: grub.info, Node: lock, Next: makeactive, Prev: kernel, Up: Command-line and menu entry commands 136*1b8adde7SWilliam Kucharski 137*1b8adde7SWilliam Kucharskilock 138*1b8adde7SWilliam Kucharski---- 139*1b8adde7SWilliam Kucharski 140*1b8adde7SWilliam Kucharski - Command: lock 141*1b8adde7SWilliam Kucharski Prevent normal users from executing arbitrary menu entries. You 142*1b8adde7SWilliam Kucharski must use the command `password' if you really want this command to 143*1b8adde7SWilliam Kucharski be useful (*note password::). 144*1b8adde7SWilliam Kucharski 145*1b8adde7SWilliam Kucharski This command is used in a menu, as shown in this example: 146*1b8adde7SWilliam Kucharski 147*1b8adde7SWilliam Kucharski title This entry is too dangerous to be executed by normal users 148*1b8adde7SWilliam Kucharski lock 149*1b8adde7SWilliam Kucharski root (hd0,a) 150*1b8adde7SWilliam Kucharski kernel /no-security-os 151*1b8adde7SWilliam Kucharski 152*1b8adde7SWilliam Kucharski See also *Note Security::. 153*1b8adde7SWilliam Kucharski 154*1b8adde7SWilliam Kucharski 155*1b8adde7SWilliam KucharskiFile: grub.info, Node: makeactive, Next: map, Prev: lock, Up: Command-line and menu entry commands 156*1b8adde7SWilliam Kucharski 157*1b8adde7SWilliam Kucharskimakeactive 158*1b8adde7SWilliam Kucharski---------- 159*1b8adde7SWilliam Kucharski 160*1b8adde7SWilliam Kucharski - Command: makeactive 161*1b8adde7SWilliam Kucharski Set the active partition on the root disk to GRUB's root device. 162*1b8adde7SWilliam Kucharski This command is limited to _primary_ PC partitions on a hard disk. 163*1b8adde7SWilliam Kucharski 164*1b8adde7SWilliam Kucharski 165*1b8adde7SWilliam KucharskiFile: grub.info, Node: map, Next: md5crypt, Prev: makeactive, Up: Command-line and menu entry commands 166*1b8adde7SWilliam Kucharski 167*1b8adde7SWilliam Kucharskimap 168*1b8adde7SWilliam Kucharski--- 169*1b8adde7SWilliam Kucharski 170*1b8adde7SWilliam Kucharski - Command: map to_drive from_drive 171*1b8adde7SWilliam Kucharski Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary 172*1b8adde7SWilliam Kucharski when you chain-load some operating systems, such as DOS, if such 173*1b8adde7SWilliam Kucharski an OS resides at a non-first drive. Here is an example: 174*1b8adde7SWilliam Kucharski 175*1b8adde7SWilliam Kucharski grub> map (hd0) (hd1) 176*1b8adde7SWilliam Kucharski grub> map (hd1) (hd0) 177*1b8adde7SWilliam Kucharski 178*1b8adde7SWilliam Kucharski The example exchanges the order between the first hard disk and the 179*1b8adde7SWilliam Kucharski second hard disk. See also *Note DOS/Windows::. 180*1b8adde7SWilliam Kucharski 181*1b8adde7SWilliam Kucharski 182*1b8adde7SWilliam KucharskiFile: grub.info, Node: md5crypt, Next: module, Prev: map, Up: Command-line and menu entry commands 183*1b8adde7SWilliam Kucharski 184*1b8adde7SWilliam Kucharskimd5crypt 185*1b8adde7SWilliam Kucharski-------- 186*1b8adde7SWilliam Kucharski 187*1b8adde7SWilliam Kucharski - Command: md5crypt 188*1b8adde7SWilliam Kucharski Prompt to enter a password, and encrypt it in MD5 format. The 189*1b8adde7SWilliam Kucharski encrypted password can be used with the command `password' (*note 190*1b8adde7SWilliam Kucharski password::). See also *Note Security::. 191*1b8adde7SWilliam Kucharski 192*1b8adde7SWilliam Kucharski 193*1b8adde7SWilliam KucharskiFile: grub.info, Node: module, Next: modulenounzip, Prev: md5crypt, Up: Command-line and menu entry commands 194*1b8adde7SWilliam Kucharski 195*1b8adde7SWilliam Kucharskimodule 196*1b8adde7SWilliam Kucharski------ 197*1b8adde7SWilliam Kucharski 198*1b8adde7SWilliam Kucharski - Command: module file ... 199*1b8adde7SWilliam Kucharski Load a boot module FILE for a Multiboot format boot image (no 200*1b8adde7SWilliam Kucharski interpretation of the file contents are made, so the user of this 201*1b8adde7SWilliam Kucharski command must know what the kernel in question expects). The rest 202*1b8adde7SWilliam Kucharski of the line is passed as the "module command-line", like the 203*1b8adde7SWilliam Kucharski `kernel' command. You must load a Multiboot kernel image before 204*1b8adde7SWilliam Kucharski loading any module. See also *Note modulenounzip::. 205*1b8adde7SWilliam Kucharski 206*1b8adde7SWilliam Kucharski 207*1b8adde7SWilliam KucharskiFile: grub.info, Node: modulenounzip, Next: pause, Prev: module, Up: Command-line and menu entry commands 208*1b8adde7SWilliam Kucharski 209*1b8adde7SWilliam Kucharskimodulenounzip 210*1b8adde7SWilliam Kucharski------------- 211*1b8adde7SWilliam Kucharski 212*1b8adde7SWilliam Kucharski - Command: modulenounzip file ... 213*1b8adde7SWilliam Kucharski The same as `module' (*note module::), except that automatic 214*1b8adde7SWilliam Kucharski decompression is disabled. 215*1b8adde7SWilliam Kucharski 216*1b8adde7SWilliam Kucharski 217*1b8adde7SWilliam KucharskiFile: grub.info, Node: pause, Next: quit, Prev: modulenounzip, Up: Command-line and menu entry commands 218*1b8adde7SWilliam Kucharski 219*1b8adde7SWilliam Kucharskipause 220*1b8adde7SWilliam Kucharski----- 221*1b8adde7SWilliam Kucharski 222*1b8adde7SWilliam Kucharski - Command: pause message ... 223*1b8adde7SWilliam Kucharski Print the MESSAGE, then wait until a key is pressed. Note that 224*1b8adde7SWilliam Kucharski placing <^G> (ASCII code 7) in the message will cause the speaker 225*1b8adde7SWilliam Kucharski to emit the standard beep sound, which is useful when prompting 226*1b8adde7SWilliam Kucharski the user to change floppies. 227*1b8adde7SWilliam Kucharski 228*1b8adde7SWilliam Kucharski 229*1b8adde7SWilliam KucharskiFile: grub.info, Node: quit, Next: reboot, Prev: pause, Up: Command-line and menu entry commands 230*1b8adde7SWilliam Kucharski 231*1b8adde7SWilliam Kucharskiquit 232*1b8adde7SWilliam Kucharski---- 233*1b8adde7SWilliam Kucharski 234*1b8adde7SWilliam Kucharski - Command: quit 235*1b8adde7SWilliam Kucharski Exit from the grub shell `grub' (*note Invoking the grub shell::). 236*1b8adde7SWilliam Kucharski This command can be used only in the grub shell. 237*1b8adde7SWilliam Kucharski 238*1b8adde7SWilliam Kucharski 239*1b8adde7SWilliam KucharskiFile: grub.info, Node: reboot, Next: read, Prev: quit, Up: Command-line and menu entry commands 240*1b8adde7SWilliam Kucharski 241*1b8adde7SWilliam Kucharskireboot 242*1b8adde7SWilliam Kucharski------ 243*1b8adde7SWilliam Kucharski 244*1b8adde7SWilliam Kucharski - Command: reboot 245*1b8adde7SWilliam Kucharski Reboot the computer. 246*1b8adde7SWilliam Kucharski 247*1b8adde7SWilliam Kucharski 248*1b8adde7SWilliam KucharskiFile: grub.info, Node: read, Next: root, Prev: reboot, Up: Command-line and menu entry commands 249*1b8adde7SWilliam Kucharski 250*1b8adde7SWilliam Kucharskiread 251*1b8adde7SWilliam Kucharski---- 252*1b8adde7SWilliam Kucharski 253*1b8adde7SWilliam Kucharski - Command: read addr 254*1b8adde7SWilliam Kucharski Read a 32-bit value from memory at address ADDR and display it in 255*1b8adde7SWilliam Kucharski hex format. 256*1b8adde7SWilliam Kucharski 257*1b8adde7SWilliam Kucharski 258*1b8adde7SWilliam KucharskiFile: grub.info, Node: root, Next: rootnoverify, Prev: read, Up: Command-line and menu entry commands 259*1b8adde7SWilliam Kucharski 260*1b8adde7SWilliam Kucharskiroot 261*1b8adde7SWilliam Kucharski---- 262*1b8adde7SWilliam Kucharski 263*1b8adde7SWilliam Kucharski - Command: root device [hdbias] 264*1b8adde7SWilliam Kucharski Set the current "root device" to the device DEVICE, then attempt 265*1b8adde7SWilliam Kucharski to mount it to get the partition size (for passing the partition 266*1b8adde7SWilliam Kucharski descriptor in `ES:ESI', used by some chain-loaded boot loaders), 267*1b8adde7SWilliam Kucharski the BSD drive-type (for booting BSD kernels using their native 268*1b8adde7SWilliam Kucharski boot format), and correctly determine the PC partition where a BSD 269*1b8adde7SWilliam Kucharski sub-partition is located. The optional HDBIAS parameter is a 270*1b8adde7SWilliam Kucharski number to tell a BSD kernel how many BIOS drive numbers are on 271*1b8adde7SWilliam Kucharski controllers before the current one. For example, if there is an 272*1b8adde7SWilliam Kucharski IDE disk and a SCSI disk, and your FreeBSD root partition is on 273*1b8adde7SWilliam Kucharski the SCSI disk, then use a `1' for HDBIAS. 274*1b8adde7SWilliam Kucharski 275*1b8adde7SWilliam Kucharski See also *Note rootnoverify::. 276*1b8adde7SWilliam Kucharski 277*1b8adde7SWilliam Kucharski 278*1b8adde7SWilliam KucharskiFile: grub.info, Node: rootnoverify, Next: savedefault, Prev: root, Up: Command-line and menu entry commands 279*1b8adde7SWilliam Kucharski 280*1b8adde7SWilliam Kucharskirootnoverify 281*1b8adde7SWilliam Kucharski------------ 282*1b8adde7SWilliam Kucharski 283*1b8adde7SWilliam Kucharski - Command: rootnoverify device [hdbias] 284*1b8adde7SWilliam Kucharski Similar to `root' (*note root::), but don't attempt to mount the 285*1b8adde7SWilliam Kucharski partition. This is useful for when an OS is outside of the area of 286*1b8adde7SWilliam Kucharski the disk that GRUB can read, but setting the correct root device 287*1b8adde7SWilliam Kucharski is still desired. Note that the items mentioned in `root' above 288*1b8adde7SWilliam Kucharski which derived from attempting the mount will _not_ work correctly. 289*1b8adde7SWilliam Kucharski 290*1b8adde7SWilliam Kucharski 291*1b8adde7SWilliam KucharskiFile: grub.info, Node: savedefault, Next: setup, Prev: rootnoverify, Up: Command-line and menu entry commands 292*1b8adde7SWilliam Kucharski 293*1b8adde7SWilliam Kucharskisavedefault 294*1b8adde7SWilliam Kucharski----------- 295*1b8adde7SWilliam Kucharski 296*1b8adde7SWilliam Kucharski - Command: savedefault num 297*1b8adde7SWilliam Kucharski Save the current menu entry or NUM if specified as a default 298*1b8adde7SWilliam Kucharski entry. Here is an example: 299*1b8adde7SWilliam Kucharski 300*1b8adde7SWilliam Kucharski default saved 301*1b8adde7SWilliam Kucharski timeout 10 302*1b8adde7SWilliam Kucharski 303*1b8adde7SWilliam Kucharski title GNU/Linux 304*1b8adde7SWilliam Kucharski root (hd0,0) 305*1b8adde7SWilliam Kucharski kernel /boot/vmlinuz root=/dev/sda1 vga=ext 306*1b8adde7SWilliam Kucharski initrd /boot/initrd 307*1b8adde7SWilliam Kucharski savedefault 308*1b8adde7SWilliam Kucharski 309*1b8adde7SWilliam Kucharski title FreeBSD 310*1b8adde7SWilliam Kucharski root (hd0,a) 311*1b8adde7SWilliam Kucharski kernel /boot/loader 312*1b8adde7SWilliam Kucharski savedefault 313*1b8adde7SWilliam Kucharski 314*1b8adde7SWilliam Kucharski With this configuration, GRUB will choose the entry booted 315*1b8adde7SWilliam Kucharski previously as the default entry. 316*1b8adde7SWilliam Kucharski 317*1b8adde7SWilliam Kucharski You can specify `fallback' instead of a number. Then, next 318*1b8adde7SWilliam Kucharski fallback entry is saved. Next fallback entry is chosen from 319*1b8adde7SWilliam Kucharski fallback entries. Normally, this will be the first entry in 320*1b8adde7SWilliam Kucharski fallback ones. 321*1b8adde7SWilliam Kucharski 322*1b8adde7SWilliam Kucharski See also *Note default:: and *Note Invoking grub-set-default::. 323*1b8adde7SWilliam Kucharski 324*1b8adde7SWilliam Kucharski 325*1b8adde7SWilliam KucharskiFile: grub.info, Node: setup, Next: testload, Prev: savedefault, Up: Command-line and menu entry commands 326*1b8adde7SWilliam Kucharski 327*1b8adde7SWilliam Kucharskisetup 328*1b8adde7SWilliam Kucharski----- 329*1b8adde7SWilliam Kucharski 330*1b8adde7SWilliam Kucharski - Command: setup [`--force-lba'] [`--stage2=os_stage2_file'] 331*1b8adde7SWilliam Kucharski [`--prefix=dir'] install_device [image_device] 332*1b8adde7SWilliam Kucharski Set up the installation of GRUB automatically. This command uses 333*1b8adde7SWilliam Kucharski the more flexible command `install' (*note install::) in the 334*1b8adde7SWilliam Kucharski backend and installs GRUB into the device INSTALL_DEVICE. If 335*1b8adde7SWilliam Kucharski IMAGE_DEVICE is specified, then find the GRUB images (*note 336*1b8adde7SWilliam Kucharski Images::) in the device IMAGE_DEVICE, otherwise use the current 337*1b8adde7SWilliam Kucharski "root device", which can be set by the command `root'. If 338*1b8adde7SWilliam Kucharski INSTALL_DEVICE is a hard disk, then embed a Stage 1.5 in the disk 339*1b8adde7SWilliam Kucharski if possible. 340*1b8adde7SWilliam Kucharski 341*1b8adde7SWilliam Kucharski The option `--prefix' specifies the directory under which GRUB 342*1b8adde7SWilliam Kucharski images are put. If it is not specified, GRUB automatically 343*1b8adde7SWilliam Kucharski searches them in `/boot/grub' and `/grub'. 344*1b8adde7SWilliam Kucharski 345*1b8adde7SWilliam Kucharski The options `--force-lba' and `--stage2' are just passed to 346*1b8adde7SWilliam Kucharski `install' if specified. *Note install::, for more information. 347*1b8adde7SWilliam Kucharski 348*1b8adde7SWilliam Kucharski 349*1b8adde7SWilliam KucharskiFile: grub.info, Node: testload, Next: testvbe, Prev: setup, Up: Command-line and menu entry commands 350*1b8adde7SWilliam Kucharski 351*1b8adde7SWilliam Kucharskitestload 352*1b8adde7SWilliam Kucharski-------- 353*1b8adde7SWilliam Kucharski 354*1b8adde7SWilliam Kucharski - Command: testload file 355*1b8adde7SWilliam Kucharski Read the entire contents of FILE in several different ways and 356*1b8adde7SWilliam Kucharski compare them, to test the filesystem code. The output is somewhat 357*1b8adde7SWilliam Kucharski cryptic, but if no errors are reported and the final `i=X, 358*1b8adde7SWilliam Kucharski filepos=Y' reading has X and Y equal, then it is definitely 359*1b8adde7SWilliam Kucharski consistent, and very likely works correctly subject to a 360*1b8adde7SWilliam Kucharski consistent offset error. If this test succeeds, then a good next 361*1b8adde7SWilliam Kucharski step is to try loading a kernel. 362*1b8adde7SWilliam Kucharski 363*1b8adde7SWilliam Kucharski 364*1b8adde7SWilliam KucharskiFile: grub.info, Node: testvbe, Next: uppermem, Prev: testload, Up: Command-line and menu entry commands 365*1b8adde7SWilliam Kucharski 366*1b8adde7SWilliam Kucharskitestvbe 367*1b8adde7SWilliam Kucharski------- 368*1b8adde7SWilliam Kucharski 369*1b8adde7SWilliam Kucharski - Command: testvbe mode 370*1b8adde7SWilliam Kucharski Test the VESA BIOS EXTENSION mode MODE. This command will switch 371*1b8adde7SWilliam Kucharski your video card to the graphics mode, and show an endless 372*1b8adde7SWilliam Kucharski animation. Hit any key to return. See also *Note vbeprobe::. 373*1b8adde7SWilliam Kucharski 374*1b8adde7SWilliam Kucharski 375*1b8adde7SWilliam KucharskiFile: grub.info, Node: uppermem, Next: vbeprobe, Prev: testvbe, Up: Command-line and menu entry commands 376*1b8adde7SWilliam Kucharski 377*1b8adde7SWilliam Kucharskiuppermem 378*1b8adde7SWilliam Kucharski-------- 379*1b8adde7SWilliam Kucharski 380*1b8adde7SWilliam Kucharski - Command: uppermem kbytes 381*1b8adde7SWilliam Kucharski Force GRUB to assume that only KBYTES kilobytes of upper memory 382*1b8adde7SWilliam Kucharski are installed. Any system address range maps are discarded. 383*1b8adde7SWilliam Kucharski 384*1b8adde7SWilliam Kucharski *Caution:* This should be used with great caution, and should only 385*1b8adde7SWilliam Kucharski be necessary on some old machines. GRUB's BIOS probe can pick up 386*1b8adde7SWilliam Kucharski all RAM on all new machines the author has ever heard of. It can 387*1b8adde7SWilliam Kucharski also be used for debugging purposes to lie to an OS. 388*1b8adde7SWilliam Kucharski 389*1b8adde7SWilliam Kucharski 390*1b8adde7SWilliam KucharskiFile: grub.info, Node: vbeprobe, Prev: uppermem, Up: Command-line and menu entry commands 391*1b8adde7SWilliam Kucharski 392*1b8adde7SWilliam Kucharskivbeprobe 393*1b8adde7SWilliam Kucharski-------- 394*1b8adde7SWilliam Kucharski 395*1b8adde7SWilliam Kucharski - Command: vbeprobe [mode] 396*1b8adde7SWilliam Kucharski Probe VESA BIOS EXTENSION information. If the mode MODE is 397*1b8adde7SWilliam Kucharski specified, show only the information about MODE. Otherwise, this 398*1b8adde7SWilliam Kucharski command lists up available VBE modes on the screen. See also *Note 399*1b8adde7SWilliam Kucharski testvbe::. 400*1b8adde7SWilliam Kucharski 401*1b8adde7SWilliam Kucharski 402*1b8adde7SWilliam KucharskiFile: grub.info, Node: Troubleshooting, Next: Invoking the grub shell, Prev: Commands, Up: Top 403*1b8adde7SWilliam Kucharski 404*1b8adde7SWilliam KucharskiError messages reported by GRUB 405*1b8adde7SWilliam Kucharski******************************* 406*1b8adde7SWilliam Kucharski 407*1b8adde7SWilliam Kucharski This chapter describes error messages reported by GRUB when you 408*1b8adde7SWilliam Kucharskiencounter trouble. *Note Invoking the grub shell::, if your problem is 409*1b8adde7SWilliam Kucharskispecific to the grub shell. 410*1b8adde7SWilliam Kucharski 411*1b8adde7SWilliam Kucharski* Menu: 412*1b8adde7SWilliam Kucharski 413*1b8adde7SWilliam Kucharski* Stage1 errors:: Errors reported by the Stage 1 414*1b8adde7SWilliam Kucharski* Stage1.5 errors:: Errors reported by the Stage 1.5 415*1b8adde7SWilliam Kucharski* Stage2 errors:: Errors reported by the Stage 2 416*1b8adde7SWilliam Kucharski 417*1b8adde7SWilliam Kucharski 418*1b8adde7SWilliam KucharskiFile: grub.info, Node: Stage1 errors, Next: Stage1.5 errors, Up: Troubleshooting 419*1b8adde7SWilliam Kucharski 420*1b8adde7SWilliam KucharskiErrors reported by the Stage 1 421*1b8adde7SWilliam Kucharski============================== 422*1b8adde7SWilliam Kucharski 423*1b8adde7SWilliam Kucharski The general way that the Stage 1 handles errors is to print an error 424*1b8adde7SWilliam Kucharskistring and then halt. Pressing `<CTRL>-<ALT>-<DEL>' will reboot. 425*1b8adde7SWilliam Kucharski 426*1b8adde7SWilliam Kucharski The following is a comprehensive list of error messages for the 427*1b8adde7SWilliam KucharskiStage 1: 428*1b8adde7SWilliam Kucharski 429*1b8adde7SWilliam KucharskiHard Disk Error 430*1b8adde7SWilliam Kucharski The stage2 or stage1.5 is being read from a hard disk, and the 431*1b8adde7SWilliam Kucharski attempt to determine the size and geometry of the hard disk failed. 432*1b8adde7SWilliam Kucharski 433*1b8adde7SWilliam KucharskiFloppy Error 434*1b8adde7SWilliam Kucharski The stage2 or stage1.5 is being read from a floppy disk, and the 435*1b8adde7SWilliam Kucharski attempt to determine the size and geometry of the floppy disk 436*1b8adde7SWilliam Kucharski failed. It's listed as a separate error since the probe sequence 437*1b8adde7SWilliam Kucharski is different than for hard disks. 438*1b8adde7SWilliam Kucharski 439*1b8adde7SWilliam KucharskiRead Error 440*1b8adde7SWilliam Kucharski A disk read error happened while trying to read the stage2 or 441*1b8adde7SWilliam Kucharski stage1.5. 442*1b8adde7SWilliam Kucharski 443*1b8adde7SWilliam KucharskiGeom Error 444*1b8adde7SWilliam Kucharski The location of the stage2 or stage1.5 is not in the portion of 445*1b8adde7SWilliam Kucharski the disk supported directly by the BIOS read calls. This could 446*1b8adde7SWilliam Kucharski occur because the BIOS translated geometry has been changed by the 447*1b8adde7SWilliam Kucharski user or the disk is moved to another machine or controller after 448*1b8adde7SWilliam Kucharski installation, or GRUB was not installed using itself (if it was, 449*1b8adde7SWilliam Kucharski the Stage 2 version of this error would have been seen during that 450*1b8adde7SWilliam Kucharski process and it would not have completed the install). 451*1b8adde7SWilliam Kucharski 452*1b8adde7SWilliam Kucharski 453*1b8adde7SWilliam KucharskiFile: grub.info, Node: Stage1.5 errors, Next: Stage2 errors, Prev: Stage1 errors, Up: Troubleshooting 454*1b8adde7SWilliam Kucharski 455*1b8adde7SWilliam KucharskiErrors reported by the Stage 1.5 456*1b8adde7SWilliam Kucharski================================ 457*1b8adde7SWilliam Kucharski 458*1b8adde7SWilliam Kucharski The general way that the Stage 1.5 handles errors is to print an 459*1b8adde7SWilliam Kucharskierror number in the form `Error NUM' and then halt. Pressing 460*1b8adde7SWilliam Kucharski`<CTRL>-<ALT>-<DEL>' will reboot. 461*1b8adde7SWilliam Kucharski 462*1b8adde7SWilliam Kucharski The error numbers correspond to the errors reported by Stage 2. 463*1b8adde7SWilliam Kucharski*Note Stage2 errors::. 464*1b8adde7SWilliam Kucharski 465*1b8adde7SWilliam Kucharski 466*1b8adde7SWilliam KucharskiFile: grub.info, Node: Stage2 errors, Prev: Stage1.5 errors, Up: Troubleshooting 467*1b8adde7SWilliam Kucharski 468*1b8adde7SWilliam KucharskiErrors reported by the Stage 2 469*1b8adde7SWilliam Kucharski============================== 470*1b8adde7SWilliam Kucharski 471*1b8adde7SWilliam Kucharski The general way that the Stage 2 handles errors is to abort the 472*1b8adde7SWilliam Kucharskioperation in question, print an error string, then (if possible) either 473*1b8adde7SWilliam Kucharskicontinue based on the fact that an error occurred or wait for the user 474*1b8adde7SWilliam Kucharskito deal with the error. 475*1b8adde7SWilliam Kucharski 476*1b8adde7SWilliam Kucharski The following is a comprehensive list of error messages for the 477*1b8adde7SWilliam KucharskiStage 2 (error numbers for the Stage 1.5 are listed before the colon in 478*1b8adde7SWilliam Kucharskieach description): 479*1b8adde7SWilliam Kucharski 480*1b8adde7SWilliam Kucharski1 : Filename must be either an absolute filename or blocklist 481*1b8adde7SWilliam Kucharski This error is returned if a file name is requested which doesn't 482*1b8adde7SWilliam Kucharski fit the syntax/rules listed in the *Note Filesystem::. 483*1b8adde7SWilliam Kucharski 484*1b8adde7SWilliam Kucharski2 : Bad file or directory type 485*1b8adde7SWilliam Kucharski This error is returned if a file requested is not a regular file, 486*1b8adde7SWilliam Kucharski but something like a symbolic link, directory, or FIFO. 487*1b8adde7SWilliam Kucharski 488*1b8adde7SWilliam Kucharski3 : Bad or corrupt data while decompressing file 489*1b8adde7SWilliam Kucharski This error is returned if the run-length decompression code gets an 490*1b8adde7SWilliam Kucharski internal error. This is usually from a corrupt file. 491*1b8adde7SWilliam Kucharski 492*1b8adde7SWilliam Kucharski4 : Bad or incompatible header in compressed file 493*1b8adde7SWilliam Kucharski This error is returned if the file header for a supposedly 494*1b8adde7SWilliam Kucharski compressed file is bad. 495*1b8adde7SWilliam Kucharski 496*1b8adde7SWilliam Kucharski5 : Partition table invalid or corrupt 497*1b8adde7SWilliam Kucharski This error is returned if the sanity checks on the integrity of the 498*1b8adde7SWilliam Kucharski partition table fail. This is a bad sign. 499*1b8adde7SWilliam Kucharski 500*1b8adde7SWilliam Kucharski6 : Mismatched or corrupt version of stage1/stage2 501*1b8adde7SWilliam Kucharski This error is returned if the install command points to 502*1b8adde7SWilliam Kucharski incompatible or corrupt versions of the stage1 or stage2. It can't 503*1b8adde7SWilliam Kucharski detect corruption in general, but this is a sanity check on the 504*1b8adde7SWilliam Kucharski version numbers, which should be correct. 505*1b8adde7SWilliam Kucharski 506*1b8adde7SWilliam Kucharski7 : Loading below 1MB is not supported 507*1b8adde7SWilliam Kucharski This error is returned if the lowest address in a kernel is below 508*1b8adde7SWilliam Kucharski the 1MB boundary. The Linux zImage format is a special case and 509*1b8adde7SWilliam Kucharski can be handled since it has a fixed loading address and maximum 510*1b8adde7SWilliam Kucharski size. 511*1b8adde7SWilliam Kucharski 512*1b8adde7SWilliam Kucharski8 : Kernel must be loaded before booting 513*1b8adde7SWilliam Kucharski This error is returned if GRUB is told to execute the boot sequence 514*1b8adde7SWilliam Kucharski without having a kernel to start. 515*1b8adde7SWilliam Kucharski 516*1b8adde7SWilliam Kucharski9 : Unknown boot failure 517*1b8adde7SWilliam Kucharski This error is returned if the boot attempt did not succeed for 518*1b8adde7SWilliam Kucharski reasons which are unknown. 519*1b8adde7SWilliam Kucharski 520*1b8adde7SWilliam Kucharski10 : Unsupported Multiboot features requested 521*1b8adde7SWilliam Kucharski This error is returned when the Multiboot features word in the 522*1b8adde7SWilliam Kucharski Multiboot header requires a feature that is not recognized. The 523*1b8adde7SWilliam Kucharski point of this is that the kernel requires special handling which 524*1b8adde7SWilliam Kucharski GRUB is probably unable to provide. 525*1b8adde7SWilliam Kucharski 526*1b8adde7SWilliam Kucharski11 : Unrecognized device string 527*1b8adde7SWilliam Kucharski This error is returned if a device string was expected, and the 528*1b8adde7SWilliam Kucharski string encountered didn't fit the syntax/rules listed in the *Note 529*1b8adde7SWilliam Kucharski Filesystem::. 530*1b8adde7SWilliam Kucharski 531*1b8adde7SWilliam Kucharski12 : Invalid device requested 532*1b8adde7SWilliam Kucharski This error is returned if a device string is recognizable but does 533*1b8adde7SWilliam Kucharski not fall under the other device errors. 534*1b8adde7SWilliam Kucharski 535*1b8adde7SWilliam Kucharski13 : Invalid or unsupported executable format 536*1b8adde7SWilliam Kucharski This error is returned if the kernel image being loaded is not 537*1b8adde7SWilliam Kucharski recognized as Multiboot or one of the supported native formats 538*1b8adde7SWilliam Kucharski (Linux zImage or bzImage, FreeBSD, or NetBSD). 539*1b8adde7SWilliam Kucharski 540*1b8adde7SWilliam Kucharski14 : Filesystem compatibility error, cannot read whole file 541*1b8adde7SWilliam Kucharski Some of the filesystem reading code in GRUB has limits on the 542*1b8adde7SWilliam Kucharski length of the files it can read. This error is returned when the 543*1b8adde7SWilliam Kucharski user runs into such a limit. 544*1b8adde7SWilliam Kucharski 545*1b8adde7SWilliam Kucharski15 : File not found 546*1b8adde7SWilliam Kucharski This error is returned if the specified file name cannot be found, 547*1b8adde7SWilliam Kucharski but everything else (like the disk/partition info) is OK. 548*1b8adde7SWilliam Kucharski 549*1b8adde7SWilliam Kucharski16 : Inconsistent filesystem structure 550*1b8adde7SWilliam Kucharski This error is returned by the filesystem code to denote an internal 551*1b8adde7SWilliam Kucharski error caused by the sanity checks of the filesystem structure on 552*1b8adde7SWilliam Kucharski disk not matching what it expects. This is usually caused by a 553*1b8adde7SWilliam Kucharski corrupt filesystem or bugs in the code handling it in GRUB. 554*1b8adde7SWilliam Kucharski 555*1b8adde7SWilliam Kucharski17 : Cannot mount selected partition 556*1b8adde7SWilliam Kucharski This error is returned if the partition requested exists, but the 557*1b8adde7SWilliam Kucharski filesystem type cannot be recognized by GRUB. 558*1b8adde7SWilliam Kucharski 559*1b8adde7SWilliam Kucharski18 : Selected cylinder exceeds maximum supported by BIOS 560*1b8adde7SWilliam Kucharski This error is returned when a read is attempted at a linear block 561*1b8adde7SWilliam Kucharski address beyond the end of the BIOS translated area. This generally 562*1b8adde7SWilliam Kucharski happens if your disk is larger than the BIOS can handle (512MB for 563*1b8adde7SWilliam Kucharski (E)IDE disks on older machines or larger than 8GB in general). 564*1b8adde7SWilliam Kucharski 565*1b8adde7SWilliam Kucharski19 : Linux kernel must be loaded before initrd 566*1b8adde7SWilliam Kucharski This error is returned if the initrd command is used before 567*1b8adde7SWilliam Kucharski loading a Linux kernel. 568*1b8adde7SWilliam Kucharski 569*1b8adde7SWilliam Kucharski20 : Multiboot kernel must be loaded before modules 570*1b8adde7SWilliam Kucharski This error is returned if the module load command is used before 571*1b8adde7SWilliam Kucharski loading a Multiboot kernel. It only makes sense in this case 572*1b8adde7SWilliam Kucharski anyway, as GRUB has no idea how to communicate the presence of 573*1b8adde7SWilliam Kucharski such modules to a non-Multiboot-aware kernel. 574*1b8adde7SWilliam Kucharski 575*1b8adde7SWilliam Kucharski21 : Selected disk does not exist 576*1b8adde7SWilliam Kucharski This error is returned if the device part of a device- or full 577*1b8adde7SWilliam Kucharski file name refers to a disk or BIOS device that is not present or 578*1b8adde7SWilliam Kucharski not recognized by the BIOS in the system. 579*1b8adde7SWilliam Kucharski 580*1b8adde7SWilliam Kucharski22 : No such partition 581*1b8adde7SWilliam Kucharski This error is returned if a partition is requested in the device 582*1b8adde7SWilliam Kucharski part of a device- or full file name which isn't on the selected 583*1b8adde7SWilliam Kucharski disk. 584*1b8adde7SWilliam Kucharski 585*1b8adde7SWilliam Kucharski23 : Error while parsing number 586*1b8adde7SWilliam Kucharski This error is returned if GRUB was expecting to read a number and 587*1b8adde7SWilliam Kucharski encountered bad data. 588*1b8adde7SWilliam Kucharski 589*1b8adde7SWilliam Kucharski24 : Attempt to access block outside partition 590*1b8adde7SWilliam Kucharski This error is returned if a linear block address is outside of the 591*1b8adde7SWilliam Kucharski disk partition. This generally happens because of a corrupt 592*1b8adde7SWilliam Kucharski filesystem on the disk or a bug in the code handling it in GRUB 593*1b8adde7SWilliam Kucharski (it's a great debugging tool). 594*1b8adde7SWilliam Kucharski 595*1b8adde7SWilliam Kucharski25 : Disk read error 596*1b8adde7SWilliam Kucharski This error is returned if there is a disk read error when trying to 597*1b8adde7SWilliam Kucharski probe or read data from a particular disk. 598*1b8adde7SWilliam Kucharski 599*1b8adde7SWilliam Kucharski26 : Too many symbolic links 600*1b8adde7SWilliam Kucharski This error is returned if the link count is beyond the maximum 601*1b8adde7SWilliam Kucharski (currently 5), possibly the symbolic links are looped. 602*1b8adde7SWilliam Kucharski 603*1b8adde7SWilliam Kucharski27 : Unrecognized command 604*1b8adde7SWilliam Kucharski This error is returned if an unrecognized command is entered on the 605*1b8adde7SWilliam Kucharski command-line or in a boot sequence section of a configuration file 606*1b8adde7SWilliam Kucharski and that entry is selected. 607*1b8adde7SWilliam Kucharski 608*1b8adde7SWilliam Kucharski28 : Selected item cannot fit into memory 609*1b8adde7SWilliam Kucharski This error is returned if a kernel, module, or raw file load 610*1b8adde7SWilliam Kucharski command is either trying to load its data such that it won't fit 611*1b8adde7SWilliam Kucharski into memory or it is simply too big. 612*1b8adde7SWilliam Kucharski 613*1b8adde7SWilliam Kucharski29 : Disk write error 614*1b8adde7SWilliam Kucharski This error is returned if there is a disk write error when trying 615*1b8adde7SWilliam Kucharski to write to a particular disk. This would generally only occur 616*1b8adde7SWilliam Kucharski during an install of set active partition command. 617*1b8adde7SWilliam Kucharski 618*1b8adde7SWilliam Kucharski30 : Invalid argument 619*1b8adde7SWilliam Kucharski This error is returned if an argument specified to a command is 620*1b8adde7SWilliam Kucharski invalid. 621*1b8adde7SWilliam Kucharski 622*1b8adde7SWilliam Kucharski31 : File is not sector aligned 623*1b8adde7SWilliam Kucharski This error may occur only when you access a ReiserFS partition by 624*1b8adde7SWilliam Kucharski block-lists (e.g. the command `install'). In this case, you should 625*1b8adde7SWilliam Kucharski mount the partition with the `-o notail' option. 626*1b8adde7SWilliam Kucharski 627*1b8adde7SWilliam Kucharski32 : Must be authenticated 628*1b8adde7SWilliam Kucharski This error is returned if you try to run a locked entry. You should 629*1b8adde7SWilliam Kucharski enter a correct password before running such an entry. 630*1b8adde7SWilliam Kucharski 631*1b8adde7SWilliam Kucharski33 : Serial device not configured 632*1b8adde7SWilliam Kucharski This error is returned if you try to change your terminal to a 633*1b8adde7SWilliam Kucharski serial one before initializing any serial device. 634*1b8adde7SWilliam Kucharski 635*1b8adde7SWilliam Kucharski34 : No spare sectors on the disk 636*1b8adde7SWilliam Kucharski This error is returned if a disk doesn't have enough spare space. 637*1b8adde7SWilliam Kucharski This happens when you try to embed Stage 1.5 into the unused 638*1b8adde7SWilliam Kucharski sectors after the MBR, but the first partition starts right after 639*1b8adde7SWilliam Kucharski the MBR or they are used by EZ-BIOS. 640*1b8adde7SWilliam Kucharski 641*1b8adde7SWilliam Kucharski 642*1b8adde7SWilliam KucharskiFile: grub.info, Node: Invoking the grub shell, Next: Invoking grub-install, Prev: Troubleshooting, Up: Top 643*1b8adde7SWilliam Kucharski 644*1b8adde7SWilliam KucharskiInvoking the grub shell 645*1b8adde7SWilliam Kucharski*********************** 646*1b8adde7SWilliam Kucharski 647*1b8adde7SWilliam Kucharski This chapter documents the grub shell `grub'. Note that the grub 648*1b8adde7SWilliam Kucharskishell is an emulator; it doesn't run under the native environment, so it 649*1b8adde7SWilliam Kucharskisometimes does something wrong. Therefore, you shouldn't trust it too 650*1b8adde7SWilliam Kucharskimuch. If there is anything wrong with it, don't hesitate to try the 651*1b8adde7SWilliam Kucharskinative GRUB environment, especially when it guesses a wrong map between 652*1b8adde7SWilliam KucharskiBIOS drives and OS devices. 653*1b8adde7SWilliam Kucharski 654*1b8adde7SWilliam Kucharski* Menu: 655*1b8adde7SWilliam Kucharski 656*1b8adde7SWilliam Kucharski* Basic usage:: How to use the grub shell 657*1b8adde7SWilliam Kucharski* Installation under UNIX:: How to install GRUB via `grub' 658*1b8adde7SWilliam Kucharski* Device map:: The map between BIOS drives and OS devices 659*1b8adde7SWilliam Kucharski 660*1b8adde7SWilliam Kucharski 661*1b8adde7SWilliam KucharskiFile: grub.info, Node: Basic usage, Next: Installation under UNIX, Up: Invoking the grub shell 662*1b8adde7SWilliam Kucharski 663*1b8adde7SWilliam KucharskiIntroduction into the grub shell 664*1b8adde7SWilliam Kucharski================================ 665*1b8adde7SWilliam Kucharski 666*1b8adde7SWilliam Kucharski You can use the command `grub' for installing GRUB under your 667*1b8adde7SWilliam Kucharskioperating systems and for a testbed when you add a new feature into GRUB 668*1b8adde7SWilliam Kucharskior when fixing a bug. `grub' is almost the same as the Stage 2, and, in 669*1b8adde7SWilliam Kucharskifact, it shares the source code with the Stage 2 and you can use the 670*1b8adde7SWilliam Kucharskisame commands (*note Commands::) in `grub'. It is emulated by replacing 671*1b8adde7SWilliam KucharskiBIOS calls with UNIX system calls and libc functions. 672*1b8adde7SWilliam Kucharski 673*1b8adde7SWilliam Kucharski The command `grub' accepts the following options: 674*1b8adde7SWilliam Kucharski 675*1b8adde7SWilliam Kucharski`--help' 676*1b8adde7SWilliam Kucharski Print a summary of the command-line options and exit. 677*1b8adde7SWilliam Kucharski 678*1b8adde7SWilliam Kucharski`--version' 679*1b8adde7SWilliam Kucharski Print the version number of GRUB and exit. 680*1b8adde7SWilliam Kucharski 681*1b8adde7SWilliam Kucharski`--verbose' 682*1b8adde7SWilliam Kucharski Print some verbose messages for debugging purpose. 683*1b8adde7SWilliam Kucharski 684*1b8adde7SWilliam Kucharski`--device-map=FILE' 685*1b8adde7SWilliam Kucharski Use the device map file FILE. The format is described in *Note 686*1b8adde7SWilliam Kucharski Device map::. 687*1b8adde7SWilliam Kucharski 688*1b8adde7SWilliam Kucharski`--no-floppy' 689*1b8adde7SWilliam Kucharski Do not probe any floppy drive. This option has no effect if the 690*1b8adde7SWilliam Kucharski option `--device-map' is specified (*note Device map::). 691*1b8adde7SWilliam Kucharski 692*1b8adde7SWilliam Kucharski`--probe-second-floppy' 693*1b8adde7SWilliam Kucharski Probe the second floppy drive. If this option is not specified, 694*1b8adde7SWilliam Kucharski the grub shell does not probe it, as that sometimes takes a long 695*1b8adde7SWilliam Kucharski time. If you specify the device map file (*note Device map::), the 696*1b8adde7SWilliam Kucharski grub shell just ignores this option. 697*1b8adde7SWilliam Kucharski 698*1b8adde7SWilliam Kucharski`--config-file=FILE' 699*1b8adde7SWilliam Kucharski Read the configuration file FILE instead of `/boot/grub/menu.lst'. 700*1b8adde7SWilliam Kucharski The format is the same as the normal GRUB syntax. See *Note 701*1b8adde7SWilliam Kucharski Filesystem::, for more information. 702*1b8adde7SWilliam Kucharski 703*1b8adde7SWilliam Kucharski`--boot-drive=DRIVE' 704*1b8adde7SWilliam Kucharski Set the stage2 BOOT_DRIVE to DRIVE. This argument should be an 705*1b8adde7SWilliam Kucharski integer (decimal, octal or hexadecimal). 706*1b8adde7SWilliam Kucharski 707*1b8adde7SWilliam Kucharski`--install-partition=PAR' 708*1b8adde7SWilliam Kucharski Set the stage2 INSTALL_PARTITION to PAR. This argument should be 709*1b8adde7SWilliam Kucharski an integer (decimal, octal or hexadecimal). 710*1b8adde7SWilliam Kucharski 711*1b8adde7SWilliam Kucharski`--no-config-file' 712*1b8adde7SWilliam Kucharski Do not use the configuration file even if it can be read. 713*1b8adde7SWilliam Kucharski 714*1b8adde7SWilliam Kucharski`--no-curses' 715*1b8adde7SWilliam Kucharski Do not use the screen handling interface by the curses even if it 716*1b8adde7SWilliam Kucharski is available. 717*1b8adde7SWilliam Kucharski 718*1b8adde7SWilliam Kucharski`--batch' 719*1b8adde7SWilliam Kucharski This option has the same meaning as `--no-config-file --no-curses'. 720*1b8adde7SWilliam Kucharski 721*1b8adde7SWilliam Kucharski`--read-only' 722*1b8adde7SWilliam Kucharski Disable writing to any disk. 723*1b8adde7SWilliam Kucharski 724*1b8adde7SWilliam Kucharski`--hold' 725*1b8adde7SWilliam Kucharski Wait until a debugger will attach. This option is useful when you 726*1b8adde7SWilliam Kucharski want to debug the startup code. 727*1b8adde7SWilliam Kucharski 728*1b8adde7SWilliam Kucharski 729*1b8adde7SWilliam KucharskiFile: grub.info, Node: Installation under UNIX, Next: Device map, Prev: Basic usage, Up: Invoking the grub shell 730*1b8adde7SWilliam Kucharski 731*1b8adde7SWilliam KucharskiHow to install GRUB via `grub' 732*1b8adde7SWilliam Kucharski============================== 733*1b8adde7SWilliam Kucharski 734*1b8adde7SWilliam Kucharski The installation procedure is the same as under the "native" Stage 735*1b8adde7SWilliam Kucharski2. *Note Installation::, for more information. The command 736*1b8adde7SWilliam Kucharski`grub'-specific information is described here. 737*1b8adde7SWilliam Kucharski 738*1b8adde7SWilliam Kucharski What you should be careful about is "buffer cache". `grub' makes use 739*1b8adde7SWilliam Kucharskiof raw devices instead of filesystems that your operating systems 740*1b8adde7SWilliam Kucharskiserve, so there exists a potential problem that some cache 741*1b8adde7SWilliam Kucharskiinconsistency may corrupt your filesystems. What we recommend is: 742*1b8adde7SWilliam Kucharski 743*1b8adde7SWilliam Kucharski * If you can unmount drives to which GRUB may write any amount of 744*1b8adde7SWilliam Kucharski data, unmount them before running `grub'. 745*1b8adde7SWilliam Kucharski 746*1b8adde7SWilliam Kucharski * If a drive cannot be unmounted but can be mounted with the 747*1b8adde7SWilliam Kucharski read-only flag, mount it in read-only mode. That should be secure. 748*1b8adde7SWilliam Kucharski 749*1b8adde7SWilliam Kucharski * If a drive must be mounted with the read-write flag, make sure 750*1b8adde7SWilliam Kucharski that no activity is being done on it while the command `grub' is 751*1b8adde7SWilliam Kucharski running. 752*1b8adde7SWilliam Kucharski 753*1b8adde7SWilliam Kucharski * Reboot your operating system as soon as possible. This is probably 754*1b8adde7SWilliam Kucharski not required if you follow the rules above, but reboot is the most 755*1b8adde7SWilliam Kucharski secure way. 756*1b8adde7SWilliam Kucharski 757*1b8adde7SWilliam Kucharski In addition, enter the command `quit' when you finish the 758*1b8adde7SWilliam Kucharskiinstallation. That is _very important_ because `quit' makes the buffer 759*1b8adde7SWilliam Kucharskicache consistent. Do not push <C-c>. 760*1b8adde7SWilliam Kucharski 761*1b8adde7SWilliam Kucharski If you want to install GRUB non-interactively, specify `--batch' 762*1b8adde7SWilliam Kucharskioption in the command-line. This is a simple example: 763*1b8adde7SWilliam Kucharski 764*1b8adde7SWilliam Kucharski #!/bin/sh 765*1b8adde7SWilliam Kucharski 766*1b8adde7SWilliam Kucharski # Use /usr/sbin/grub if you are on an older system. 767*1b8adde7SWilliam Kucharski /sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null 768*1b8adde7SWilliam Kucharski root (hd0,0) 769*1b8adde7SWilliam Kucharski setup (hd0) 770*1b8adde7SWilliam Kucharski quit 771*1b8adde7SWilliam Kucharski EOT 772*1b8adde7SWilliam Kucharski 773*1b8adde7SWilliam Kucharski 774*1b8adde7SWilliam KucharskiFile: grub.info, Node: Device map, Prev: Installation under UNIX, Up: Invoking the grub shell 775*1b8adde7SWilliam Kucharski 776*1b8adde7SWilliam KucharskiThe map between BIOS drives and OS devices 777*1b8adde7SWilliam Kucharski========================================== 778*1b8adde7SWilliam Kucharski 779*1b8adde7SWilliam Kucharski When you specify the option `--device-map' (*note Basic usage::), 780*1b8adde7SWilliam Kucharskithe grub shell creates the "device map file" automatically unless it 781*1b8adde7SWilliam Kucharskialready exists. The file name `/boot/grub/device.map' is preferred. 782*1b8adde7SWilliam Kucharski 783*1b8adde7SWilliam Kucharski If the device map file exists, the grub shell reads it to map BIOS 784*1b8adde7SWilliam Kucharskidrives to OS devices. This file consists of lines like this: 785*1b8adde7SWilliam Kucharski 786*1b8adde7SWilliam Kucharski DEVICE FILE 787*1b8adde7SWilliam Kucharski 788*1b8adde7SWilliam Kucharski DEVICE is a drive specified in the GRUB syntax (*note Device 789*1b8adde7SWilliam Kucharskisyntax::), and FILE is an OS file, which is normally a device file. 790*1b8adde7SWilliam Kucharski 791*1b8adde7SWilliam Kucharski The reason why the grub shell gives you the device map file is that 792*1b8adde7SWilliam Kucharskiit cannot guess the map between BIOS drives and OS devices correctly in 793*1b8adde7SWilliam Kucharskisome environments. For example, if you exchange the boot sequence 794*1b8adde7SWilliam Kucharskibetween IDE and SCSI in your BIOS, it gets the order wrong. 795*1b8adde7SWilliam Kucharski 796*1b8adde7SWilliam Kucharski Thus, edit the file if the grub shell makes a mistake. You can put 797*1b8adde7SWilliam Kucharskiany comments in the file if needed, as the grub shell assumes that a 798*1b8adde7SWilliam Kucharskiline is just a comment if the first character is `#'. 799*1b8adde7SWilliam Kucharski 800*1b8adde7SWilliam Kucharski 801*1b8adde7SWilliam KucharskiFile: grub.info, Node: Invoking grub-install, Next: Invoking grub-md5-crypt, Prev: Invoking the grub shell, Up: Top 802*1b8adde7SWilliam Kucharski 803*1b8adde7SWilliam KucharskiInvoking grub-install 804*1b8adde7SWilliam Kucharski********************* 805*1b8adde7SWilliam Kucharski 806*1b8adde7SWilliam Kucharski The program `grub-install' installs GRUB on your drive using the 807*1b8adde7SWilliam Kucharskigrub shell (*note Invoking the grub shell::). You must specify the 808*1b8adde7SWilliam Kucharskidevice name on which you want to install GRUB, like this: 809*1b8adde7SWilliam Kucharski 810*1b8adde7SWilliam Kucharski grub-install INSTALL_DEVICE 811*1b8adde7SWilliam Kucharski 812*1b8adde7SWilliam Kucharski The device name INSTALL_DEVICE is an OS device name or a GRUB device 813*1b8adde7SWilliam Kucharskiname. 814*1b8adde7SWilliam Kucharski 815*1b8adde7SWilliam Kucharski `grub-install' accepts the following options: 816*1b8adde7SWilliam Kucharski 817*1b8adde7SWilliam Kucharski`--help' 818*1b8adde7SWilliam Kucharski Print a summary of the command-line options and exit. 819*1b8adde7SWilliam Kucharski 820*1b8adde7SWilliam Kucharski`--version' 821*1b8adde7SWilliam Kucharski Print the version number of GRUB and exit. 822*1b8adde7SWilliam Kucharski 823*1b8adde7SWilliam Kucharski`--force-lba' 824*1b8adde7SWilliam Kucharski Force GRUB to use LBA mode even for a buggy BIOS. Use this option 825*1b8adde7SWilliam Kucharski only if your BIOS doesn't work properly in LBA mode even though it 826*1b8adde7SWilliam Kucharski supports LBA mode. 827*1b8adde7SWilliam Kucharski 828*1b8adde7SWilliam Kucharski`--root-directory=DIR' 829*1b8adde7SWilliam Kucharski Install GRUB images under the directory DIR instead of the root 830*1b8adde7SWilliam Kucharski directory. This option is useful when you want to install GRUB 831*1b8adde7SWilliam Kucharski into a separate partition or a removable disk. Here is an example 832*1b8adde7SWilliam Kucharski in which you have a separate "boot" partition which is mounted on 833*1b8adde7SWilliam Kucharski `/boot': 834*1b8adde7SWilliam Kucharski 835*1b8adde7SWilliam Kucharski grub-install --root-directory=/boot hd0 836*1b8adde7SWilliam Kucharski 837*1b8adde7SWilliam Kucharski`--grub-shell=FILE' 838*1b8adde7SWilliam Kucharski Use FILE as the grub shell. You can append arbitrary options to 839*1b8adde7SWilliam Kucharski FILE after the file name, like this: 840*1b8adde7SWilliam Kucharski 841*1b8adde7SWilliam Kucharski grub-install --grub-shell="grub --read-only" /dev/fd0 842*1b8adde7SWilliam Kucharski 843*1b8adde7SWilliam Kucharski`--recheck' 844*1b8adde7SWilliam Kucharski Recheck the device map, even if `/boot/grub/device.map' already 845*1b8adde7SWilliam Kucharski exists. You should use this option whenever you add/remove a disk 846*1b8adde7SWilliam Kucharski into/from your computer. 847*1b8adde7SWilliam Kucharski 848*1b8adde7SWilliam Kucharski 849*1b8adde7SWilliam KucharskiFile: grub.info, Node: Invoking grub-md5-crypt, Next: Invoking grub-terminfo, Prev: Invoking grub-install, Up: Top 850*1b8adde7SWilliam Kucharski 851*1b8adde7SWilliam KucharskiInvoking grub-md5-crypt 852*1b8adde7SWilliam Kucharski*********************** 853*1b8adde7SWilliam Kucharski 854*1b8adde7SWilliam Kucharski The program `grub-md5-crypt' encrypts a password in MD5 format. 855*1b8adde7SWilliam KucharskiThis is just a frontend of the grub shell (*note Invoking the grub 856*1b8adde7SWilliam Kucharskishell::). Passwords encrypted by this program can be used with the 857*1b8adde7SWilliam Kucharskicommand `password' (*note password::). 858*1b8adde7SWilliam Kucharski 859*1b8adde7SWilliam Kucharski `grub-md5-crypt' accepts the following options: 860*1b8adde7SWilliam Kucharski 861*1b8adde7SWilliam Kucharski`--help' 862*1b8adde7SWilliam Kucharski Print a summary of the command-line options and exit. 863*1b8adde7SWilliam Kucharski 864*1b8adde7SWilliam Kucharski`--version' 865*1b8adde7SWilliam Kucharski Print the version information and exit. 866*1b8adde7SWilliam Kucharski 867*1b8adde7SWilliam Kucharski`--grub-shell=FILE' 868*1b8adde7SWilliam Kucharski Use FILE as the grub shell. 869*1b8adde7SWilliam Kucharski 870*1b8adde7SWilliam Kucharski 871*1b8adde7SWilliam KucharskiFile: grub.info, Node: Invoking grub-terminfo, Next: Invoking grub-set-default, Prev: Invoking grub-md5-crypt, Up: Top 872*1b8adde7SWilliam Kucharski 873*1b8adde7SWilliam KucharskiInvoking grub-terminfo 874*1b8adde7SWilliam Kucharski********************** 875*1b8adde7SWilliam Kucharski 876*1b8adde7SWilliam Kucharski The program `grub-terminfo' generates a terminfo command from a 877*1b8adde7SWilliam Kucharskiterminfo name (*note terminfo::). The result can be used in the 878*1b8adde7SWilliam Kucharskiconfiguration file, to define escape sequences. Because GRUB assumes 879*1b8adde7SWilliam Kucharskithat your terminal is vt100-compatible by default, this would be useful 880*1b8adde7SWilliam Kucharskionly if your terminal is uncommon (such as vt52). 881*1b8adde7SWilliam Kucharski 882*1b8adde7SWilliam Kucharski `grub-terminfo' accepts the following options: 883*1b8adde7SWilliam Kucharski 884*1b8adde7SWilliam Kucharski`--help' 885*1b8adde7SWilliam Kucharski Print a summary of the command-line options and exit. 886*1b8adde7SWilliam Kucharski 887*1b8adde7SWilliam Kucharski`--version' 888*1b8adde7SWilliam Kucharski Print the version information and exit. 889*1b8adde7SWilliam Kucharski 890*1b8adde7SWilliam Kucharski You must specify one argument to this command. For example: 891*1b8adde7SWilliam Kucharski 892*1b8adde7SWilliam Kucharski grub-terminfo vt52 893*1b8adde7SWilliam Kucharski 894*1b8adde7SWilliam Kucharski 895*1b8adde7SWilliam KucharskiFile: grub.info, Node: Invoking grub-set-default, Next: Invoking mbchk, Prev: Invoking grub-terminfo, Up: Top 896*1b8adde7SWilliam Kucharski 897*1b8adde7SWilliam KucharskiInvoking grub-set-default 898*1b8adde7SWilliam Kucharski************************* 899*1b8adde7SWilliam Kucharski 900*1b8adde7SWilliam Kucharski The program `grub-set-default' sets the default boot entry for GRUB. 901*1b8adde7SWilliam KucharskiThis automatically creates a file named `default' under your GRUB 902*1b8adde7SWilliam Kucharskidirectory (i.e. `/boot/grub'), if it is not present. This file is used 903*1b8adde7SWilliam Kucharskito determine the default boot entry when GRUB boots up your system when 904*1b8adde7SWilliam Kucharskiyou use `default saved' in your configuration file (*note default::), 905*1b8adde7SWilliam Kucharskiand to save next default boot entry when you use `savedefault' in a 906*1b8adde7SWilliam Kucharskiboot entry (*note savedefault::). 907*1b8adde7SWilliam Kucharski 908*1b8adde7SWilliam Kucharski `grub-set-default' accepts the following options: 909*1b8adde7SWilliam Kucharski 910*1b8adde7SWilliam Kucharski`--help' 911*1b8adde7SWilliam Kucharski Print a summary of the command-line options and exit. 912*1b8adde7SWilliam Kucharski 913*1b8adde7SWilliam Kucharski`--version' 914*1b8adde7SWilliam Kucharski Print the version information and exit. 915*1b8adde7SWilliam Kucharski 916*1b8adde7SWilliam Kucharski`--root-directory=DIR' 917*1b8adde7SWilliam Kucharski Use the directory DIR instead of the root directory (i.e. `/') to 918*1b8adde7SWilliam Kucharski define the location of the default file. This is useful when you 919*1b8adde7SWilliam Kucharski mount a disk which is used for another system. 920*1b8adde7SWilliam Kucharski 921*1b8adde7SWilliam Kucharski You must specify a single argument to `grub-set-default'. This 922*1b8adde7SWilliam Kucharskiargument is normally the number of a default boot entry. For example, 923*1b8adde7SWilliam Kucharskiif you have this configuration file: 924*1b8adde7SWilliam Kucharski 925*1b8adde7SWilliam Kucharski default saved 926*1b8adde7SWilliam Kucharski timeout 10 927*1b8adde7SWilliam Kucharski 928*1b8adde7SWilliam Kucharski title GNU/Hurd 929*1b8adde7SWilliam Kucharski root (hd0,0) 930*1b8adde7SWilliam Kucharski ... 931*1b8adde7SWilliam Kucharski 932*1b8adde7SWilliam Kucharski title GNU/Linux 933*1b8adde7SWilliam Kucharski root (hd0,1) 934*1b8adde7SWilliam Kucharski ... 935*1b8adde7SWilliam Kucharski 936*1b8adde7SWilliam Kucharski and if you want to set the next default boot entry to GNU/Linux, you 937*1b8adde7SWilliam Kucharskimay execute this command: 938*1b8adde7SWilliam Kucharski 939*1b8adde7SWilliam Kucharski grub-set-default 1 940*1b8adde7SWilliam Kucharski 941*1b8adde7SWilliam Kucharski Because the entry for GNU/Linux is `1'. Note that entries are 942*1b8adde7SWilliam Kucharskicounted from zero. So, if you want to specify GNU/Hurd here, then you 943*1b8adde7SWilliam Kucharskishould specify `0'. 944*1b8adde7SWilliam Kucharski 945*1b8adde7SWilliam Kucharski This feature is very useful if you want to test a new kernel or to 946*1b8adde7SWilliam Kucharskimake your system quite robust. *Note Making your system robust::, for 947*1b8adde7SWilliam Kucharskimore hints about how to set up a robust system. 948*1b8adde7SWilliam Kucharski 949*1b8adde7SWilliam Kucharski 950*1b8adde7SWilliam KucharskiFile: grub.info, Node: Invoking mbchk, Next: Obtaining and Building GRUB, Prev: Invoking grub-set-default, Up: Top 951*1b8adde7SWilliam Kucharski 952*1b8adde7SWilliam KucharskiInvoking mbchk 953*1b8adde7SWilliam Kucharski************** 954*1b8adde7SWilliam Kucharski 955*1b8adde7SWilliam Kucharski The program `mbchk' checks for the format of a Multiboot kernel. We 956*1b8adde7SWilliam Kucharskirecommend using this program before booting your own kernel by GRUB. 957*1b8adde7SWilliam Kucharski 958*1b8adde7SWilliam Kucharski `mbchk' accepts the following options: 959*1b8adde7SWilliam Kucharski 960*1b8adde7SWilliam Kucharski`--help' 961*1b8adde7SWilliam Kucharski Print a summary of the command-line options and exit. 962*1b8adde7SWilliam Kucharski 963*1b8adde7SWilliam Kucharski`--version' 964*1b8adde7SWilliam Kucharski Print the version number of GRUB and exit. 965*1b8adde7SWilliam Kucharski 966*1b8adde7SWilliam Kucharski`--quiet' 967*1b8adde7SWilliam Kucharski Suppress all normal output. 968*1b8adde7SWilliam Kucharski 969*1b8adde7SWilliam Kucharski 970*1b8adde7SWilliam KucharskiFile: grub.info, Node: Obtaining and Building GRUB, Next: Reporting bugs, Prev: Invoking mbchk, Up: Top 971*1b8adde7SWilliam Kucharski 972*1b8adde7SWilliam KucharskiHow to obtain and build GRUB 973*1b8adde7SWilliam Kucharski**************************** 974*1b8adde7SWilliam Kucharski 975*1b8adde7SWilliam Kucharski *Caution:* GRUB requires binutils-2.9.1.0.23 or later because the 976*1b8adde7SWilliam Kucharski GNU assembler has been changed so that it can produce real 16bits 977*1b8adde7SWilliam Kucharski machine code between 2.9.1 and 2.9.1.0.x. See 978*1b8adde7SWilliam Kucharski `http://sources.redhat.com/binutils/', to obtain information on 979*1b8adde7SWilliam Kucharski how to get the latest version. 980*1b8adde7SWilliam Kucharski 981*1b8adde7SWilliam Kucharski GRUB is available from the GNU alpha archive site 982*1b8adde7SWilliam Kucharski`ftp://alpha.gnu.org/gnu/grub' or any of its mirrors. The file will be 983*1b8adde7SWilliam Kucharskinamed grub-version.tar.gz. The current version is 0.95, so the file you 984*1b8adde7SWilliam Kucharskishould grab is: 985*1b8adde7SWilliam Kucharski 986*1b8adde7SWilliam Kucharski `ftp://alpha.gnu.org/gnu/grub/grub-0.95.tar.gz' 987*1b8adde7SWilliam Kucharski 988*1b8adde7SWilliam Kucharski To unbundle GRUB use the instruction: 989*1b8adde7SWilliam Kucharski 990*1b8adde7SWilliam Kucharski zcat grub-0.95.tar.gz | tar xvf - 991*1b8adde7SWilliam Kucharski 992*1b8adde7SWilliam Kucharski which will create a directory called `grub-0.95' with all the 993*1b8adde7SWilliam Kucharskisources. You can look at the file `INSTALL' for detailed instructions 994*1b8adde7SWilliam Kucharskion how to build and install GRUB, but you should be able to just do: 995*1b8adde7SWilliam Kucharski 996*1b8adde7SWilliam Kucharski cd grub-0.95 997*1b8adde7SWilliam Kucharski ./configure 998*1b8adde7SWilliam Kucharski make install 999*1b8adde7SWilliam Kucharski 1000*1b8adde7SWilliam Kucharski This will install the grub shell `grub' (*note Invoking the grub 1001*1b8adde7SWilliam Kucharskishell::), the Multiboot checker `mbchk' (*note Invoking mbchk::), and 1002*1b8adde7SWilliam Kucharskithe GRUB images. This will also install the GRUB manual. 1003*1b8adde7SWilliam Kucharski 1004*1b8adde7SWilliam Kucharski Also, the latest version is available from the CVS. See 1005*1b8adde7SWilliam Kucharski`http://savannah.gnu.org/cvs/?group=grub' for more information. 1006*1b8adde7SWilliam Kucharski 1007*1b8adde7SWilliam Kucharski 1008*1b8adde7SWilliam KucharskiFile: grub.info, Node: Reporting bugs, Next: Future, Prev: Obtaining and Building GRUB, Up: Top 1009*1b8adde7SWilliam Kucharski 1010*1b8adde7SWilliam KucharskiReporting bugs 1011*1b8adde7SWilliam Kucharski************** 1012*1b8adde7SWilliam Kucharski 1013*1b8adde7SWilliam Kucharski These are the guideline for how to report bugs. Take a look at this 1014*1b8adde7SWilliam Kucharskilist below before you submit bugs: 1015*1b8adde7SWilliam Kucharski 1016*1b8adde7SWilliam Kucharski 1. Before getting unsettled, read this manual through and through. 1017*1b8adde7SWilliam Kucharski Also, see the GNU GRUB FAQ 1018*1b8adde7SWilliam Kucharski (http://www.gnu.org/software/grub/grub-faq.html). 1019*1b8adde7SWilliam Kucharski 1020*1b8adde7SWilliam Kucharski 2. Always mention the information on your GRUB. The version number 1021*1b8adde7SWilliam Kucharski and the configuration are quite important. If you build it 1022*1b8adde7SWilliam Kucharski yourself, write the options specified to the configure script and 1023*1b8adde7SWilliam Kucharski your operating system, including the versions of gcc and binutils. 1024*1b8adde7SWilliam Kucharski 1025*1b8adde7SWilliam Kucharski 3. If you have trouble with the installation, inform us of how you 1026*1b8adde7SWilliam Kucharski installed GRUB. Don't omit error messages, if any. Just `GRUB hangs 1027*1b8adde7SWilliam Kucharski up when it boots' is not enough. 1028*1b8adde7SWilliam Kucharski 1029*1b8adde7SWilliam Kucharski The information on your hardware is also essential. These are 1030*1b8adde7SWilliam Kucharski especially important: the geometries and the partition tables of 1031*1b8adde7SWilliam Kucharski your hard disk drives and your BIOS. 1032*1b8adde7SWilliam Kucharski 1033*1b8adde7SWilliam Kucharski 4. If GRUB cannot boot your operating system, write down _everything_ 1034*1b8adde7SWilliam Kucharski you see on the screen. Don't paraphrase them, like `The foo OS 1035*1b8adde7SWilliam Kucharski crashes with GRUB, even though it can boot with the bar boot 1036*1b8adde7SWilliam Kucharski loader just fine'. Mention the commands you executed, the messages 1037*1b8adde7SWilliam Kucharski printed by them, and information on your operating system 1038*1b8adde7SWilliam Kucharski including the version number. 1039*1b8adde7SWilliam Kucharski 1040*1b8adde7SWilliam Kucharski 5. Explain what you wanted to do. It is very useful to know your 1041*1b8adde7SWilliam Kucharski purpose and your wish, and how GRUB didn't satisfy you. 1042*1b8adde7SWilliam Kucharski 1043*1b8adde7SWilliam Kucharski 6. If you can investigate the problem yourself, please do. That will 1044*1b8adde7SWilliam Kucharski give you and us much more information on the problem. Attaching a 1045*1b8adde7SWilliam Kucharski patch is even better. 1046*1b8adde7SWilliam Kucharski 1047*1b8adde7SWilliam Kucharski When you attach a patch, make the patch in unified diff format, and 1048*1b8adde7SWilliam Kucharski write ChangeLog entries. But, even when you make a patch, don't 1049*1b8adde7SWilliam Kucharski forget to explain the problem, so that we can understand what your 1050*1b8adde7SWilliam Kucharski patch is for. 1051*1b8adde7SWilliam Kucharski 1052*1b8adde7SWilliam Kucharski 7. Write down anything that you think might be related. Please 1053*1b8adde7SWilliam Kucharski understand that we often need to reproduce the same problem you 1054*1b8adde7SWilliam Kucharski encounterred in our environment. So your information should be 1055*1b8adde7SWilliam Kucharski sufficient for us to do the same thing--Don't forget that we 1056*1b8adde7SWilliam Kucharski cannot see your computer directly. If you are not sure whether to 1057*1b8adde7SWilliam Kucharski state a fact or leave it out, state it! Reporting too many things 1058*1b8adde7SWilliam Kucharski is much better than omitting something important. 1059*1b8adde7SWilliam Kucharski 1060*1b8adde7SWilliam Kucharski If you follow the guideline above, submit a report to the Bug 1061*1b8adde7SWilliam KucharskiTracking System (http://savannah.gnu.org/bugs/?group=grub). 1062*1b8adde7SWilliam KucharskiAlternatively, you can submit a report via electronic mail to 1063*1b8adde7SWilliam Kucharski<bug-grub@gnu.org>, but we strongly recommend that you use the Bug 1064*1b8adde7SWilliam KucharskiTracking System, because e-mail can be passed over easily. 1065*1b8adde7SWilliam Kucharski 1066*1b8adde7SWilliam Kucharski Once we get your report, we will try to fix the bugs. 1067*1b8adde7SWilliam Kucharski 1068*1b8adde7SWilliam Kucharski 1069*1b8adde7SWilliam KucharskiFile: grub.info, Node: Future, Next: Internals, Prev: Reporting bugs, Up: Top 1070*1b8adde7SWilliam Kucharski 1071*1b8adde7SWilliam KucharskiWhere GRUB will go 1072*1b8adde7SWilliam Kucharski****************** 1073*1b8adde7SWilliam Kucharski 1074*1b8adde7SWilliam Kucharski We started the next generation of GRUB, GRUB 2. This will include 1075*1b8adde7SWilliam Kucharskiinternationalization, dynamic module loading, real memory management, 1076*1b8adde7SWilliam Kucharskimultiple architecture support, a scripting language, and many other 1077*1b8adde7SWilliam Kucharskinice feature. If you are interested in the development of GRUB 2, take 1078*1b8adde7SWilliam Kucharskia look at the homepage (http://www.gnu.org/software/grub/grub.html). 1079*1b8adde7SWilliam Kucharski 1080*1b8adde7SWilliam Kucharski 1081*1b8adde7SWilliam KucharskiFile: grub.info, Node: Internals, Next: Index, Prev: Future, Up: Top 1082*1b8adde7SWilliam Kucharski 1083*1b8adde7SWilliam KucharskiHacking GRUB 1084*1b8adde7SWilliam Kucharski************ 1085*1b8adde7SWilliam Kucharski 1086*1b8adde7SWilliam Kucharski This chapter documents the user-invisible aspect of GRUB. 1087*1b8adde7SWilliam Kucharski 1088*1b8adde7SWilliam Kucharski As a general rule of software development, it is impossible to keep 1089*1b8adde7SWilliam Kucharskithe descriptions of the internals up-to-date, and it is quite hard to 1090*1b8adde7SWilliam Kucharskidocument everything. So refer to the source code, whenever you are not 1091*1b8adde7SWilliam Kucharskisatisfied with this documentation. Please assume that this gives just 1092*1b8adde7SWilliam Kucharskihints to you. 1093*1b8adde7SWilliam Kucharski 1094*1b8adde7SWilliam Kucharski* Menu: 1095*1b8adde7SWilliam Kucharski 1096*1b8adde7SWilliam Kucharski* Memory map:: The memory map of various components 1097*1b8adde7SWilliam Kucharski* Embedded data:: Embedded variables in GRUB 1098*1b8adde7SWilliam Kucharski* Filesystem interface:: The generic interface for filesystems 1099*1b8adde7SWilliam Kucharski* Command interface:: The generic interface for built-ins 1100*1b8adde7SWilliam Kucharski* Bootstrap tricks:: The bootstrap mechanism used in GRUB 1101*1b8adde7SWilliam Kucharski* I/O ports detection:: How to probe I/O ports used by INT 13H 1102*1b8adde7SWilliam Kucharski* Memory detection:: How to detect all installed RAM 1103*1b8adde7SWilliam Kucharski* Low-level disk I/O:: INT 13H disk I/O interrupts 1104*1b8adde7SWilliam Kucharski* MBR:: The structure of Master Boot Record 1105*1b8adde7SWilliam Kucharski* Partition table:: The format of partition tables 1106*1b8adde7SWilliam Kucharski* Submitting patches:: Where and how you should send patches 1107*1b8adde7SWilliam Kucharski 1108*1b8adde7SWilliam Kucharski 1109*1b8adde7SWilliam KucharskiFile: grub.info, Node: Memory map, Next: Embedded data, Up: Internals 1110*1b8adde7SWilliam Kucharski 1111*1b8adde7SWilliam KucharskiThe memory map of various components 1112*1b8adde7SWilliam Kucharski==================================== 1113*1b8adde7SWilliam Kucharski 1114*1b8adde7SWilliam Kucharski GRUB consists of two distinct components, called "stages", which are 1115*1b8adde7SWilliam Kucharskiloaded at different times in the boot process. Because they run 1116*1b8adde7SWilliam Kucharskimutual-exclusively, sometimes a memory area overlaps with another 1117*1b8adde7SWilliam Kucharskimemory area. And, even in one stage, a single memory area can be used 1118*1b8adde7SWilliam Kucharskifor various purposes, because their usages are mutually exclusive. 1119*1b8adde7SWilliam Kucharski 1120*1b8adde7SWilliam Kucharski Here is the memory map of the various components: 1121*1b8adde7SWilliam Kucharski 1122*1b8adde7SWilliam Kucharski0 to 4K-1 1123*1b8adde7SWilliam Kucharski BIOS and real mode interrupts 1124*1b8adde7SWilliam Kucharski 1125*1b8adde7SWilliam Kucharski0x07BE to 0x07FF 1126*1b8adde7SWilliam Kucharski Partition table passed to another boot loader 1127*1b8adde7SWilliam Kucharski 1128*1b8adde7SWilliam Kucharskidown from 8K-1 1129*1b8adde7SWilliam Kucharski Real mode stack 1130*1b8adde7SWilliam Kucharski 1131*1b8adde7SWilliam Kucharski0x2000 to ? 1132*1b8adde7SWilliam Kucharski The optional Stage 1.5 is loaded here 1133*1b8adde7SWilliam Kucharski 1134*1b8adde7SWilliam Kucharski0x2000 to 0x7FFF 1135*1b8adde7SWilliam Kucharski Command-line buffer for Multiboot kernels and modules 1136*1b8adde7SWilliam Kucharski 1137*1b8adde7SWilliam Kucharski0x7C00 to 0x7DFF 1138*1b8adde7SWilliam Kucharski Stage 1 is loaded here by BIOS or another boot loader 1139*1b8adde7SWilliam Kucharski 1140*1b8adde7SWilliam Kucharski0x7F00 to 0x7F42 1141*1b8adde7SWilliam Kucharski LBA drive parameters 1142*1b8adde7SWilliam Kucharski 1143*1b8adde7SWilliam Kucharski0x8000 to ? 1144*1b8adde7SWilliam Kucharski Stage2 is loaded here 1145*1b8adde7SWilliam Kucharski 1146*1b8adde7SWilliam KucharskiThe end of Stage 2 to 416K-1 1147*1b8adde7SWilliam Kucharski Heap, in particular used for the menu 1148*1b8adde7SWilliam Kucharski 1149*1b8adde7SWilliam Kucharskidown from 416K-1 1150*1b8adde7SWilliam Kucharski Protected mode stack 1151*1b8adde7SWilliam Kucharski 1152*1b8adde7SWilliam Kucharski416K to 448K-1 1153*1b8adde7SWilliam Kucharski Filesystem buffer 1154*1b8adde7SWilliam Kucharski 1155*1b8adde7SWilliam Kucharski448K to 479.5K-1 1156*1b8adde7SWilliam Kucharski Raw device buffer 1157*1b8adde7SWilliam Kucharski 1158*1b8adde7SWilliam Kucharski479.5K to 480K-1 1159*1b8adde7SWilliam Kucharski 512-byte scratch area 1160*1b8adde7SWilliam Kucharski 1161*1b8adde7SWilliam Kucharski480K to 512K-1 1162*1b8adde7SWilliam Kucharski Buffers for various functions, such as password, command-line, cut 1163*1b8adde7SWilliam Kucharski and paste, and completion. 1164*1b8adde7SWilliam Kucharski 1165*1b8adde7SWilliam KucharskiThe last 1K of lower memory 1166*1b8adde7SWilliam Kucharski Disk swapping code and data 1167*1b8adde7SWilliam Kucharski 1168*1b8adde7SWilliam Kucharski See the file `stage2/shared.h', for more information. 1169*1b8adde7SWilliam Kucharski 1170*1b8adde7SWilliam Kucharski 1171*1b8adde7SWilliam KucharskiFile: grub.info, Node: Embedded data, Next: Filesystem interface, Prev: Memory map, Up: Internals 1172*1b8adde7SWilliam Kucharski 1173*1b8adde7SWilliam KucharskiEmbedded variables in GRUB 1174*1b8adde7SWilliam Kucharski========================== 1175*1b8adde7SWilliam Kucharski 1176*1b8adde7SWilliam Kucharski Stage 1 and Stage 2 have embedded variables whose locations are 1177*1b8adde7SWilliam Kucharskiwell-defined, so that the installation can patch the binary file 1178*1b8adde7SWilliam Kucharskidirectly without recompilation of the stages. 1179*1b8adde7SWilliam Kucharski 1180*1b8adde7SWilliam Kucharski In Stage 1, these are defined: 1181*1b8adde7SWilliam Kucharski 1182*1b8adde7SWilliam Kucharski`0x3E' 1183*1b8adde7SWilliam Kucharski The version number (not GRUB's, but the installation mechanism's). 1184*1b8adde7SWilliam Kucharski 1185*1b8adde7SWilliam Kucharski`0x40' 1186*1b8adde7SWilliam Kucharski The boot drive. If it is 0xFF, use a drive passed by BIOS. 1187*1b8adde7SWilliam Kucharski 1188*1b8adde7SWilliam Kucharski`0x41' 1189*1b8adde7SWilliam Kucharski The flag for if forcing LBA. 1190*1b8adde7SWilliam Kucharski 1191*1b8adde7SWilliam Kucharski`0x42' 1192*1b8adde7SWilliam Kucharski The starting address of Stage 2. 1193*1b8adde7SWilliam Kucharski 1194*1b8adde7SWilliam Kucharski`0x44' 1195*1b8adde7SWilliam Kucharski The first sector of Stage 2. 1196*1b8adde7SWilliam Kucharski 1197*1b8adde7SWilliam Kucharski`0x48' 1198*1b8adde7SWilliam Kucharski The starting segment of Stage 2. 1199*1b8adde7SWilliam Kucharski 1200*1b8adde7SWilliam Kucharski`0x1FE' 1201*1b8adde7SWilliam Kucharski The signature (`0xAA55'). 1202*1b8adde7SWilliam Kucharski 1203*1b8adde7SWilliam Kucharski See the file `stage1/stage1.S', for more information. 1204*1b8adde7SWilliam Kucharski 1205*1b8adde7SWilliam Kucharski In the first sector of Stage 1.5 and Stage 2, the block lists are 1206*1b8adde7SWilliam Kucharskirecorded between `firstlist' and `lastlist'. The address of `lastlist' 1207*1b8adde7SWilliam Kucharskiis determined when assembling the file `stage2/start.S'. 1208*1b8adde7SWilliam Kucharski 1209*1b8adde7SWilliam Kucharski The trick here is that it is actually read backward, and the first 1210*1b8adde7SWilliam Kucharski8-byte block list is not read here, but after the pointer is decremented 1211*1b8adde7SWilliam Kucharski8 bytes, then after reading it, it decrements again, reads, and so on, 1212*1b8adde7SWilliam Kucharskiuntil it is finished. The terminating condition is when the number of 1213*1b8adde7SWilliam Kucharskisectors to be read in the next block list is zero. 1214*1b8adde7SWilliam Kucharski 1215*1b8adde7SWilliam Kucharski The format of a block list can be seen from the example in the code 1216*1b8adde7SWilliam Kucharskijust before the `firstlist' label. Note that it is always from the 1217*1b8adde7SWilliam Kucharskibeginning of the disk, but _not_ relative to the partition boundaries. 1218*1b8adde7SWilliam Kucharski 1219*1b8adde7SWilliam Kucharski In the second sector of Stage 1.5 and Stage 2, these are defined: 1220*1b8adde7SWilliam Kucharski 1221*1b8adde7SWilliam Kucharski`0x6' 1222*1b8adde7SWilliam Kucharski The version number (likewise, the installation mechanism's). 1223*1b8adde7SWilliam Kucharski 1224*1b8adde7SWilliam Kucharski`0x8' 1225*1b8adde7SWilliam Kucharski The installed partition. 1226*1b8adde7SWilliam Kucharski 1227*1b8adde7SWilliam Kucharski`0xC' 1228*1b8adde7SWilliam Kucharski The saved entry number. 1229*1b8adde7SWilliam Kucharski 1230*1b8adde7SWilliam Kucharski`0x10' 1231*1b8adde7SWilliam Kucharski The identifier. 1232*1b8adde7SWilliam Kucharski 1233*1b8adde7SWilliam Kucharski`0x11' 1234*1b8adde7SWilliam Kucharski The flag for if forcing LBA. 1235*1b8adde7SWilliam Kucharski 1236*1b8adde7SWilliam Kucharski`0x12' 1237*1b8adde7SWilliam Kucharski The version string (GRUB's). 1238*1b8adde7SWilliam Kucharski 1239*1b8adde7SWilliam Kucharski`0x12' + "the length of the version string" 1240*1b8adde7SWilliam Kucharski The name of a configuration file. 1241*1b8adde7SWilliam Kucharski 1242*1b8adde7SWilliam Kucharski See the file `stage2/asm.S', for more information. 1243*1b8adde7SWilliam Kucharski 1244*1b8adde7SWilliam Kucharski 1245*1b8adde7SWilliam KucharskiFile: grub.info, Node: Filesystem interface, Next: Command interface, Prev: Embedded data, Up: Internals 1246*1b8adde7SWilliam Kucharski 1247*1b8adde7SWilliam KucharskiThe generic interface for filesystems 1248*1b8adde7SWilliam Kucharski===================================== 1249*1b8adde7SWilliam Kucharski 1250*1b8adde7SWilliam Kucharski For any particular partition, it is presumed that only one of the 1251*1b8adde7SWilliam Kucharski"normal" filesystems such as FAT, FFS, or ext2fs can be used, so there 1252*1b8adde7SWilliam Kucharskiis a switch table managed by the functions in `disk_io.c'. The notation 1253*1b8adde7SWilliam Kucharskiis that you can only "mount" one at a time. 1254*1b8adde7SWilliam Kucharski 1255*1b8adde7SWilliam Kucharski The block list filesystem has a special place in the system. In 1256*1b8adde7SWilliam Kucharskiaddition to the "normal" filesystem (or even without one mounted), you 1257*1b8adde7SWilliam Kucharskican access disk blocks directly (in the indicated partition) via the 1258*1b8adde7SWilliam Kucharskiblock list notation. Using the block list filesystem doesn't effect any 1259*1b8adde7SWilliam Kucharskiother filesystem mounts. 1260*1b8adde7SWilliam Kucharski 1261*1b8adde7SWilliam Kucharski The variables which can be read by the filesystem backend are: 1262*1b8adde7SWilliam Kucharski 1263*1b8adde7SWilliam Kucharski`current_drive' 1264*1b8adde7SWilliam Kucharski The current BIOS drive number (numbered from 0, if a floppy, and 1265*1b8adde7SWilliam Kucharski numbered from 0x80, if a hard disk). 1266*1b8adde7SWilliam Kucharski 1267*1b8adde7SWilliam Kucharski`current_partition' 1268*1b8adde7SWilliam Kucharski The current partition number. 1269*1b8adde7SWilliam Kucharski 1270*1b8adde7SWilliam Kucharski`current_slice' 1271*1b8adde7SWilliam Kucharski The current partition type. 1272*1b8adde7SWilliam Kucharski 1273*1b8adde7SWilliam Kucharski`saved_drive' 1274*1b8adde7SWilliam Kucharski The "drive" part of the root device. 1275*1b8adde7SWilliam Kucharski 1276*1b8adde7SWilliam Kucharski`saved_partition' 1277*1b8adde7SWilliam Kucharski The "partition" part of the root device. 1278*1b8adde7SWilliam Kucharski 1279*1b8adde7SWilliam Kucharski`part_start' 1280*1b8adde7SWilliam Kucharski The current partition starting address, in sectors. 1281*1b8adde7SWilliam Kucharski 1282*1b8adde7SWilliam Kucharski`part_length' 1283*1b8adde7SWilliam Kucharski The current partition length, in sectors. 1284*1b8adde7SWilliam Kucharski 1285*1b8adde7SWilliam Kucharski`print_possibilities' 1286*1b8adde7SWilliam Kucharski True when the `dir' function should print the possible completions 1287*1b8adde7SWilliam Kucharski of a file, and false when it should try to actually open a file of 1288*1b8adde7SWilliam Kucharski that name. 1289*1b8adde7SWilliam Kucharski 1290*1b8adde7SWilliam Kucharski`FSYS_BUF' 1291*1b8adde7SWilliam Kucharski Filesystem buffer which is 32K in size, to use in any way which the 1292*1b8adde7SWilliam Kucharski filesystem backend desires. 1293*1b8adde7SWilliam Kucharski 1294*1b8adde7SWilliam Kucharski The variables which need to be written by a filesystem backend are: 1295*1b8adde7SWilliam Kucharski 1296*1b8adde7SWilliam Kucharski`filepos' 1297*1b8adde7SWilliam Kucharski The current position in the file, in sectors. 1298*1b8adde7SWilliam Kucharski 1299*1b8adde7SWilliam Kucharski *Caution:* the value of FILEPOS can be changed out from under the 1300*1b8adde7SWilliam Kucharski filesystem code in the current implementation. Don't depend on it 1301*1b8adde7SWilliam Kucharski being the same for later calls into the backend code! 1302*1b8adde7SWilliam Kucharski 1303*1b8adde7SWilliam Kucharski`filemax' 1304*1b8adde7SWilliam Kucharski The length of the file. 1305*1b8adde7SWilliam Kucharski 1306*1b8adde7SWilliam Kucharski`disk_read_func' 1307*1b8adde7SWilliam Kucharski The value of DISK_READ_HOOK _only_ during reading of data for the 1308*1b8adde7SWilliam Kucharski file, not any other fs data, inodes, FAT tables, whatever, then 1309*1b8adde7SWilliam Kucharski set to `NULL' at all other times (it will be `NULL' by default). 1310*1b8adde7SWilliam Kucharski If this isn't done correctly, then the `testload' and `install' 1311*1b8adde7SWilliam Kucharski commands won't work correctly. 1312*1b8adde7SWilliam Kucharski 1313*1b8adde7SWilliam Kucharski The functions expected to be used by the filesystem backend are: 1314*1b8adde7SWilliam Kucharski 1315*1b8adde7SWilliam Kucharski`devread' 1316*1b8adde7SWilliam Kucharski Only read sectors from within a partition. Sector 0 is the first 1317*1b8adde7SWilliam Kucharski sector in the partition. 1318*1b8adde7SWilliam Kucharski 1319*1b8adde7SWilliam Kucharski`grub_read' 1320*1b8adde7SWilliam Kucharski If the backend uses the block list code, then `grub_read' can be 1321*1b8adde7SWilliam Kucharski used, after setting BLOCK_FILE to 1. 1322*1b8adde7SWilliam Kucharski 1323*1b8adde7SWilliam Kucharski`print_a_completion' 1324*1b8adde7SWilliam Kucharski If PRINT_POSSIBILITIES is true, call `print_a_completion' for each 1325*1b8adde7SWilliam Kucharski possible file name. Otherwise, the file name completion won't work. 1326*1b8adde7SWilliam Kucharski 1327*1b8adde7SWilliam Kucharski The functions expected to be defined by the filesystem backend are 1328*1b8adde7SWilliam Kucharskidescribed at least moderately in the file `filesys.h'. Their usage is 1329*1b8adde7SWilliam Kucharskifairly evident from their use in the functions in `disk_io.c', look for 1330*1b8adde7SWilliam Kucharskithe use of the FSYS_TABLE array. 1331*1b8adde7SWilliam Kucharski 1332*1b8adde7SWilliam Kucharski *Caution:* The semantics are such that then `mount'ing the 1333*1b8adde7SWilliam Kucharskifilesystem, presume the filesystem buffer `FSYS_BUF' is corrupted, and 1334*1b8adde7SWilliam Kucharski(re-)load all important contents. When opening and reading a file, 1335*1b8adde7SWilliam Kucharskipresume that the data from the `mount' is available, and doesn't get 1336*1b8adde7SWilliam Kucharskicorrupted by the open/read (i.e. multiple opens and/or reads will be 1337*1b8adde7SWilliam Kucharskidone with only one mount if in the same filesystem). 1338*1b8adde7SWilliam Kucharski 1339*1b8adde7SWilliam Kucharski 1340*1b8adde7SWilliam KucharskiFile: grub.info, Node: Command interface, Next: Bootstrap tricks, Prev: Filesystem interface, Up: Internals 1341*1b8adde7SWilliam Kucharski 1342*1b8adde7SWilliam KucharskiThe generic interface for built-ins 1343*1b8adde7SWilliam Kucharski=================================== 1344*1b8adde7SWilliam Kucharski 1345*1b8adde7SWilliam Kucharski GRUB built-in commands are defined in a uniformal interface, whether 1346*1b8adde7SWilliam Kucharskithey are menu-specific or can be used anywhere. The definition of a 1347*1b8adde7SWilliam Kucharskibuiltin command consists of two parts: the code itself and the table of 1348*1b8adde7SWilliam Kucharskithe information. 1349*1b8adde7SWilliam Kucharski 1350*1b8adde7SWilliam Kucharski The code must be a function which takes two arguments, a command-line 1351*1b8adde7SWilliam Kucharskistring and flags, and returns an `int' value. The "flags" argument 1352*1b8adde7SWilliam Kucharskispecifies how the function is called, using a bit mask. The return 1353*1b8adde7SWilliam Kucharskivalue must be zero if successful, otherwise non-zero. So it is normally 1354*1b8adde7SWilliam Kucharskienough to return ERRNUM. 1355*1b8adde7SWilliam Kucharski 1356*1b8adde7SWilliam Kucharski The table of the information is represented by the structure `struct 1357*1b8adde7SWilliam Kucharskibuiltin', which contains the name of the command, a pointer to the 1358*1b8adde7SWilliam Kucharskifunction, flags, a short description of the command and a long 1359*1b8adde7SWilliam Kucharskidescription of the command. Since the descriptions are used only for 1360*1b8adde7SWilliam Kucharskihelp messages interactively, you don't have to define them, if the 1361*1b8adde7SWilliam Kucharskicommand may not be called interactively (such as `title'). 1362*1b8adde7SWilliam Kucharski 1363*1b8adde7SWilliam Kucharski The table is finally registered in the table BUILTIN_TABLE, so that 1364*1b8adde7SWilliam Kucharski`run_script' and `enter_cmdline' can find the command. See the files 1365*1b8adde7SWilliam Kucharski`cmdline.c' and `builtins.c', for more details. 1366*1b8adde7SWilliam Kucharski 1367