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