17c478bd9Sstevel@tonic-gateThis is grub.info, produced by makeinfo version 4.0 from grub.texi. 27c478bd9Sstevel@tonic-gate 37c478bd9Sstevel@tonic-gateINFO-DIR-SECTION Kernel 47c478bd9Sstevel@tonic-gateSTART-INFO-DIR-ENTRY 57c478bd9Sstevel@tonic-gate* GRUB: (grub). The GRand Unified Bootloader 67c478bd9Sstevel@tonic-gate* grub-install: (grub)Invoking grub-install. Install GRUB on your drive 77c478bd9Sstevel@tonic-gate* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password 87c478bd9Sstevel@tonic-gate in MD5 format 97c478bd9Sstevel@tonic-gate* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo 107c478bd9Sstevel@tonic-gate command from a 117c478bd9Sstevel@tonic-gate terminfo name 127c478bd9Sstevel@tonic-gate* grub-set-default: (grub)Invoking grub-set-default. Set a default boot 137c478bd9Sstevel@tonic-gate entry 147c478bd9Sstevel@tonic-gate* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel 157c478bd9Sstevel@tonic-gateEND-INFO-DIR-ENTRY 167c478bd9Sstevel@tonic-gate 177c478bd9Sstevel@tonic-gate Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc. 187c478bd9Sstevel@tonic-gate 197c478bd9Sstevel@tonic-gate Permission is granted to make and distribute verbatim copies of this 207c478bd9Sstevel@tonic-gatemanual provided the copyright notice and this permission notice are 217c478bd9Sstevel@tonic-gatepreserved on all copies. 227c478bd9Sstevel@tonic-gate 237c478bd9Sstevel@tonic-gate Permission is granted to copy and distribute modified versions of 247c478bd9Sstevel@tonic-gatethis manual under the conditions for verbatim copying, provided also 257c478bd9Sstevel@tonic-gatethat the entire resulting derived work is distributed under the terms 267c478bd9Sstevel@tonic-gateof a permission notice identical to this one. 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate Permission is granted to copy and distribute translations of this 297c478bd9Sstevel@tonic-gatemanual into another language, under the above conditions for modified 307c478bd9Sstevel@tonic-gateversions. 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gateFile: grub.info, Node: Top, Next: Introduction, Up: (dir) 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gateGRUB manual 367c478bd9Sstevel@tonic-gate*********** 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate This is the documentation of GNU GRUB, the GRand Unified Bootloader, 397c478bd9Sstevel@tonic-gatea flexible and powerful boot loader program for PCs. 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate This edition documents version 0.95. 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate* Menu: 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate* Introduction:: Capturing the spirit of GRUB 467c478bd9Sstevel@tonic-gate* Naming convention:: Names of your drives in GRUB 477c478bd9Sstevel@tonic-gate* Installation:: Installing GRUB on your drive 487c478bd9Sstevel@tonic-gate* Booting:: How to boot different operating systems 497c478bd9Sstevel@tonic-gate* Configuration:: Writing your own configuration file 507c478bd9Sstevel@tonic-gate* Network:: Downloading OS images from a network 517c478bd9Sstevel@tonic-gate* Serial terminal:: Using GRUB via a serial line 527c478bd9Sstevel@tonic-gate* Preset Menu:: Embedding a configuration file into GRUB 537c478bd9Sstevel@tonic-gate* Security:: Improving the security 547c478bd9Sstevel@tonic-gate* Images:: GRUB image files 557c478bd9Sstevel@tonic-gate* Filesystem:: Filesystem syntax and semantics 567c478bd9Sstevel@tonic-gate* Interface:: The menu and the command-line 577c478bd9Sstevel@tonic-gate* Commands:: The list of available builtin commands 587c478bd9Sstevel@tonic-gate* Troubleshooting:: Error messages produced by GRUB 597c478bd9Sstevel@tonic-gate* Invoking the grub shell:: How to use the grub shell 607c478bd9Sstevel@tonic-gate* Invoking grub-install:: How to use the GRUB installer 617c478bd9Sstevel@tonic-gate* Invoking grub-md5-crypt:: How to generate a cryptic password 627c478bd9Sstevel@tonic-gate* Invoking grub-terminfo:: How to generate a terminfo command 637c478bd9Sstevel@tonic-gate* Invoking grub-set-default:: How to set a default boot entry 647c478bd9Sstevel@tonic-gate* Invoking mbchk:: How to use the Multiboot checker 657c478bd9Sstevel@tonic-gate* Obtaining and Building GRUB:: How to obtain and build GRUB 667c478bd9Sstevel@tonic-gate* Reporting bugs:: Where you should send a bug report 677c478bd9Sstevel@tonic-gate* Future:: Some future plans on GRUB 687c478bd9Sstevel@tonic-gate* Internals:: Hacking GRUB 697c478bd9Sstevel@tonic-gate* Index:: 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gateFile: grub.info, Node: Introduction, Next: Naming convention, Prev: Top, Up: Top 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gateIntroduction to GRUB 757c478bd9Sstevel@tonic-gate******************** 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate* Menu: 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate* Overview:: What exactly GRUB is and how to use it 807c478bd9Sstevel@tonic-gate* History:: From maggot to house fly 817c478bd9Sstevel@tonic-gate* Features:: GRUB features 827c478bd9Sstevel@tonic-gate* Role of a boot loader:: The role of a boot loader 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gateFile: grub.info, Node: Overview, Next: History, Up: Introduction 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gateOverview 887c478bd9Sstevel@tonic-gate======== 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate Briefly, a "boot loader" is the first software program that runs when 917c478bd9Sstevel@tonic-gatea computer starts. It is responsible for loading and transferring 927c478bd9Sstevel@tonic-gatecontrol to an operating system "kernel" software (such as Linux or GNU 937c478bd9Sstevel@tonic-gateMach). The kernel, in turn, initializes the rest of the operating 947c478bd9Sstevel@tonic-gatesystem (e.g. a GNU system). 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate GNU GRUB is a very powerful boot loader, which can load a wide 977c478bd9Sstevel@tonic-gatevariety of free operating systems, as well as proprietary operating 987c478bd9Sstevel@tonic-gatesystems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is 997c478bd9Sstevel@tonic-gatedesigned to address the complexity of booting a personal computer; both 1007c478bd9Sstevel@tonic-gatethe program and this manual are tightly bound to that computer platform, 1017c478bd9Sstevel@tonic-gatealthough porting to other platforms may be addressed in the future. 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate One of the important features in GRUB is flexibility; GRUB 1047c478bd9Sstevel@tonic-gateunderstands filesystems and kernel executable formats, so you can load 1057c478bd9Sstevel@tonic-gatean arbitrary operating system the way you like, without recording the 1067c478bd9Sstevel@tonic-gatephysical position of your kernel on the disk. Thus you can load the 1077c478bd9Sstevel@tonic-gatekernel just by specifying its file name and the drive and partition 1087c478bd9Sstevel@tonic-gatewhere the kernel resides. 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate When booting with GRUB, you can use either a command-line interface 1117c478bd9Sstevel@tonic-gate(*note Command-line interface::), or a menu interface (*note Menu 1127c478bd9Sstevel@tonic-gateinterface::). Using the command-line interface, you type the drive 1137c478bd9Sstevel@tonic-gatespecification and file name of the kernel manually. In the menu 1147c478bd9Sstevel@tonic-gateinterface, you just select an OS using the arrow keys. The menu is 1157c478bd9Sstevel@tonic-gatebased on a configuration file which you prepare beforehand (*note 1167c478bd9Sstevel@tonic-gateConfiguration::). While in the menu, you can switch to the command-line 1177c478bd9Sstevel@tonic-gatemode, and vice-versa. You can even edit menu entries before using them. 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate In the following chapters, you will learn how to specify a drive, a 1207c478bd9Sstevel@tonic-gatepartition, and a file name (*note Naming convention::) to GRUB, how to 1217c478bd9Sstevel@tonic-gateinstall GRUB on your drive (*note Installation::), and how to boot your 1227c478bd9Sstevel@tonic-gateOSes (*note Booting::), step by step. 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate Besides the GRUB boot loader itself, there is a "grub shell" `grub' 1257c478bd9Sstevel@tonic-gate(*note Invoking the grub shell::) which can be run when you are in your 1267c478bd9Sstevel@tonic-gateoperating system. It emulates the boot loader and can be used for 1277c478bd9Sstevel@tonic-gateinstalling the boot loader. 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gateFile: grub.info, Node: Overview-Footnotes, Up: Overview 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate (1) "chain-load" is the mechanism for loading unsupported operating 1337c478bd9Sstevel@tonic-gatesystems by loading another boot loader. It is typically used for 1347c478bd9Sstevel@tonic-gateloading DOS or Windows. 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gateFile: grub.info, Node: History, Next: Features, Prev: Overview, Up: Introduction 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gateHistory of GRUB 1407c478bd9Sstevel@tonic-gate=============== 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU 1437c478bd9Sstevel@tonic-gateHurd with the University of Utah's Mach 4 microkernel (now known as GNU 1447c478bd9Sstevel@tonic-gateMach). Erich and Brian Ford designed the Multiboot Specification 1457c478bd9Sstevel@tonic-gate(*note Multiboot Specification: (multiboot)Top.), because they were 1467c478bd9Sstevel@tonic-gatedetermined not to add to the large number of mutually-incompatible PC 1477c478bd9Sstevel@tonic-gateboot methods. 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate Erich then began modifying the FreeBSD boot loader so that it would 1507c478bd9Sstevel@tonic-gateunderstand Multiboot. He soon realized that it would be a lot easier to 1517c478bd9Sstevel@tonic-gatewrite his own boot loader from scratch than to keep working on the 1527c478bd9Sstevel@tonic-gateFreeBSD boot loader, and so GRUB was born. 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate Erich added many features to GRUB, but other priorities prevented him 1557c478bd9Sstevel@tonic-gatefrom keeping up with the demands of its quickly-expanding user base. In 1567c478bd9Sstevel@tonic-gate1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an 1577c478bd9Sstevel@tonic-gateofficial GNU package, and opened its development by making the latest 1587c478bd9Sstevel@tonic-gatesources available via anonymous CVS. *Note Obtaining and Building 1597c478bd9Sstevel@tonic-gateGRUB::, for more information. 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gateFile: grub.info, Node: Features, Next: Role of a boot loader, Prev: History, Up: Introduction 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gateGRUB features 1657c478bd9Sstevel@tonic-gate============= 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate The primary requirement for GRUB is that it be compliant with the 1687c478bd9Sstevel@tonic-gate"Multiboot Specification", which is described in *Note Multiboot 1697c478bd9Sstevel@tonic-gateSpecification: (multiboot)Top. 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate The other goals, listed in approximate order of importance, are: 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate * Basic functions must be straightforward for end-users. 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate * Rich functionality to support kernel experts and designers. 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate * Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and 1787c478bd9Sstevel@tonic-gate Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are 1797c478bd9Sstevel@tonic-gate supported via a chain-loading function. 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate Except for specific compatibility modes (chain-loading and the Linux 1827c478bd9Sstevel@tonic-gate"piggyback" format), all kernels will be started in much the same state 1837c478bd9Sstevel@tonic-gateas in the Multiboot Specification. Only kernels loaded at 1 megabyte or 1847c478bd9Sstevel@tonic-gateabove are presently supported. Any attempt to load below that boundary 1857c478bd9Sstevel@tonic-gatewill simply result in immediate failure and an error message reporting 1867c478bd9Sstevel@tonic-gatethe problem. 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate In addition to the requirements above, GRUB has the following 1897c478bd9Sstevel@tonic-gatefeatures (note that the Multiboot Specification doesn't require all the 1907c478bd9Sstevel@tonic-gatefeatures that GRUB supports): 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gateRecognize multiple executable formats 1937c478bd9Sstevel@tonic-gate Support many of the "a.out" variants plus "ELF". Symbol tables are 1947c478bd9Sstevel@tonic-gate also loaded. 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gateSupport non-Multiboot kernels 1977c478bd9Sstevel@tonic-gate Support many of the various free 32-bit kernels that lack Multiboot 1987c478bd9Sstevel@tonic-gate compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux). 1997c478bd9Sstevel@tonic-gate Chain-loading of other boot loaders is also supported. 2007c478bd9Sstevel@tonic-gate 2017c478bd9Sstevel@tonic-gateLoad multiples modules 2027c478bd9Sstevel@tonic-gate Fully support the Multiboot feature of loading multiple modules. 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gateLoad a configuration file 2057c478bd9Sstevel@tonic-gate Support a human-readable text configuration file with preset boot 2067c478bd9Sstevel@tonic-gate commands. You can also load another configuration file dynamically 2077c478bd9Sstevel@tonic-gate and embed a preset configuration file in a GRUB image file. The 2087c478bd9Sstevel@tonic-gate list of commands (*note Commands::) are a superset of those 2097c478bd9Sstevel@tonic-gate supported on the command-line. An example configuration file is 2107c478bd9Sstevel@tonic-gate provided in *Note Configuration::. 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gateProvide a menu interface 2137c478bd9Sstevel@tonic-gate A menu interface listing preset boot commands, with a programmable 2147c478bd9Sstevel@tonic-gate timeout, is available. There is no fixed limit on the number of 2157c478bd9Sstevel@tonic-gate boot entries, and the current implementation has space for several 2167c478bd9Sstevel@tonic-gate hundred. 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gateHave a flexible command-line interface 2197c478bd9Sstevel@tonic-gate A fairly flexible command-line interface, accessible from the menu, 2207c478bd9Sstevel@tonic-gate is available to edit any preset commands, or write a new boot 2217c478bd9Sstevel@tonic-gate command set from scratch. If no configuration file is present, 2227c478bd9Sstevel@tonic-gate GRUB drops to the command-line. 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate The list of commands (*note Commands::) are a subset of those 2257c478bd9Sstevel@tonic-gate supported for configuration files. Editing commands closely 2267c478bd9Sstevel@tonic-gate resembles the Bash command-line (*note Bash: (features)Command 2277c478bd9Sstevel@tonic-gate Line Editing.), with <TAB>-completion of commands, devices, 2287c478bd9Sstevel@tonic-gate partitions, and files in a directory depending on context. 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gateSupport multiple filesystem types 2317c478bd9Sstevel@tonic-gate Support multiple filesystem types transparently, plus a useful 2327c478bd9Sstevel@tonic-gate explicit blocklist notation. The currently supported filesystem 2337c478bd9Sstevel@tonic-gate types are "BSD FFS", "DOS FAT16 and FAT32", "Minix fs", "Linux 2347c478bd9Sstevel@tonic-gate ext2fs", "ReiserFS", "JFS", "XFS", and "VSTa fs". *Note 2357c478bd9Sstevel@tonic-gate Filesystem::, for more information. 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gateSupport automatic decompression 2387c478bd9Sstevel@tonic-gate Can decompress files which were compressed by `gzip'. This 2397c478bd9Sstevel@tonic-gate function is both automatic and transparent to the user (i.e. all 2407c478bd9Sstevel@tonic-gate functions operate upon the uncompressed contents of the specified 2417c478bd9Sstevel@tonic-gate files). This greatly reduces a file size and loading time, a 2427c478bd9Sstevel@tonic-gate particularly great benefit for floppies.(1) (*note 2437c478bd9Sstevel@tonic-gate Features-Footnote-1::) 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate It is conceivable that some kernel modules should be loaded in a 2467c478bd9Sstevel@tonic-gate compressed state, so a different module-loading command can be 2477c478bd9Sstevel@tonic-gate specified to avoid uncompressing the modules. 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gateAccess data on any installed device 2507c478bd9Sstevel@tonic-gate Support reading data from any or all floppies or hard disk(s) 2517c478bd9Sstevel@tonic-gate recognized by the BIOS, independent of the setting of the root 2527c478bd9Sstevel@tonic-gate device. 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gateBe independent of drive geometry translations 2557c478bd9Sstevel@tonic-gate Unlike many other boot loaders, GRUB makes the particular drive 2567c478bd9Sstevel@tonic-gate translation irrelevant. A drive installed and running with one 2577c478bd9Sstevel@tonic-gate translation may be converted to another translation without any 2587c478bd9Sstevel@tonic-gate adverse effects or changes in GRUB's configuration. 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gateDetect all installed RAM 2617c478bd9Sstevel@tonic-gate GRUB can generally find all the installed RAM on a PC-compatible 2627c478bd9Sstevel@tonic-gate machine. It uses an advanced BIOS query technique for finding all 2637c478bd9Sstevel@tonic-gate memory regions. As described on the Multiboot Specification (*note 2647c478bd9Sstevel@tonic-gate Multiboot Specification: (multiboot)Top.), not all kernels make 2657c478bd9Sstevel@tonic-gate use of this information, but GRUB provides it for those who do. 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gateSupport Logical Block Address mode 2687c478bd9Sstevel@tonic-gate In traditional disk calls (called "CHS mode"), there is a geometry 2697c478bd9Sstevel@tonic-gate translation problem, that is, the BIOS cannot access over 1024 2707c478bd9Sstevel@tonic-gate cylinders, so the accessible space is limited to at least 508 MB 2717c478bd9Sstevel@tonic-gate and to at most 8GB. GRUB can't universally solve this problem, as 2727c478bd9Sstevel@tonic-gate there is no standard interface used in all machines. However, 2737c478bd9Sstevel@tonic-gate several newer machines have the new interface, Logical Block 2747c478bd9Sstevel@tonic-gate Address ("LBA") mode. GRUB automatically detects if LBA mode is 2757c478bd9Sstevel@tonic-gate available and uses it if available. In LBA mode, GRUB can access 2767c478bd9Sstevel@tonic-gate the entire disk. 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gateSupport network booting 2797c478bd9Sstevel@tonic-gate GRUB is basically a disk-based boot loader but also has network 2807c478bd9Sstevel@tonic-gate support. You can load OS images from a network by using the "TFTP" 2817c478bd9Sstevel@tonic-gate protocol. 2827c478bd9Sstevel@tonic-gate 2837c478bd9Sstevel@tonic-gateSupport remote terminals 2847c478bd9Sstevel@tonic-gate To support computers with no console, GRUB provides remote terminal 2857c478bd9Sstevel@tonic-gate support, so that you can control GRUB from a remote host. Only 2867c478bd9Sstevel@tonic-gate serial terminal support is implemented at the moment. 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gateFile: grub.info, Node: Features-Footnotes, Up: Features 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate (1) There are a few pathological cases where loading a very badly 2927c478bd9Sstevel@tonic-gateorganized ELF kernel might take longer, but in practice this never 2937c478bd9Sstevel@tonic-gatehappen. 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gateFile: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gateThe role of a boot loader 2997c478bd9Sstevel@tonic-gate========================= 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gate The following is a quotation from Gordon Matzigkeit, a GRUB fanatic: 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate Some people like to acknowledge both the operating system and 3047c478bd9Sstevel@tonic-gate kernel when they talk about their computers, so they might say 3057c478bd9Sstevel@tonic-gate they use "GNU/Linux" or "GNU/Hurd". Other people seem to think 3067c478bd9Sstevel@tonic-gate that the kernel is the most important part of the system, so they 3077c478bd9Sstevel@tonic-gate like to call their GNU operating systems "Linux systems." 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate I, personally, believe that this is a grave injustice, because the 3107c478bd9Sstevel@tonic-gate _boot loader_ is the most important software of all. I used to 3117c478bd9Sstevel@tonic-gate refer to the above systems as either "LILO"(1) (*note Role of a 3127c478bd9Sstevel@tonic-gate boot loader-Footnote-1::) or "GRUB" systems. 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate Unfortunately, nobody ever understood what I was talking about; 3157c478bd9Sstevel@tonic-gate now I just use the word "GNU" as a pseudonym for GRUB. 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate So, if you ever hear people talking about their alleged "GNU" 3187c478bd9Sstevel@tonic-gate systems, remember that they are actually paying homage to the best 3197c478bd9Sstevel@tonic-gate boot loader around... GRUB! 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate We, the GRUB maintainers, do not (usually) encourage Gordon's level 3227c478bd9Sstevel@tonic-gateof fanaticism, but it helps to remember that boot loaders deserve 3237c478bd9Sstevel@tonic-gaterecognition. We hope that you enjoy using GNU GRUB as much as we did 3247c478bd9Sstevel@tonic-gatewriting it. 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate 3277c478bd9Sstevel@tonic-gateFile: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate (1) The LInux LOader, a boot loader that everybody uses, but nobody 3307c478bd9Sstevel@tonic-gatelikes. 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gateFile: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gateNaming convention 3367c478bd9Sstevel@tonic-gate***************** 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate The device syntax used in GRUB is a wee bit different from what you 3397c478bd9Sstevel@tonic-gatemay have seen before in your operating system(s), and you need to know 3407c478bd9Sstevel@tonic-gateit so that you can specify a drive/partition. 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate Look at the following examples and explanations: 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate (fd0) 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate First of all, GRUB requires that the device name be enclosed with 3477c478bd9Sstevel@tonic-gate`(' and `)'. The `fd' part means that it is a floppy disk. The number 3487c478bd9Sstevel@tonic-gate`0' is the drive number, which is counted from _zero_. This expression 3497c478bd9Sstevel@tonic-gatemeans that GRUB will use the whole floppy disk. 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate (hd0,1) 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate Here, `hd' means it is a hard disk drive. The first integer `0' 3547c478bd9Sstevel@tonic-gateindicates the drive number, that is, the first hard disk, while the 3557c478bd9Sstevel@tonic-gatesecond integer, `1', indicates the partition number (or the PC slice 3567c478bd9Sstevel@tonic-gatenumber in the BSD terminology). Once again, please note that the 3577c478bd9Sstevel@tonic-gatepartition numbers are counted from _zero_, not from one. This 3587c478bd9Sstevel@tonic-gateexpression means the second partition of the first hard disk drive. In 3597c478bd9Sstevel@tonic-gatethis case, GRUB uses one partition of the disk, instead of the whole 3607c478bd9Sstevel@tonic-gatedisk. 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate (hd0,4) 3637c478bd9Sstevel@tonic-gate 3647c478bd9Sstevel@tonic-gate This specifies the first "extended partition" of the first hard disk 3657c478bd9Sstevel@tonic-gatedrive. Note that the partition numbers for extended partitions are 3667c478bd9Sstevel@tonic-gatecounted from `4', regardless of the actual number of primary partitions 3677c478bd9Sstevel@tonic-gateon your hard disk. 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate (hd1,a) 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate This means the BSD `a' partition of the second hard disk. If you 3727c478bd9Sstevel@tonic-gateneed to specify which PC slice number should be used, use something 3737c478bd9Sstevel@tonic-gatelike this: `(hd1,0,a)'. If the PC slice number is omitted, GRUB 3747c478bd9Sstevel@tonic-gatesearches for the first PC slice which has a BSD `a' partition. 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gate Of course, to actually access the disks or partitions with GRUB, you 3777c478bd9Sstevel@tonic-gateneed to use the device specification in a command, like `root (fd0)' or 3787c478bd9Sstevel@tonic-gate`unhide (hd0,2)'. To help you find out which number specifies a 3797c478bd9Sstevel@tonic-gatepartition you want, the GRUB command-line (*note Command-line 3807c478bd9Sstevel@tonic-gateinterface::) options have argument completion. This means that, for 3817c478bd9Sstevel@tonic-gateexample, you only need to type 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate root ( 3847c478bd9Sstevel@tonic-gate 3857c478bd9Sstevel@tonic-gate followed by a <TAB>, and GRUB will display the list of drives, 3867c478bd9Sstevel@tonic-gatepartitions, or file names. So it should be quite easy to determine the 3877c478bd9Sstevel@tonic-gatename of your target partition, even with minimal knowledge of the 3887c478bd9Sstevel@tonic-gatesyntax. 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate Note that GRUB does _not_ distinguish IDE from SCSI - it simply 3917c478bd9Sstevel@tonic-gatecounts the drive numbers from zero, regardless of their type. Normally, 3927c478bd9Sstevel@tonic-gateany IDE drive number is less than any SCSI drive number, although that 3937c478bd9Sstevel@tonic-gateis not true if you change the boot sequence by swapping IDE and SCSI 3947c478bd9Sstevel@tonic-gatedrives in your BIOS. 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate Now the question is, how to specify a file? Again, consider an 3977c478bd9Sstevel@tonic-gateexample: 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate (hd0,0)/vmlinuz 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate This specifies the file named `vmlinuz', found on the first 4027c478bd9Sstevel@tonic-gatepartition of the first hard disk drive. Note that the argument 4037c478bd9Sstevel@tonic-gatecompletion works with file names, too. 4047c478bd9Sstevel@tonic-gate 4057c478bd9Sstevel@tonic-gate That was easy, admit it. Now read the next chapter, to find out how 4067c478bd9Sstevel@tonic-gateto actually install GRUB on your drive. 4077c478bd9Sstevel@tonic-gate 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gateFile: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top 4107c478bd9Sstevel@tonic-gate 4117c478bd9Sstevel@tonic-gateInstallation 4127c478bd9Sstevel@tonic-gate************ 4137c478bd9Sstevel@tonic-gate 4147c478bd9Sstevel@tonic-gate In order to install GRUB as your boot loader, you need to first 4157c478bd9Sstevel@tonic-gateinstall the GRUB system and utilities under your UNIX-like operating 4167c478bd9Sstevel@tonic-gatesystem (*note Obtaining and Building GRUB::). You can do this either 4177c478bd9Sstevel@tonic-gatefrom the source tarball, or as a package for your OS. 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate After you have done that, you need to install the boot loader on a 4207c478bd9Sstevel@tonic-gatedrive (floppy or hard disk). There are two ways of doing that - either 4217c478bd9Sstevel@tonic-gateusing the utility `grub-install' (*note Invoking grub-install::) on a 4227c478bd9Sstevel@tonic-gateUNIX-like OS, or by running GRUB itself from a floppy. These are quite 4237c478bd9Sstevel@tonic-gatesimilar, however the utility might probe a wrong BIOS drive, so you 4247c478bd9Sstevel@tonic-gateshould be careful. 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate Also, if you install GRUB on a UNIX-like OS, please make sure that 4277c478bd9Sstevel@tonic-gateyou have an emergency boot disk ready, so that you can rescue your 4287c478bd9Sstevel@tonic-gatecomputer if, by any chance, your hard drive becomes unusable 4297c478bd9Sstevel@tonic-gate(unbootable). 4307c478bd9Sstevel@tonic-gate 4317c478bd9Sstevel@tonic-gate GRUB comes with boot images, which are normally put in the directory 4327c478bd9Sstevel@tonic-gate`/usr/lib/grub/i386-pc'. If you do not use grub-install, then you need 4337c478bd9Sstevel@tonic-gateto copy the files `stage1', `stage2', and `*stage1_5' to the directory 4347c478bd9Sstevel@tonic-gate`/boot/grub', and run the `grub-set-default' (*note Invoking 4357c478bd9Sstevel@tonic-gategrub-set-default::) if you intend to use `default saved' (*note 4367c478bd9Sstevel@tonic-gatedefault::) in your configuration file. Hereafter, the directory where 4377c478bd9Sstevel@tonic-gateGRUB images are initially placed (normally `/usr/lib/grub/i386-pc') 4387c478bd9Sstevel@tonic-gatewill be called the "image directory", and the directory where the boot 4397c478bd9Sstevel@tonic-gateloader needs to find them (usually `/boot/grub') will be called the 4407c478bd9Sstevel@tonic-gate"boot directory". 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate* Menu: 4437c478bd9Sstevel@tonic-gate 4447c478bd9Sstevel@tonic-gate* Creating a GRUB boot floppy:: 4457c478bd9Sstevel@tonic-gate* Installing GRUB natively:: 4467c478bd9Sstevel@tonic-gate* Installing GRUB using grub-install:: 4477c478bd9Sstevel@tonic-gate* Making a GRUB bootable CD-ROM:: 4487c478bd9Sstevel@tonic-gate 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gateFile: grub.info, Node: Creating a GRUB boot floppy, Next: Installing GRUB natively, Up: Installation 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gateCreating a GRUB boot floppy 4537c478bd9Sstevel@tonic-gate=========================== 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate To create a GRUB boot floppy, you need to take the files `stage1' 4567c478bd9Sstevel@tonic-gateand `stage2' from the image directory, and write them to the first and 4577c478bd9Sstevel@tonic-gatethe second block of the floppy disk, respectively. 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate *Caution:* This procedure will destroy any data currently stored on 4607c478bd9Sstevel@tonic-gatethe floppy. 4617c478bd9Sstevel@tonic-gate 4627c478bd9Sstevel@tonic-gate On a UNIX-like operating system, that is done with the following 4637c478bd9Sstevel@tonic-gatecommands: 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate # cd /usr/lib/grub/i386-pc 4667c478bd9Sstevel@tonic-gate # dd if=stage1 of=/dev/fd0 bs=512 count=1 4677c478bd9Sstevel@tonic-gate 1+0 records in 4687c478bd9Sstevel@tonic-gate 1+0 records out 4697c478bd9Sstevel@tonic-gate # dd if=stage2 of=/dev/fd0 bs=512 seek=1 4707c478bd9Sstevel@tonic-gate 153+1 records in 4717c478bd9Sstevel@tonic-gate 153+1 records out 4727c478bd9Sstevel@tonic-gate # 4737c478bd9Sstevel@tonic-gate 4747c478bd9Sstevel@tonic-gate The device file name may be different. Consult the manual for your 4757c478bd9Sstevel@tonic-gateOS. 4767c478bd9Sstevel@tonic-gate 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gateFile: grub.info, Node: Installing GRUB natively, Next: Installing GRUB using grub-install, Prev: Creating a GRUB boot floppy, Up: Installation 4797c478bd9Sstevel@tonic-gate 4807c478bd9Sstevel@tonic-gateInstalling GRUB natively 4817c478bd9Sstevel@tonic-gate======================== 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gate *Caution:* Installing GRUB's stage1 in this manner will erase the 4847c478bd9Sstevel@tonic-gatenormal boot-sector used by an OS. 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD 4877c478bd9Sstevel@tonic-gatedirectly, so using it on a boot sector (the first sector of a 4887c478bd9Sstevel@tonic-gatepartition) should be okay. But generally, it would be a good idea to 4897c478bd9Sstevel@tonic-gateback up the first sector of the partition on which you are installing 4907c478bd9Sstevel@tonic-gateGRUB's stage1. This isn't as important if you are installing GRUB on 4917c478bd9Sstevel@tonic-gatethe first sector of a hard disk, since it's easy to reinitialize it 4927c478bd9Sstevel@tonic-gate(e.g. by running `FDISK /MBR' from DOS). 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate If you decide to install GRUB in the native environment, which is 4957c478bd9Sstevel@tonic-gatedefinitely desirable, you'll need to create a GRUB boot disk, and 4967c478bd9Sstevel@tonic-gatereboot your computer with it. Otherwise, see *Note Installing GRUB 4977c478bd9Sstevel@tonic-gateusing grub-install::. 4987c478bd9Sstevel@tonic-gate 4997c478bd9Sstevel@tonic-gate Once started, GRUB will show the command-line interface (*note 5007c478bd9Sstevel@tonic-gateCommand-line interface::). First, set the GRUB's "root device"(1) 5017c478bd9Sstevel@tonic-gate(*note Installing GRUB natively-Footnote-1::) to the partition 5027c478bd9Sstevel@tonic-gatecontaining the boot directory, like this: 5037c478bd9Sstevel@tonic-gate 5047c478bd9Sstevel@tonic-gate grub> root (hd0,0) 5057c478bd9Sstevel@tonic-gate 5067c478bd9Sstevel@tonic-gate If you are not sure which partition actually holds this directory, 5077c478bd9Sstevel@tonic-gateuse the command `find' (*note find::), like this: 5087c478bd9Sstevel@tonic-gate 5097c478bd9Sstevel@tonic-gate grub> find /boot/grub/stage1 5107c478bd9Sstevel@tonic-gate 5117c478bd9Sstevel@tonic-gate This will search for the file name `/boot/grub/stage1' and show the 5127c478bd9Sstevel@tonic-gatedevices which contain the file. 5137c478bd9Sstevel@tonic-gate 5147c478bd9Sstevel@tonic-gate Once you've set the root device correctly, run the command `setup' 5157c478bd9Sstevel@tonic-gate(*note setup::): 5167c478bd9Sstevel@tonic-gate 5177c478bd9Sstevel@tonic-gate grub> setup (hd0) 5187c478bd9Sstevel@tonic-gate 5197c478bd9Sstevel@tonic-gate This command will install the GRUB boot loader on the Master Boot 5207c478bd9Sstevel@tonic-gateRecord (MBR) of the first drive. If you want to put GRUB into the boot 5217c478bd9Sstevel@tonic-gatesector of a partition instead of putting it in the MBR, specify the 5227c478bd9Sstevel@tonic-gatepartition into which you want to install GRUB: 5237c478bd9Sstevel@tonic-gate 5247c478bd9Sstevel@tonic-gate grub> setup (hd0,0) 5257c478bd9Sstevel@tonic-gate 5267c478bd9Sstevel@tonic-gate If you install GRUB into a partition or a drive other than the first 5277c478bd9Sstevel@tonic-gateone, you must chain-load GRUB from another boot loader. Refer to the 5287c478bd9Sstevel@tonic-gatemanual for the boot loader to know how to chain-load GRUB. 5297c478bd9Sstevel@tonic-gate 5307c478bd9Sstevel@tonic-gate After using the setup command, you will boot into GRUB without the 5317c478bd9Sstevel@tonic-gateGRUB floppy. See the chapter *Note Booting:: to find out how to boot 5327c478bd9Sstevel@tonic-gateyour operating systems from GRUB. 5337c478bd9Sstevel@tonic-gate 5347c478bd9Sstevel@tonic-gate 5357c478bd9Sstevel@tonic-gateFile: grub.info, Node: Installing GRUB natively-Footnotes, Up: Installing GRUB natively 5367c478bd9Sstevel@tonic-gate 5377c478bd9Sstevel@tonic-gate (1) Note that GRUB's root device doesn't necessarily mean your OS's 5387c478bd9Sstevel@tonic-gateroot partition; if you need to specify a root partition for your OS, 5397c478bd9Sstevel@tonic-gateadd the argument into the command `kernel'. 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gateFile: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Prev: Installing GRUB natively, Up: Installation 5437c478bd9Sstevel@tonic-gate 5447c478bd9Sstevel@tonic-gateInstalling GRUB using grub-install 5457c478bd9Sstevel@tonic-gate================================== 5467c478bd9Sstevel@tonic-gate 5477c478bd9Sstevel@tonic-gate *Caution:* This procedure is definitely less safe, because there are 5487c478bd9Sstevel@tonic-gateseveral ways in which your computer can become unbootable. For example, 5497c478bd9Sstevel@tonic-gatemost operating systems don't tell GRUB how to map BIOS drives to OS 5507c478bd9Sstevel@tonic-gatedevices correctly--GRUB merely "guesses" the mapping. This will succeed 5517c478bd9Sstevel@tonic-gatein most cases, but not always. Therefore, GRUB provides you with a map 5527c478bd9Sstevel@tonic-gatefile called the "device map", which you must fix if it is wrong. *Note 5537c478bd9Sstevel@tonic-gateDevice map::, for more details. 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate If you still do want to install GRUB under a UNIX-like OS (such as 5567c478bd9Sstevel@tonic-gateGNU), invoke the program `grub-install' (*note Invoking grub-install::) 5577c478bd9Sstevel@tonic-gateas the superuser ("root"). 5587c478bd9Sstevel@tonic-gate 5597c478bd9Sstevel@tonic-gate The usage is basically very simple. You only need to specify one 5607c478bd9Sstevel@tonic-gateargument to the program, namely, where to install the boot loader. The 5617c478bd9Sstevel@tonic-gateargument can be either a device file (like `/dev/hda') or a partition 5627c478bd9Sstevel@tonic-gatespecified in GRUB's notation. For example, under Linux the following 5637c478bd9Sstevel@tonic-gatewill install GRUB into the MBR of the first IDE disk: 5647c478bd9Sstevel@tonic-gate 5657c478bd9Sstevel@tonic-gate # grub-install /dev/hda 5667c478bd9Sstevel@tonic-gate 5677c478bd9Sstevel@tonic-gate Likewise, under GNU/Hurd, this has the same effect: 5687c478bd9Sstevel@tonic-gate 5697c478bd9Sstevel@tonic-gate # grub-install /dev/hd0 5707c478bd9Sstevel@tonic-gate 5717c478bd9Sstevel@tonic-gate If it is the first BIOS drive, this is the same as well: 5727c478bd9Sstevel@tonic-gate 5737c478bd9Sstevel@tonic-gate # grub-install '(hd0)' 5747c478bd9Sstevel@tonic-gate 5757c478bd9Sstevel@tonic-gate Or you can omit the parentheses: 5767c478bd9Sstevel@tonic-gate 5777c478bd9Sstevel@tonic-gate # grub-install hd0 5787c478bd9Sstevel@tonic-gate 5797c478bd9Sstevel@tonic-gate But all the above examples assume that GRUB should use images under 5807c478bd9Sstevel@tonic-gatethe root directory. If you want GRUB to use images under a directory 5817c478bd9Sstevel@tonic-gateother than the root directory, you need to specify the option 5827c478bd9Sstevel@tonic-gate`--root-directory'. The typical usage is that you create a GRUB boot 5837c478bd9Sstevel@tonic-gatefloppy with a filesystem. Here is an example: 5847c478bd9Sstevel@tonic-gate 5857c478bd9Sstevel@tonic-gate # mke2fs /dev/fd0 5867c478bd9Sstevel@tonic-gate # mount -t ext2 /dev/fd0 /mnt 5877c478bd9Sstevel@tonic-gate # grub-install --root-directory=/mnt fd0 5887c478bd9Sstevel@tonic-gate # umount /mnt 5897c478bd9Sstevel@tonic-gate 5907c478bd9Sstevel@tonic-gate Another example is when you have a separate boot partition which is 5917c478bd9Sstevel@tonic-gatemounted at `/boot'. Since GRUB is a boot loader, it doesn't know 5927c478bd9Sstevel@tonic-gateanything about mountpoints at all. Thus, you need to run `grub-install' 5937c478bd9Sstevel@tonic-gatelike this: 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate # grub-install --root-directory=/boot /dev/hda 5967c478bd9Sstevel@tonic-gate 5977c478bd9Sstevel@tonic-gate By the way, as noted above, it is quite difficult to guess BIOS 5987c478bd9Sstevel@tonic-gatedrives correctly under a UNIX-like OS. Thus, `grub-install' will prompt 5997c478bd9Sstevel@tonic-gateyou to check if it could really guess the correct mappings, after the 6007c478bd9Sstevel@tonic-gateinstallation. The format is defined in *Note Device map::. Please be 6017c478bd9Sstevel@tonic-gatequite careful. If the output is wrong, it is unlikely that your 6027c478bd9Sstevel@tonic-gatecomputer will be able to boot with no problem. 6037c478bd9Sstevel@tonic-gate 6047c478bd9Sstevel@tonic-gate Note that `grub-install' is actually just a shell script and the 6057c478bd9Sstevel@tonic-gatereal task is done by the grub shell `grub' (*note Invoking the grub 6067c478bd9Sstevel@tonic-gateshell::). Therefore, you may run `grub' directly to install GRUB, 6077c478bd9Sstevel@tonic-gatewithout using `grub-install'. Don't do that, however, unless you are 6087c478bd9Sstevel@tonic-gatevery familiar with the internals of GRUB. Installing a boot loader on a 6097c478bd9Sstevel@tonic-gaterunning OS may be extremely dangerous. 6107c478bd9Sstevel@tonic-gate 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gateFile: grub.info, Node: Making a GRUB bootable CD-ROM, Prev: Installing GRUB using grub-install, Up: Installation 6137c478bd9Sstevel@tonic-gate 6147c478bd9Sstevel@tonic-gateMaking a GRUB bootable CD-ROM 6157c478bd9Sstevel@tonic-gate============================= 6167c478bd9Sstevel@tonic-gate 6177c478bd9Sstevel@tonic-gate GRUB supports the "no emulation mode" in the El Torito 6187c478bd9Sstevel@tonic-gatespecification(1) (*note Making a GRUB bootable CD-ROM-Footnote-1::). 6197c478bd9Sstevel@tonic-gateThis means that you can use the whole CD-ROM from GRUB and you don't 6207c478bd9Sstevel@tonic-gatehave to make a floppy or hard disk image file, which can cause 6217c478bd9Sstevel@tonic-gatecompatibility problems. 6227c478bd9Sstevel@tonic-gate 6237c478bd9Sstevel@tonic-gate For booting from a CD-ROM, GRUB uses a special Stage 2 called 6247c478bd9Sstevel@tonic-gate`stage2_eltorito'. The only GRUB files you need to have in your 6257c478bd9Sstevel@tonic-gatebootable CD-ROM are this `stage2_eltorito' and optionally a config file 6267c478bd9Sstevel@tonic-gate`menu.lst'. You don't need to use `stage1' or `stage2', because El 6277c478bd9Sstevel@tonic-gateTorito is quite different from the standard boot process. 6287c478bd9Sstevel@tonic-gate 6297c478bd9Sstevel@tonic-gate Here is an example of procedures to make a bootable CD-ROM image. 6307c478bd9Sstevel@tonic-gateFirst, make a top directory for the bootable image, say, `iso': 6317c478bd9Sstevel@tonic-gate 6327c478bd9Sstevel@tonic-gate $ mkdir iso 6337c478bd9Sstevel@tonic-gate 6347c478bd9Sstevel@tonic-gate Make a directory for GRUB: 6357c478bd9Sstevel@tonic-gate 6367c478bd9Sstevel@tonic-gate $ mkdir -p iso/boot/grub 6377c478bd9Sstevel@tonic-gate 6387c478bd9Sstevel@tonic-gate Copy the file `stage2_eltorito': 6397c478bd9Sstevel@tonic-gate 6407c478bd9Sstevel@tonic-gate $ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub 6417c478bd9Sstevel@tonic-gate 6427c478bd9Sstevel@tonic-gate If desired, make the config file `menu.lst' under `iso/boot/grub' 6437c478bd9Sstevel@tonic-gate(*note Configuration::), and copy any files and directories for the 6447c478bd9Sstevel@tonic-gatedisc to the directory `iso/'. 6457c478bd9Sstevel@tonic-gate 6467c478bd9Sstevel@tonic-gate Finally, make a ISO9660 image file like this: 6477c478bd9Sstevel@tonic-gate 6487c478bd9Sstevel@tonic-gate $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ 6497c478bd9Sstevel@tonic-gate -boot-load-size 4 -boot-info-table -o grub.iso iso 6507c478bd9Sstevel@tonic-gate 6517c478bd9Sstevel@tonic-gate This produces a file named `grub.iso', which then can be burned into 6527c478bd9Sstevel@tonic-gatea CD (or a DVD). `mkisofs' has already set up the disc to boot from 6537c478bd9Sstevel@tonic-gatethe `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB 6547c478bd9Sstevel@tonic-gateon the disc. (Note that the `-boot-load-size 4' bit is required for 6557c478bd9Sstevel@tonic-gatecompatibility with the BIOS on many older machines.) 6567c478bd9Sstevel@tonic-gate 6577c478bd9Sstevel@tonic-gate You can use the device `(cd)' to access a CD-ROM in your config 6587c478bd9Sstevel@tonic-gatefile. This is not required; GRUB automatically sets the root device to 6597c478bd9Sstevel@tonic-gate`(cd)' when booted from a CD-ROM. It is only necessary to refer to 6607c478bd9Sstevel@tonic-gate`(cd)' if you want to access other drives as well. 6617c478bd9Sstevel@tonic-gate 6627c478bd9Sstevel@tonic-gate 6637c478bd9Sstevel@tonic-gateFile: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM 6647c478bd9Sstevel@tonic-gate 6657c478bd9Sstevel@tonic-gate (1) El Torito is a specification for bootable CD using BIOS 6667c478bd9Sstevel@tonic-gatefunctions. 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate 6697c478bd9Sstevel@tonic-gateFile: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top 6707c478bd9Sstevel@tonic-gate 6717c478bd9Sstevel@tonic-gateBooting 6727c478bd9Sstevel@tonic-gate******* 6737c478bd9Sstevel@tonic-gate 6747c478bd9Sstevel@tonic-gate GRUB can load Multiboot-compliant kernels in a consistent way, but 6757c478bd9Sstevel@tonic-gatefor some free operating systems you need to use some OS-specific magic. 6767c478bd9Sstevel@tonic-gate 6777c478bd9Sstevel@tonic-gate* Menu: 6787c478bd9Sstevel@tonic-gate 6797c478bd9Sstevel@tonic-gate* General boot methods:: How to boot OSes with GRUB generally 6807c478bd9Sstevel@tonic-gate* OS-specific notes:: Notes on some operating systems 6817c478bd9Sstevel@tonic-gate* Making your system robust:: How to make your system robust 6827c478bd9Sstevel@tonic-gate 6837c478bd9Sstevel@tonic-gate 6847c478bd9Sstevel@tonic-gateFile: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting 6857c478bd9Sstevel@tonic-gate 6867c478bd9Sstevel@tonic-gateHow to boot operating systems 6877c478bd9Sstevel@tonic-gate============================= 6887c478bd9Sstevel@tonic-gate 6897c478bd9Sstevel@tonic-gate GRUB has two distinct boot methods. One of the two is to load an 6907c478bd9Sstevel@tonic-gateoperating system directly, and the other is to chain-load another boot 6917c478bd9Sstevel@tonic-gateloader which then will load an operating system actually. Generally 6927c478bd9Sstevel@tonic-gatespeaking, the former is more desirable, because you don't need to 6937c478bd9Sstevel@tonic-gateinstall or maintain other boot loaders and GRUB is flexible enough to 6947c478bd9Sstevel@tonic-gateload an operating system from an arbitrary disk/partition. However, the 6957c478bd9Sstevel@tonic-gatelatter is sometimes required, since GRUB doesn't support all the 6967c478bd9Sstevel@tonic-gateexisting operating systems natively. 6977c478bd9Sstevel@tonic-gate 6987c478bd9Sstevel@tonic-gate* Menu: 6997c478bd9Sstevel@tonic-gate 7007c478bd9Sstevel@tonic-gate* Loading an operating system directly:: 7017c478bd9Sstevel@tonic-gate* Chain-loading:: 7027c478bd9Sstevel@tonic-gate 7037c478bd9Sstevel@tonic-gate 7047c478bd9Sstevel@tonic-gateFile: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods 7057c478bd9Sstevel@tonic-gate 7067c478bd9Sstevel@tonic-gateHow to boot an OS directly with GRUB 7077c478bd9Sstevel@tonic-gate------------------------------------ 7087c478bd9Sstevel@tonic-gate 7097c478bd9Sstevel@tonic-gate Multiboot (*note Multiboot Specification: (multiboot)Top.) is the 7107c478bd9Sstevel@tonic-gatenative format supported by GRUB. For the sake of convenience, there is 7117c478bd9Sstevel@tonic-gatealso support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to 7127c478bd9Sstevel@tonic-gateboot other operating systems, you will have to chain-load them (*note 7137c478bd9Sstevel@tonic-gateChain-loading::). 7147c478bd9Sstevel@tonic-gate 7157c478bd9Sstevel@tonic-gate Generally, GRUB can boot any Multiboot-compliant OS in the following 7167c478bd9Sstevel@tonic-gatesteps: 7177c478bd9Sstevel@tonic-gate 7187c478bd9Sstevel@tonic-gate 1. Set GRUB's root device to the drive where the OS images are stored 7197c478bd9Sstevel@tonic-gate with the command `root' (*note root::). 7207c478bd9Sstevel@tonic-gate 7217c478bd9Sstevel@tonic-gate 2. Load the kernel image with the command `kernel' (*note kernel::). 7227c478bd9Sstevel@tonic-gate 7237c478bd9Sstevel@tonic-gate 3. If you need modules, load them with the command `module' (*note 7247c478bd9Sstevel@tonic-gate module::) or `modulenounzip' (*note modulenounzip::). 7257c478bd9Sstevel@tonic-gate 7267c478bd9Sstevel@tonic-gate 4. Run the command `boot' (*note boot::). 7277c478bd9Sstevel@tonic-gate 7287c478bd9Sstevel@tonic-gate Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar 7297c478bd9Sstevel@tonic-gatemanner. You load a kernel image with the command `kernel' and then run 7307c478bd9Sstevel@tonic-gatethe command `boot'. If the kernel requires some parameters, just append 7317c478bd9Sstevel@tonic-gatethe parameters to `kernel', after the file name of the kernel. Also, 7327c478bd9Sstevel@tonic-gateplease refer to *Note OS-specific notes::, for information on your 7337c478bd9Sstevel@tonic-gateOS-specific issues. 7347c478bd9Sstevel@tonic-gate 7357c478bd9Sstevel@tonic-gate 7367c478bd9Sstevel@tonic-gateFile: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods 7377c478bd9Sstevel@tonic-gate 7387c478bd9Sstevel@tonic-gateLoad another boot loader to boot unsupported operating systems 7397c478bd9Sstevel@tonic-gate-------------------------------------------------------------- 7407c478bd9Sstevel@tonic-gate 7417c478bd9Sstevel@tonic-gate If you want to boot an unsupported operating system (e.g. Windows 7427c478bd9Sstevel@tonic-gate95), chain-load a boot loader for the operating system. Normally, the 7437c478bd9Sstevel@tonic-gateboot loader is embedded in the "boot sector" of the partition on which 7447c478bd9Sstevel@tonic-gatethe operating system is installed. 7457c478bd9Sstevel@tonic-gate 7467c478bd9Sstevel@tonic-gate 1. Set GRUB's root device to the partition by the command 7477c478bd9Sstevel@tonic-gate `rootnoverify' (*note rootnoverify::): 7487c478bd9Sstevel@tonic-gate 7497c478bd9Sstevel@tonic-gate grub> rootnoverify (hd0,0) 7507c478bd9Sstevel@tonic-gate 7517c478bd9Sstevel@tonic-gate 2. Set the "active" flag in the partition using the command 7527c478bd9Sstevel@tonic-gate `makeactive'(1) (*note Chain-loading-Footnote-1::) (*note 7537c478bd9Sstevel@tonic-gate makeactive::): 7547c478bd9Sstevel@tonic-gate 7557c478bd9Sstevel@tonic-gate grub> makeactive 7567c478bd9Sstevel@tonic-gate 7577c478bd9Sstevel@tonic-gate 3. Load the boot loader with the command `chainloader' (*note 7587c478bd9Sstevel@tonic-gate chainloader::): 7597c478bd9Sstevel@tonic-gate 7607c478bd9Sstevel@tonic-gate grub> chainloader +1 7617c478bd9Sstevel@tonic-gate 7627c478bd9Sstevel@tonic-gate `+1' indicates that GRUB should read one sector from the start of 7637c478bd9Sstevel@tonic-gate the partition. The complete description about this syntax can be 7647c478bd9Sstevel@tonic-gate found in *Note Block list syntax::. 7657c478bd9Sstevel@tonic-gate 7667c478bd9Sstevel@tonic-gate 4. Run the command `boot' (*note boot::). 7677c478bd9Sstevel@tonic-gate 7687c478bd9Sstevel@tonic-gate However, DOS and Windows have some deficiencies, so you might have to 7697c478bd9Sstevel@tonic-gateuse more complicated instructions. *Note DOS/Windows::, for more 7707c478bd9Sstevel@tonic-gateinformation. 7717c478bd9Sstevel@tonic-gate 7727c478bd9Sstevel@tonic-gate 7737c478bd9Sstevel@tonic-gateFile: grub.info, Node: Chain-loading-Footnotes, Up: Chain-loading 7747c478bd9Sstevel@tonic-gate 7757c478bd9Sstevel@tonic-gate (1) This is not necessary for most of the modern operating systems. 7767c478bd9Sstevel@tonic-gate 7777c478bd9Sstevel@tonic-gate 7787c478bd9Sstevel@tonic-gateFile: grub.info, Node: OS-specific notes, Next: Making your system robust, Prev: General boot methods, Up: Booting 7797c478bd9Sstevel@tonic-gate 7807c478bd9Sstevel@tonic-gateSome caveats on OS-specific issues 7817c478bd9Sstevel@tonic-gate================================== 7827c478bd9Sstevel@tonic-gate 7837c478bd9Sstevel@tonic-gate Here, we describe some caveats on several operating systems. 7847c478bd9Sstevel@tonic-gate 7857c478bd9Sstevel@tonic-gate* Menu: 7867c478bd9Sstevel@tonic-gate 7877c478bd9Sstevel@tonic-gate* GNU/Hurd:: 7887c478bd9Sstevel@tonic-gate* GNU/Linux:: 7897c478bd9Sstevel@tonic-gate* FreeBSD:: 7907c478bd9Sstevel@tonic-gate* NetBSD:: 7917c478bd9Sstevel@tonic-gate* OpenBSD:: 7927c478bd9Sstevel@tonic-gate* DOS/Windows:: 7937c478bd9Sstevel@tonic-gate* SCO UnixWare:: 7947c478bd9Sstevel@tonic-gate* QNX:: 7957c478bd9Sstevel@tonic-gate 7967c478bd9Sstevel@tonic-gate 7977c478bd9Sstevel@tonic-gateFile: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes 7987c478bd9Sstevel@tonic-gate 7997c478bd9Sstevel@tonic-gateGNU/Hurd 8007c478bd9Sstevel@tonic-gate-------- 8017c478bd9Sstevel@tonic-gate 8027c478bd9Sstevel@tonic-gate Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there 8037c478bd9Sstevel@tonic-gateis nothing special about it. But do not forget that you have to specify 8047c478bd9Sstevel@tonic-gatea root partition to the kernel. 8057c478bd9Sstevel@tonic-gate 8067c478bd9Sstevel@tonic-gate 1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably 8077c478bd9Sstevel@tonic-gate the command `find /boot/gnumach' or similar can help you (*note 8087c478bd9Sstevel@tonic-gate find::). 8097c478bd9Sstevel@tonic-gate 8107c478bd9Sstevel@tonic-gate 2. Load the kernel and the module, like this: 8117c478bd9Sstevel@tonic-gate 8127c478bd9Sstevel@tonic-gate grub> kernel /boot/gnumach root=hd0s1 8137c478bd9Sstevel@tonic-gate grub> module /boot/serverboot 8147c478bd9Sstevel@tonic-gate 8157c478bd9Sstevel@tonic-gate 3. Run the command `boot' (*note boot::). 8167c478bd9Sstevel@tonic-gate 8177c478bd9Sstevel@tonic-gate 8187c478bd9Sstevel@tonic-gateFile: grub.info, Node: GNU/Linux, Next: FreeBSD, Prev: GNU/Hurd, Up: OS-specific notes 8197c478bd9Sstevel@tonic-gate 8207c478bd9Sstevel@tonic-gateGNU/Linux 8217c478bd9Sstevel@tonic-gate--------- 8227c478bd9Sstevel@tonic-gate 8237c478bd9Sstevel@tonic-gate It is relatively easy to boot GNU/Linux from GRUB, because it 8247c478bd9Sstevel@tonic-gatesomewhat resembles to boot a Multiboot-compliant OS. 8257c478bd9Sstevel@tonic-gate 8267c478bd9Sstevel@tonic-gate 1. Set GRUB's root device to the same drive as GNU/Linux's. Probably 8277c478bd9Sstevel@tonic-gate the command `find /vmlinuz' or similar can help you (*note find::). 8287c478bd9Sstevel@tonic-gate 8297c478bd9Sstevel@tonic-gate 2. Load the kernel: 8307c478bd9Sstevel@tonic-gate 8317c478bd9Sstevel@tonic-gate grub> kernel /vmlinuz root=/dev/hda1 8327c478bd9Sstevel@tonic-gate 8337c478bd9Sstevel@tonic-gate If you need to specify some kernel parameters, just append them to 8347c478bd9Sstevel@tonic-gate the command. For example, to set `vga' to `ext', do this: 8357c478bd9Sstevel@tonic-gate 8367c478bd9Sstevel@tonic-gate grub> kernel /vmlinuz root=/dev/hda1 vga=ext 8377c478bd9Sstevel@tonic-gate 8387c478bd9Sstevel@tonic-gate See the documentation in the Linux source tree for complete 8397c478bd9Sstevel@tonic-gate information on the available options. 8407c478bd9Sstevel@tonic-gate 8417c478bd9Sstevel@tonic-gate 3. If you use an initrd, execute the command `initrd' (*note 8427c478bd9Sstevel@tonic-gate initrd::) after `kernel': 8437c478bd9Sstevel@tonic-gate 8447c478bd9Sstevel@tonic-gate grub> initrd /initrd 8457c478bd9Sstevel@tonic-gate 8467c478bd9Sstevel@tonic-gate 4. Finally, run the command `boot' (*note boot::). 8477c478bd9Sstevel@tonic-gate 8487c478bd9Sstevel@tonic-gate *Caution:* If you use an initrd and specify the `mem=' option to the 8497c478bd9Sstevel@tonic-gatekernel to let it use less than actual memory size, you will also have 8507c478bd9Sstevel@tonic-gateto specify the same memory size to GRUB. To let GRUB know the size, run 8517c478bd9Sstevel@tonic-gatethe command `uppermem' _before_ loading the kernel. *Note uppermem::, 8527c478bd9Sstevel@tonic-gatefor more information. 8537c478bd9Sstevel@tonic-gate 8547c478bd9Sstevel@tonic-gate 8557c478bd9Sstevel@tonic-gateFile: grub.info, Node: FreeBSD, Next: NetBSD, Prev: GNU/Linux, Up: OS-specific notes 8567c478bd9Sstevel@tonic-gate 8577c478bd9Sstevel@tonic-gateFreeBSD 8587c478bd9Sstevel@tonic-gate------- 8597c478bd9Sstevel@tonic-gate 8607c478bd9Sstevel@tonic-gate GRUB can load the kernel directly, either in ELF or a.out format. But 8617c478bd9Sstevel@tonic-gatethis is not recommended, since FreeBSD's bootstrap interface sometimes 8627c478bd9Sstevel@tonic-gatechanges heavily, so GRUB can't guarantee to pass kernel parameters 8637c478bd9Sstevel@tonic-gatecorrectly. 8647c478bd9Sstevel@tonic-gate 8657c478bd9Sstevel@tonic-gate Thus, we'd recommend loading the very flexible loader `/boot/loader' 8667c478bd9Sstevel@tonic-gateinstead. See this example: 8677c478bd9Sstevel@tonic-gate 8687c478bd9Sstevel@tonic-gate grub> root (hd0,a) 8697c478bd9Sstevel@tonic-gate grub> kernel /boot/loader 8707c478bd9Sstevel@tonic-gate grub> boot 8717c478bd9Sstevel@tonic-gate 8727c478bd9Sstevel@tonic-gate 8737c478bd9Sstevel@tonic-gateFile: grub.info, Node: NetBSD, Next: OpenBSD, Prev: FreeBSD, Up: OS-specific notes 8747c478bd9Sstevel@tonic-gate 8757c478bd9Sstevel@tonic-gateNetBSD 8767c478bd9Sstevel@tonic-gate------ 8777c478bd9Sstevel@tonic-gate 8787c478bd9Sstevel@tonic-gate GRUB can load NetBSD a.out and ELF directly, follow these steps: 8797c478bd9Sstevel@tonic-gate 8807c478bd9Sstevel@tonic-gate 1. Set GRUB's root device with `root' (*note root::). 8817c478bd9Sstevel@tonic-gate 8827c478bd9Sstevel@tonic-gate 2. Load the kernel with `kernel' (*note kernel::). You should append 8837c478bd9Sstevel@tonic-gate the ugly option `--type=netbsd', if you want to load an ELF 8847c478bd9Sstevel@tonic-gate kernel, like this: 8857c478bd9Sstevel@tonic-gate 8867c478bd9Sstevel@tonic-gate grub> kernel --type=netbsd /netbsd-elf 8877c478bd9Sstevel@tonic-gate 8887c478bd9Sstevel@tonic-gate 3. Run `boot' (*note boot::). 8897c478bd9Sstevel@tonic-gate 8907c478bd9Sstevel@tonic-gate For now, however, GRUB doesn't allow you to pass kernel parameters, 8917c478bd9Sstevel@tonic-gateso it may be better to chain-load it instead. For more information, 8927c478bd9Sstevel@tonic-gateplease see *Note Chain-loading::. 8937c478bd9Sstevel@tonic-gate 8947c478bd9Sstevel@tonic-gate 8957c478bd9Sstevel@tonic-gateFile: grub.info, Node: OpenBSD, Next: DOS/Windows, Prev: NetBSD, Up: OS-specific notes 8967c478bd9Sstevel@tonic-gate 8977c478bd9Sstevel@tonic-gateOpenBSD 8987c478bd9Sstevel@tonic-gate------- 8997c478bd9Sstevel@tonic-gate 9007c478bd9Sstevel@tonic-gate The booting instruction is exactly the same as for NetBSD (*note 9017c478bd9Sstevel@tonic-gateNetBSD::). 9027c478bd9Sstevel@tonic-gate 9037c478bd9Sstevel@tonic-gate 9047c478bd9Sstevel@tonic-gateFile: grub.info, Node: DOS/Windows, Next: SCO UnixWare, Prev: OpenBSD, Up: OS-specific notes 9057c478bd9Sstevel@tonic-gate 9067c478bd9Sstevel@tonic-gateDOS/Windows 9077c478bd9Sstevel@tonic-gate----------- 9087c478bd9Sstevel@tonic-gate 9097c478bd9Sstevel@tonic-gate GRUB cannot boot DOS or Windows directly, so you must chain-load them 9107c478bd9Sstevel@tonic-gate(*note Chain-loading::). However, their boot loaders have some critical 9117c478bd9Sstevel@tonic-gatedeficiencies, so it may not work to just chain-load them. To overcome 9127c478bd9Sstevel@tonic-gatethe problems, GRUB provides you with two helper functions. 9137c478bd9Sstevel@tonic-gate 9147c478bd9Sstevel@tonic-gate If you have installed DOS (or Windows) on a non-first hard disk, you 9157c478bd9Sstevel@tonic-gatehave to use the disk swapping technique, because that OS cannot boot 9167c478bd9Sstevel@tonic-gatefrom any disks but the first one. The workaround used in GRUB is the 9177c478bd9Sstevel@tonic-gatecommand `map' (*note map::), like this: 9187c478bd9Sstevel@tonic-gate 9197c478bd9Sstevel@tonic-gate grub> map (hd0) (hd1) 9207c478bd9Sstevel@tonic-gate grub> map (hd1) (hd0) 9217c478bd9Sstevel@tonic-gate 9227c478bd9Sstevel@tonic-gate This performs a "virtual" swap between your first and second hard 9237c478bd9Sstevel@tonic-gatedrive. 9247c478bd9Sstevel@tonic-gate 9257c478bd9Sstevel@tonic-gate *Caution:* This is effective only if DOS (or Windows) uses BIOS to 9267c478bd9Sstevel@tonic-gateaccess the swapped disks. If that OS uses a special driver for the 9277c478bd9Sstevel@tonic-gatedisks, this probably won't work. 9287c478bd9Sstevel@tonic-gate 9297c478bd9Sstevel@tonic-gate Another problem arises if you installed more than one set of 9307c478bd9Sstevel@tonic-gateDOS/Windows onto one disk, because they could be confused if there are 9317c478bd9Sstevel@tonic-gatemore than one primary partitions for DOS/Windows. Certainly you should 9327c478bd9Sstevel@tonic-gateavoid doing this, but there is a solution if you do want to do so. Use 9337c478bd9Sstevel@tonic-gatethe partition hiding/unhiding technique. 9347c478bd9Sstevel@tonic-gate 9357c478bd9Sstevel@tonic-gate If GRUB "hide"s a DOS (or Windows) partition (*note hide::), DOS (or 9367c478bd9Sstevel@tonic-gateWindows) will ignore the partition. If GRUB "unhide"s a DOS (or 9377c478bd9Sstevel@tonic-gateWindows) partition (*note unhide::), DOS (or Windows) will detect the 9387c478bd9Sstevel@tonic-gatepartition. Thus, if you have installed DOS (or Windows) on the first 9397c478bd9Sstevel@tonic-gateand the second partition of the first hard disk, and you want to boot 9407c478bd9Sstevel@tonic-gatethe copy on the first partition, do the following: 9417c478bd9Sstevel@tonic-gate 9427c478bd9Sstevel@tonic-gate grub> unhide (hd0,0) 9437c478bd9Sstevel@tonic-gate grub> hide (hd0,1) 9447c478bd9Sstevel@tonic-gate grub> rootnoverify (hd0,0) 9457c478bd9Sstevel@tonic-gate grub> chainloader +1 9467c478bd9Sstevel@tonic-gate grub> makeactive 9477c478bd9Sstevel@tonic-gate grub> boot 9487c478bd9Sstevel@tonic-gate 9497c478bd9Sstevel@tonic-gate 9507c478bd9Sstevel@tonic-gateFile: grub.info, Node: SCO UnixWare, Next: QNX, Prev: DOS/Windows, Up: OS-specific notes 9517c478bd9Sstevel@tonic-gate 9527c478bd9Sstevel@tonic-gateSCO UnixWare 9537c478bd9Sstevel@tonic-gate------------ 9547c478bd9Sstevel@tonic-gate 9557c478bd9Sstevel@tonic-gate It is known that the signature in the boot loader for SCO UnixWare is 9567c478bd9Sstevel@tonic-gatewrong, so you will have to specify the option `--force' to 9577c478bd9Sstevel@tonic-gate`chainloader' (*note chainloader::), like this: 9587c478bd9Sstevel@tonic-gate 9597c478bd9Sstevel@tonic-gate grub> rootnoverify (hd1,0) 9607c478bd9Sstevel@tonic-gate grub> chainloader --force +1 9617c478bd9Sstevel@tonic-gate grub> makeactive 9627c478bd9Sstevel@tonic-gate grub> boot 9637c478bd9Sstevel@tonic-gate 9647c478bd9Sstevel@tonic-gate 9657c478bd9Sstevel@tonic-gateFile: grub.info, Node: QNX, Prev: SCO UnixWare, Up: OS-specific notes 9667c478bd9Sstevel@tonic-gate 9677c478bd9Sstevel@tonic-gateQNX 9687c478bd9Sstevel@tonic-gate--- 9697c478bd9Sstevel@tonic-gate 9707c478bd9Sstevel@tonic-gate QNX seems to use a bigger boot loader, so you need to boot it up, 9717c478bd9Sstevel@tonic-gatelike this: 9727c478bd9Sstevel@tonic-gate 9737c478bd9Sstevel@tonic-gate grub> rootnoverify (hd1,1) 9747c478bd9Sstevel@tonic-gate grub> chainloader +4 9757c478bd9Sstevel@tonic-gate grub> boot 9767c478bd9Sstevel@tonic-gate 9777c478bd9Sstevel@tonic-gate 9787c478bd9Sstevel@tonic-gateFile: grub.info, Node: Making your system robust, Prev: OS-specific notes, Up: Booting 9797c478bd9Sstevel@tonic-gate 9807c478bd9Sstevel@tonic-gateHow to make your system robust 9817c478bd9Sstevel@tonic-gate============================== 9827c478bd9Sstevel@tonic-gate 9837c478bd9Sstevel@tonic-gate When you test a new kernel or a new OS, it is important to make sure 9847c478bd9Sstevel@tonic-gatethat your computer can boot even if the new system is unbootable. This 9857c478bd9Sstevel@tonic-gateis crucial especially if you maintain servers or remote systems. To 9867c478bd9Sstevel@tonic-gateaccomplish this goal, you need to set up two things: 9877c478bd9Sstevel@tonic-gate 9887c478bd9Sstevel@tonic-gate 1. You must maintain a system which is always bootable. For instance, 9897c478bd9Sstevel@tonic-gate if you test a new kernel, you need to keep a working kernel in a 9907c478bd9Sstevel@tonic-gate different place. And, it would sometimes be very nice to even have 9917c478bd9Sstevel@tonic-gate a complete copy of a working system in a different partition or 9927c478bd9Sstevel@tonic-gate disk. 9937c478bd9Sstevel@tonic-gate 9947c478bd9Sstevel@tonic-gate 2. You must direct GRUB to boot a working system when the new system 9957c478bd9Sstevel@tonic-gate fails. This is possible with the "fallback" system in GRUB. 9967c478bd9Sstevel@tonic-gate 9977c478bd9Sstevel@tonic-gate The former requirement is very specific to each OS, so this 9987c478bd9Sstevel@tonic-gatedocumentation does not cover that topic. It is better to consult some 9997c478bd9Sstevel@tonic-gatebackup tools. 10007c478bd9Sstevel@tonic-gate 10017c478bd9Sstevel@tonic-gate So let's see the GRUB part. There are two possibilities: one of them 10027c478bd9Sstevel@tonic-gateis quite simple but not very robust, and the other is a bit complex to 10037c478bd9Sstevel@tonic-gateset up but probably the best solution to make sure that your system can 10047c478bd9Sstevel@tonic-gatestart as long as GRUB itself is bootable. 10057c478bd9Sstevel@tonic-gate 10067c478bd9Sstevel@tonic-gate* Menu: 10077c478bd9Sstevel@tonic-gate 10087c478bd9Sstevel@tonic-gate* Booting once-only:: 10097c478bd9Sstevel@tonic-gate* Booting fallback systems:: 10107c478bd9Sstevel@tonic-gate 10117c478bd9Sstevel@tonic-gate 10127c478bd9Sstevel@tonic-gateFile: grub.info, Node: Booting once-only, Next: Booting fallback systems, Up: Making your system robust 10137c478bd9Sstevel@tonic-gate 10147c478bd9Sstevel@tonic-gateBooting once-only 10157c478bd9Sstevel@tonic-gate----------------- 10167c478bd9Sstevel@tonic-gate 10177c478bd9Sstevel@tonic-gate You can teach GRUB to boot an entry only at next boot time. Suppose 10187c478bd9Sstevel@tonic-gatethat your have an old kernel `old_kernel' and a new kernel 10197c478bd9Sstevel@tonic-gate`new_kernel'. You know that `old_kernel' can boot your system 10207c478bd9Sstevel@tonic-gatecorrectly, and you want to test `new_kernel'. 10217c478bd9Sstevel@tonic-gate 10227c478bd9Sstevel@tonic-gate To ensure that your system will go back to the old kernel even if the 10237c478bd9Sstevel@tonic-gatenew kernel fails (e.g. it panics), you can specify that GRUB should try 10247c478bd9Sstevel@tonic-gatethe new kernel only once and boot the old kernel after that. 10257c478bd9Sstevel@tonic-gate 10267c478bd9Sstevel@tonic-gate First, modify your configuration file. Here is an example: 10277c478bd9Sstevel@tonic-gate 10287c478bd9Sstevel@tonic-gate default saved # This is important!!! 10297c478bd9Sstevel@tonic-gate timeout 10 10307c478bd9Sstevel@tonic-gate 10317c478bd9Sstevel@tonic-gate title the old kernel 10327c478bd9Sstevel@tonic-gate root (hd0,0) 10337c478bd9Sstevel@tonic-gate kernel /old_kernel 10347c478bd9Sstevel@tonic-gate savedefault 10357c478bd9Sstevel@tonic-gate 10367c478bd9Sstevel@tonic-gate title the new kernel 10377c478bd9Sstevel@tonic-gate root (hd0,0) 10387c478bd9Sstevel@tonic-gate kernel /new_kernel 10397c478bd9Sstevel@tonic-gate savedefault 0 # This is important!!! 10407c478bd9Sstevel@tonic-gate 10417c478bd9Sstevel@tonic-gate Note that this configuration file uses `default saved' (*note 10427c478bd9Sstevel@tonic-gatedefault::) at the head and `savedefault 0' (*note savedefault::) in the 10437c478bd9Sstevel@tonic-gateentry for the new kernel. This means that GRUB boots a saved entry by 10447c478bd9Sstevel@tonic-gatedefault, and booting the entry for the new kernel saves `0' as the 10457c478bd9Sstevel@tonic-gatesaved entry. 10467c478bd9Sstevel@tonic-gate 10477c478bd9Sstevel@tonic-gate With this configuration file, after all, GRUB always tries to boot 10487c478bd9Sstevel@tonic-gatethe old kernel after it booted the new one, because `0' is the entry of 10497c478bd9Sstevel@tonic-gate`the old kernel'. 10507c478bd9Sstevel@tonic-gate 10517c478bd9Sstevel@tonic-gate The next step is to tell GRUB to boot the new kernel at next boot 10527c478bd9Sstevel@tonic-gatetime. For this, execute `grub-set-default' (*note Invoking 10537c478bd9Sstevel@tonic-gategrub-set-default::): 10547c478bd9Sstevel@tonic-gate 10557c478bd9Sstevel@tonic-gate # grub-set-default 1 10567c478bd9Sstevel@tonic-gate 10577c478bd9Sstevel@tonic-gate This command sets the saved entry to `1', that is, to the new kernel. 10587c478bd9Sstevel@tonic-gate 10597c478bd9Sstevel@tonic-gate This method is useful, but still not very robust, because GRUB stops 10607c478bd9Sstevel@tonic-gatebooting, if there is any error in the boot entry, such that the new 10617c478bd9Sstevel@tonic-gatekernel has an invalid executable format. Thus, it it even better to use 10627c478bd9Sstevel@tonic-gatethe "fallback" mechanism of GRUB. Look at next subsection for this 10637c478bd9Sstevel@tonic-gatefeature. 10647c478bd9Sstevel@tonic-gate 10657c478bd9Sstevel@tonic-gate 10667c478bd9Sstevel@tonic-gateFile: grub.info, Node: Booting fallback systems, Prev: Booting once-only, Up: Making your system robust 10677c478bd9Sstevel@tonic-gate 10687c478bd9Sstevel@tonic-gateBooting fallback systems 10697c478bd9Sstevel@tonic-gate------------------------ 10707c478bd9Sstevel@tonic-gate 10717c478bd9Sstevel@tonic-gate GRUB supports a fallback mechanism of booting one or more other 10727c478bd9Sstevel@tonic-gateentries if a default boot entry fails. You can specify multiple 10737c478bd9Sstevel@tonic-gatefallback entries if you wish. 10747c478bd9Sstevel@tonic-gate 10757c478bd9Sstevel@tonic-gate Suppose that you have three systems, `A', `B' and `C'. `A' is a 10767c478bd9Sstevel@tonic-gatesystem which you want to boot by default. `B' is a backup system which 10777c478bd9Sstevel@tonic-gateis supposed to boot safely. `C' is another backup system which is used 10787c478bd9Sstevel@tonic-gatein case where `B' is broken. 10797c478bd9Sstevel@tonic-gate 10807c478bd9Sstevel@tonic-gate Then you may want GRUB to boot the first system which is bootable 10817c478bd9Sstevel@tonic-gateamong `A', `B' and `C'. A configuration file can be written in this way: 10827c478bd9Sstevel@tonic-gate 10837c478bd9Sstevel@tonic-gate default saved # This is important!!! 10847c478bd9Sstevel@tonic-gate timeout 10 10857c478bd9Sstevel@tonic-gate fallback 1 2 # This is important!!! 10867c478bd9Sstevel@tonic-gate 10877c478bd9Sstevel@tonic-gate title A 10887c478bd9Sstevel@tonic-gate root (hd0,0) 10897c478bd9Sstevel@tonic-gate kernel /kernel 10907c478bd9Sstevel@tonic-gate savedefault fallback # This is important!!! 10917c478bd9Sstevel@tonic-gate 10927c478bd9Sstevel@tonic-gate title B 10937c478bd9Sstevel@tonic-gate root (hd1,0) 10947c478bd9Sstevel@tonic-gate kernel /kernel 10957c478bd9Sstevel@tonic-gate savedefault fallback # This is important!!! 10967c478bd9Sstevel@tonic-gate 10977c478bd9Sstevel@tonic-gate title C 10987c478bd9Sstevel@tonic-gate root (hd2,0) 10997c478bd9Sstevel@tonic-gate kernel /kernel 11007c478bd9Sstevel@tonic-gate savedefault 11017c478bd9Sstevel@tonic-gate 11027c478bd9Sstevel@tonic-gate Note that `default saved' (*note default::), `fallback 1 2' and 11037c478bd9Sstevel@tonic-gate`savedefault fallback' are used. GRUB will boot a saved entry by 11047c478bd9Sstevel@tonic-gatedefault and save a fallback entry as next boot entry with this 11057c478bd9Sstevel@tonic-gateconfiguration. 11067c478bd9Sstevel@tonic-gate 11077c478bd9Sstevel@tonic-gate When GRUB tries to boot `A', GRUB saves `1' as next boot entry, 11087c478bd9Sstevel@tonic-gatebecause the command `fallback' specifies that `1' is the first fallback 11097c478bd9Sstevel@tonic-gateentry. The entry `1' is `B', so GRUB will try to boot `B' at next boot 11107c478bd9Sstevel@tonic-gatetime. 11117c478bd9Sstevel@tonic-gate 11127c478bd9Sstevel@tonic-gate Likewise, when GRUB tries to boot `B', GRUB saves `2' as next boot 11137c478bd9Sstevel@tonic-gateentry, because `fallback' specifies `2' as next fallback entry. This 11147c478bd9Sstevel@tonic-gatemakes sure that GRUB will boot `C' after booting `B'. 11157c478bd9Sstevel@tonic-gate 11167c478bd9Sstevel@tonic-gate It is noteworthy that GRUB uses fallback entries both when GRUB 11177c478bd9Sstevel@tonic-gateitself fails in booting an entry and when `A' or `B' fails in starting 11187c478bd9Sstevel@tonic-gateup your system. So this solution ensures that your system is started 11197c478bd9Sstevel@tonic-gateeven if GRUB cannot find your kernel or if your kernel panics. 11207c478bd9Sstevel@tonic-gate 11217c478bd9Sstevel@tonic-gate However, you need to run `grub-set-default' (*note Invoking 11227c478bd9Sstevel@tonic-gategrub-set-default::) when `A' starts correctly or you fix `A' after it 11237c478bd9Sstevel@tonic-gatecrashes, since GRUB always sets next boot entry to a fallback entry. 11247c478bd9Sstevel@tonic-gateYou should run this command in a startup script such as `rc.local' to 11257c478bd9Sstevel@tonic-gateboot `A' by default: 11267c478bd9Sstevel@tonic-gate 11277c478bd9Sstevel@tonic-gate # grub-set-default 0 11287c478bd9Sstevel@tonic-gate 11297c478bd9Sstevel@tonic-gate where `0' is the number of the boot entry for the system `A'. 11307c478bd9Sstevel@tonic-gate 11317c478bd9Sstevel@tonic-gate If you want to see what is current default entry, you can look at the 11327c478bd9Sstevel@tonic-gatefile `/boot/grub/default' (or `/grub/default' in some systems). Because 11337c478bd9Sstevel@tonic-gatethis file is plain-text, you can just `cat' this file. But it is 11347c478bd9Sstevel@tonic-gatestrongly recommended *not to modify this file directly*, because GRUB 11357c478bd9Sstevel@tonic-gatemay fail in saving a default entry in this file, if you change this 11367c478bd9Sstevel@tonic-gatefile in an unintended manner. Therefore, you should use 11377c478bd9Sstevel@tonic-gate`grub-set-default' when you need to change the default entry. 11387c478bd9Sstevel@tonic-gate 11397c478bd9Sstevel@tonic-gate 11407c478bd9Sstevel@tonic-gateFile: grub.info, Node: Configuration, Next: Network, Prev: Booting, Up: Top 11417c478bd9Sstevel@tonic-gate 11427c478bd9Sstevel@tonic-gateConfiguration 11437c478bd9Sstevel@tonic-gate************* 11447c478bd9Sstevel@tonic-gate 11457c478bd9Sstevel@tonic-gate You've probably noticed that you need to type several commands to 11467c478bd9Sstevel@tonic-gateboot your OS. There's a solution to that - GRUB provides a menu 11477c478bd9Sstevel@tonic-gateinterface (*note Menu interface::) from which you can select an item 11487c478bd9Sstevel@tonic-gate(using arrow keys) that will do everything to boot an OS. 11497c478bd9Sstevel@tonic-gate 11507c478bd9Sstevel@tonic-gate To enable the menu, you need a configuration file, `menu.lst' under 11517c478bd9Sstevel@tonic-gatethe boot directory. We'll analyze an example file. 11527c478bd9Sstevel@tonic-gate 11537c478bd9Sstevel@tonic-gate The file first contains some general settings, the menu interface 11547c478bd9Sstevel@tonic-gaterelated options. You can put these commands (*note Menu-specific 11557c478bd9Sstevel@tonic-gatecommands::) before any of the items (starting with `title' (*note 11567c478bd9Sstevel@tonic-gatetitle::)). 11577c478bd9Sstevel@tonic-gate 11587c478bd9Sstevel@tonic-gate # 11597c478bd9Sstevel@tonic-gate # Sample boot menu configuration file 11607c478bd9Sstevel@tonic-gate # 11617c478bd9Sstevel@tonic-gate 11627c478bd9Sstevel@tonic-gate As you may have guessed, these lines are comments. Lines starting 11637c478bd9Sstevel@tonic-gatewith a hash character (`#'), and blank lines, are ignored by GRUB. 11647c478bd9Sstevel@tonic-gate 11657c478bd9Sstevel@tonic-gate # By default, boot the first entry. 11667c478bd9Sstevel@tonic-gate default 0 11677c478bd9Sstevel@tonic-gate 11687c478bd9Sstevel@tonic-gate The first entry (here, counting starts with number zero, not one!) 11697c478bd9Sstevel@tonic-gatewill be the default choice. 11707c478bd9Sstevel@tonic-gate 11717c478bd9Sstevel@tonic-gate # Boot automatically after 30 secs. 11727c478bd9Sstevel@tonic-gate timeout 30 11737c478bd9Sstevel@tonic-gate 11747c478bd9Sstevel@tonic-gate As the comment says, GRUB will boot automatically in 30 seconds, 11757c478bd9Sstevel@tonic-gateunless interrupted with a keypress. 11767c478bd9Sstevel@tonic-gate 11777c478bd9Sstevel@tonic-gate # Fallback to the second entry. 11787c478bd9Sstevel@tonic-gate fallback 1 11797c478bd9Sstevel@tonic-gate 11807c478bd9Sstevel@tonic-gate If, for any reason, the default entry doesn't work, fall back to the 11817c478bd9Sstevel@tonic-gatesecond one (this is rarely used, for obvious reasons). 11827c478bd9Sstevel@tonic-gate 11837c478bd9Sstevel@tonic-gate Note that the complete descriptions of these commands, which are menu 11847c478bd9Sstevel@tonic-gateinterface specific, can be found in *Note Menu-specific commands::. 11857c478bd9Sstevel@tonic-gateOther descriptions can be found in *Note Commands::. 11867c478bd9Sstevel@tonic-gate 11877c478bd9Sstevel@tonic-gate Now, on to the actual OS definitions. You will see that each entry 11887c478bd9Sstevel@tonic-gatebegins with a special command, `title' (*note title::), and the action 11897c478bd9Sstevel@tonic-gateis described after it. Note that there is no command `boot' (*note 11907c478bd9Sstevel@tonic-gateboot::) at the end of each item. That is because GRUB automatically 11917c478bd9Sstevel@tonic-gateexecutes `boot' if it loads other commands successfully. 11927c478bd9Sstevel@tonic-gate 11937c478bd9Sstevel@tonic-gate The argument for the command `title' is used to display a short 11947c478bd9Sstevel@tonic-gatetitle/description of the entry in the menu. Since `title' displays the 11957c478bd9Sstevel@tonic-gateargument as is, you can write basically anything there. 11967c478bd9Sstevel@tonic-gate 11977c478bd9Sstevel@tonic-gate # For booting GNU/Hurd 11987c478bd9Sstevel@tonic-gate title GNU/Hurd 11997c478bd9Sstevel@tonic-gate root (hd0,0) 12007c478bd9Sstevel@tonic-gate kernel /boot/gnumach.gz root=hd0s1 12017c478bd9Sstevel@tonic-gate module /boot/serverboot.gz 12027c478bd9Sstevel@tonic-gate 12037c478bd9Sstevel@tonic-gate This boots GNU/Hurd from the first hard disk. 12047c478bd9Sstevel@tonic-gate 12057c478bd9Sstevel@tonic-gate # For booting GNU/Linux 12067c478bd9Sstevel@tonic-gate title GNU/Linux 12077c478bd9Sstevel@tonic-gate kernel (hd1,0)/vmlinuz root=/dev/hdb1 12087c478bd9Sstevel@tonic-gate 12097c478bd9Sstevel@tonic-gate This boots GNU/Linux, but from the second hard disk. 12107c478bd9Sstevel@tonic-gate 12117c478bd9Sstevel@tonic-gate # For booting Mach (getting kernel from floppy) 12127c478bd9Sstevel@tonic-gate title Utah Mach4 multiboot 12137c478bd9Sstevel@tonic-gate root (hd0,2) 12147c478bd9Sstevel@tonic-gate pause Insert the diskette now^G!! 12157c478bd9Sstevel@tonic-gate kernel (fd0)/boot/kernel root=hd0s3 12167c478bd9Sstevel@tonic-gate module (fd0)/boot/bootstrap 12177c478bd9Sstevel@tonic-gate 12187c478bd9Sstevel@tonic-gate This boots Mach with a kernel on a floppy, but the root filesystem at 12197c478bd9Sstevel@tonic-gatehd0s3. It also contains a `pause' line (*note pause::), which will 12207c478bd9Sstevel@tonic-gatecause GRUB to display a prompt and delay, before actually executing the 12217c478bd9Sstevel@tonic-gaterest of the commands and booting. 12227c478bd9Sstevel@tonic-gate 12237c478bd9Sstevel@tonic-gate # For booting FreeBSD 12247c478bd9Sstevel@tonic-gate title FreeBSD 12257c478bd9Sstevel@tonic-gate root (hd0,2,a) 12267c478bd9Sstevel@tonic-gate kernel /boot/loader 12277c478bd9Sstevel@tonic-gate 12287c478bd9Sstevel@tonic-gate This item will boot FreeBSD kernel loaded from the `a' partition of 12297c478bd9Sstevel@tonic-gatethe third PC slice of the first hard disk. 12307c478bd9Sstevel@tonic-gate 12317c478bd9Sstevel@tonic-gate # For booting OS/2 12327c478bd9Sstevel@tonic-gate title OS/2 12337c478bd9Sstevel@tonic-gate root (hd0,1) 12347c478bd9Sstevel@tonic-gate makeactive 12357c478bd9Sstevel@tonic-gate # chainload OS/2 bootloader from the first sector 12367c478bd9Sstevel@tonic-gate chainloader +1 12377c478bd9Sstevel@tonic-gate # This is similar to "chainload", but loads a specific file 12387c478bd9Sstevel@tonic-gate #chainloader /boot/chain.os2 12397c478bd9Sstevel@tonic-gate 12407c478bd9Sstevel@tonic-gate This will boot OS/2, using a chain-loader (*note Chain-loading::). 12417c478bd9Sstevel@tonic-gate 12427c478bd9Sstevel@tonic-gate # For booting Windows NT or Windows95 12437c478bd9Sstevel@tonic-gate title Windows NT / Windows 95 boot menu 12447c478bd9Sstevel@tonic-gate root (hd0,0) 12457c478bd9Sstevel@tonic-gate makeactive 12467c478bd9Sstevel@tonic-gate chainloader +1 12477c478bd9Sstevel@tonic-gate # For loading DOS if Windows NT is installed 12487c478bd9Sstevel@tonic-gate # chainload /bootsect.dos 12497c478bd9Sstevel@tonic-gate 12507c478bd9Sstevel@tonic-gate The same as the above, but for Windows. 12517c478bd9Sstevel@tonic-gate 12527c478bd9Sstevel@tonic-gate # For installing GRUB into the hard disk 12537c478bd9Sstevel@tonic-gate title Install GRUB into the hard disk 12547c478bd9Sstevel@tonic-gate root (hd0,0) 12557c478bd9Sstevel@tonic-gate setup (hd0) 12567c478bd9Sstevel@tonic-gate 12577c478bd9Sstevel@tonic-gate This will just (re)install GRUB onto the hard disk. 12587c478bd9Sstevel@tonic-gate 12597c478bd9Sstevel@tonic-gate # Change the colors. 12607c478bd9Sstevel@tonic-gate title Change the colors 12617c478bd9Sstevel@tonic-gate color light-green/brown blink-red/blue 12627c478bd9Sstevel@tonic-gate 12637c478bd9Sstevel@tonic-gate In the last entry, the command `color' is used (*note color::), to 12647c478bd9Sstevel@tonic-gatechange the menu colors (try it!). This command is somewhat special, 12657c478bd9Sstevel@tonic-gatebecause it can be used both in the command-line and in the menu. GRUB 12667c478bd9Sstevel@tonic-gatehas several such commands, see *Note General commands::. 12677c478bd9Sstevel@tonic-gate 12687c478bd9Sstevel@tonic-gate We hope that you now understand how to use the basic features of 12697c478bd9Sstevel@tonic-gateGRUB. To learn more about GRUB, see the following chapters. 12707c478bd9Sstevel@tonic-gate 12717c478bd9Sstevel@tonic-gate 12727c478bd9Sstevel@tonic-gateFile: grub.info, Node: Network, Next: Serial terminal, Prev: Configuration, Up: Top 12737c478bd9Sstevel@tonic-gate 12747c478bd9Sstevel@tonic-gateDownloading OS images from a network 12757c478bd9Sstevel@tonic-gate************************************ 12767c478bd9Sstevel@tonic-gate 12777c478bd9Sstevel@tonic-gate Although GRUB is a disk-based boot loader, it does provide network 12787c478bd9Sstevel@tonic-gatesupport. To use the network support, you need to enable at least one 12797c478bd9Sstevel@tonic-gatenetwork driver in the GRUB build process. For more information please 12807c478bd9Sstevel@tonic-gatesee `netboot/README.netboot' in the source distribution. 12817c478bd9Sstevel@tonic-gate 12827c478bd9Sstevel@tonic-gate* Menu: 12837c478bd9Sstevel@tonic-gate 12847c478bd9Sstevel@tonic-gate* General usage of network support:: 12857c478bd9Sstevel@tonic-gate* Diskless:: 12867c478bd9Sstevel@tonic-gate 12877c478bd9Sstevel@tonic-gate 12887c478bd9Sstevel@tonic-gateFile: grub.info, Node: General usage of network support, Next: Diskless, Up: Network 12897c478bd9Sstevel@tonic-gate 12907c478bd9Sstevel@tonic-gateHow to set up your network 12917c478bd9Sstevel@tonic-gate========================== 12927c478bd9Sstevel@tonic-gate 12937c478bd9Sstevel@tonic-gate GRUB requires a file server and optionally a server that will assign 12947c478bd9Sstevel@tonic-gatean IP address to the machine on which GRUB is running. For the former, 12957c478bd9Sstevel@tonic-gateonly TFTP is supported at the moment. The latter is either BOOTP, DHCP 12967c478bd9Sstevel@tonic-gateor a RARP server(1) (*note General usage of network 12977c478bd9Sstevel@tonic-gatesupport-Footnote-1::). It is not necessary to run both the servers on 12987c478bd9Sstevel@tonic-gateone computer. How to configure these servers is beyond the scope of this 12997c478bd9Sstevel@tonic-gatedocument, so please refer to the manuals specific to those 13007c478bd9Sstevel@tonic-gateprotocols/servers. 13017c478bd9Sstevel@tonic-gate 13027c478bd9Sstevel@tonic-gate If you decided to use a server to assign an IP address, set up the 13037c478bd9Sstevel@tonic-gateserver and run `bootp' (*note bootp::), `dhcp' (*note dhcp::) or `rarp' 13047c478bd9Sstevel@tonic-gate(*note rarp::) for BOOTP, DHCP or RARP, respectively. Each command will 13057c478bd9Sstevel@tonic-gateshow an assigned IP address, a netmask, an IP address for your TFTP 13067c478bd9Sstevel@tonic-gateserver and a gateway. If any of the addresses is wrong or it causes an 13077c478bd9Sstevel@tonic-gateerror, probably the configuration of your servers isn't set up properly. 13087c478bd9Sstevel@tonic-gate 13097c478bd9Sstevel@tonic-gate Otherwise, run `ifconfig', like this: 13107c478bd9Sstevel@tonic-gate 13117c478bd9Sstevel@tonic-gate grub> ifconfig --address=192.168.110.23 --server=192.168.110.14 13127c478bd9Sstevel@tonic-gate 13137c478bd9Sstevel@tonic-gate You can also use `ifconfig' in conjuction with `bootp', `dhcp' or 13147c478bd9Sstevel@tonic-gate`rarp' (e.g. to reassign the server address manually). *Note 13157c478bd9Sstevel@tonic-gateifconfig::, for more details. 13167c478bd9Sstevel@tonic-gate 13177c478bd9Sstevel@tonic-gate Finally, download your OS images from your network. The network can 13187c478bd9Sstevel@tonic-gatebe accessed using the network drive `(nd)'. Everything else is very 13197c478bd9Sstevel@tonic-gatesimilar to the normal instructions (*note Booting::). 13207c478bd9Sstevel@tonic-gate 13217c478bd9Sstevel@tonic-gate Here is an example: 13227c478bd9Sstevel@tonic-gate 13237c478bd9Sstevel@tonic-gate grub> bootp 13247c478bd9Sstevel@tonic-gate Probing... [NE*000] 13257c478bd9Sstevel@tonic-gate NE2000 base ... 13267c478bd9Sstevel@tonic-gate Address: 192.168.110.23 Netmask: 255.255.255.0 13277c478bd9Sstevel@tonic-gate Server: 192.168.110.14 Gateway: 192.168.110.1 13287c478bd9Sstevel@tonic-gate 13297c478bd9Sstevel@tonic-gate grub> root (nd) 13307c478bd9Sstevel@tonic-gate grub> kernel /tftproot/gnumach.gz root=sd0s1 13317c478bd9Sstevel@tonic-gate grub> module /tftproot/serverboot.gz 13327c478bd9Sstevel@tonic-gate grub> boot 13337c478bd9Sstevel@tonic-gate 13347c478bd9Sstevel@tonic-gate 13357c478bd9Sstevel@tonic-gateFile: grub.info, Node: General usage of network support-Footnotes, Up: General usage of network support 13367c478bd9Sstevel@tonic-gate 13377c478bd9Sstevel@tonic-gate (1) RARP is not advised, since it cannot serve much information 13387c478bd9Sstevel@tonic-gate 1339