⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grub.texi

📁 Linux的启动装载(BootLoader)程序
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
These are called @dfn{Stage 1.5}, because they serve as a bridgebetween @file{stage1} and @file{stage2}, that is to say, Stage 1.5 isloaded by Stage 1 and Stage 1.5 loads Stage 2. The difference between@file{stage1} and @file{*_stage1_5} is that the former doesn'tunderstand any filesystem while the latter understands one filesystem(e.g. @file{e2fs_stage1_5} understands ext2fs). So you can move theStage 2 image to another location safely, even after GRUB has beeninstalled.While Stage 2 cannot generally be embedded in a fixed area as the sizeis so large, Stage 1.5 can be installed into the area right after an MBR,or the boot loader area of a ReiserFS or a FFS.@item nbgrubThis is a network boot image for the Network Image Proposal used by somenetwork boot loaders, such as Etherboot. This is mostly the same asStage 2, but it also sets up a network and loads a configuration filefrom the network.@item pxegrubThis is another network boot image for the Preboot Execution Environmentused by several Netboot ROMs. This is identical to @file{nbgrub}, exceptfor the format.@end table@node Filesystem@chapter Filesystem syntax and semanticsGRUB uses a special syntax for specifying disk drives which can beaccessed by BIOS. Because of BIOS limitations, GRUB cannot distinguishbetween IDE, ESDI, SCSI, or others. You must know yourself which BIOSdevice is equivalent to which OS device. Normally, that will be clear ifyou see the files in a device or use the command @command{find}(@pxref{find}).@menu* Device syntax::               How to specify devices* File name syntax::            How to specify files* Block list syntax::           How to specify block lists@end menu@node Device syntax@section How to specify devicesThe device syntax is like this:@example@code{(@var{device}[,@var{part-num}][,@var{bsd-subpart-letter}])}@end example@samp{[]} means the parameter is optional. @var{device} should beeither @samp{fd} or @samp{hd} followed by a digit, like @samp{fd0}.But you can also set @var{device} to a hexadecimal or a decimal numberwhich is a BIOS drive number, so the following are equivalent:@example(hd0)(0x80)(128)@end example@var{part-num} represents the partition number of @var{device}, startingfrom zero for primary partitions and from four for extended partitions,and @var{bsd-subpart-letter} represents the BSD disklabel subpartition,such as @samp{a} or @samp{e}.A shortcut for specifying BSD subpartitions is@code{(@var{device},@var{bsd-subpart-letter})}, in this case, GRUBsearches for the first PC partition containing a BSD disklabel, thenfinds the subpartition @var{bsd-subpart-letter}. Here is an example:@example(hd0,a)@end exampleThe syntax @samp{(hd0)} represents using the entire disk (or theMBR when installing GRUB), while the syntax @samp{(hd0,0)}represents using the first partition of the disk (or the boot sectorof the partition when installing GRUB).If you enabled the network support, the special drive, @samp{(nd)}, isalso available. Before using the network drive, you must initialize thenetwork. @xref{Network}, for more information.@node File name syntax@section How to specify filesThere are two ways to specify files, by @dfn{absolute file name} and by@dfn{block list}.An absolute file name resembles a Unix absolute file name, using@samp{/} for the directory separator (not @samp{\} as in DOS). Oneexample is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file@file{/boot/grub/menu.lst} in the first partition of the first harddisk. If you omit the device name in an absolute file name, GRUB usesGRUB's @dfn{root device} implicitly. So if you set the root device to,say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then@code{/boot/kernel} is the same as @code{(hd1,0)/boot/kernel}.@node Block list syntax@section How to specify block listsA block list is used for specifying a file that doesn't appear in thefilesystem, like a chainloader. The syntax is@code{[@var{offset}]+@var{length}[,[@var{offset}]+@var{length}]@dots{}}.Here is an example:@example@code{0+100,200+1,300+300}@end exampleThis represents that GRUB should read blocks 0 through 99, block 200,and blocks 300 through 599. If you omit an offset, then GRUB assumesthe offset is zero.Like the file name syntax (@pxref{File name syntax}), if a blocklistdoes not contain a device name, then GRUB uses GRUB's @dfn{rootdevice}. So @code{(hd0,1)+1} is the same as @code{+1} when the rootdevice is @samp{(hd0,1)}.@node Interface@chapter GRUB's user interfaceGRUB has both a simple menu interface for choosing preset entries from aconfiguration file, and a highly flexible command-line for performingany desired combination of boot commands.GRUB looks for its configuration file as soon as it is loaded. If oneis found, then the full menu interface is activated using whateverentries were found in the file. If you choose the @dfn{command-line} menuoption, or if the configuration file was not found, then GRUB drops tothe command-line interface.@menu* Command-line interface::      The flexible command-line interface* Menu interface::              The simple menu interface* Menu entry editor::           Editing a menu entry* Hidden menu interface::       The hidden menu interface@end menu@node Command-line interface@section The flexible command-line interfaceThe command-line interface provides a prompt and after it an editabletext area much like a command-line in Unix or DOS. Each command isimmediately executed after it is entered@footnote{However, thisbehavior will be changed in the future version, in a user-invisibleway.}. The commands (@pxref{Command-line and menu entry commands}) are asubset of those available in the configuration file, used with exactlythe same syntax.Cursor movement and editing of the text on the line can be done via asubset of the functions available in the Bash shell:@table @key@item C-f@itemx PC right keyMove forward one character.@item C-b@itemx PC left keyMove back one character.@item C-a@itemx HOMEMove to the start of the line.@item C-e@itemx ENDMove the the end of the line.@item C-d@itemx DELDelete the character underneath the cursor.@item C-h@itemx BSDelete the character to the left of the cursor.@item C-kKill the text from the current cursor position to the end of the line.@item C-uKill backward from the cursor to the beginning of the line.@item C-yYank the killed text back into the buffer at the cursor.@item C-p@itemx PC up keyMove up through the history list.@item C-n@itemx PC down keyMove down through the history list.@end tableWhen typing commands interactively, if the cursor is within or beforethe first word in the command-line, pressing the @key{TAB} key (or@key{C-i}) will display a listing of the available commands, and if thecursor is after the first word, the @kbd{@key{TAB}} will provide acompletion listing of disks, partitions, and file names depending on thecontext. Note that to obtain a list of drives, one must open aparenthesis, as @command{root (}.Note that you cannot use the completion functionality in the TFTPfilesystem. This is because TFTP doesn't support file name listing forthe security.@node Menu interface@section The simple menu interfaceThe menu interface is quite easy to use. Its commands are bothreasonably intuitive and described on screen.Basically, the menu interface provides a list of @dfn{boot entries} tothe user to choose from. Use the arrow keys to select the entry ofchoice, then press @key{RET} to run it.  An optional timeout isavailable to boot the default entry (the first one if not set), which isaborted by pressing any key.Commands are available to enter a bare command-line by pressing @key{c}(which operates exactly like the non-config-file version of GRUB, butallows one to return to the menu if desired by pressing @key{ESC}) or toedit any of the @dfn{boot entries} by pressing @key{e}.If you protect the menu interface with a password (@pxref{Security}),all you can do is choose an entry by pressing @key{RET}, or press@key{p} to enter the password.@node Menu entry editor@section Editing a menu entryThe menu entry editor looks much like the main menu interface, but thelines in the menu are individual commands in the selected entry insteadof entry names.If an @key{ESC} is pressed in the editor, it aborts all the changes madeto the configuration entry and returns to the main menu interface.When a particular line is selected, the editor places the user in aspecial version of the GRUB command-line to edit that line.  When theuser hits @key{RET}, GRUB replaces the line in question in the bootentry with the changes (unless it was aborted via @key{ESC},in which case the changes are thrown away).If you want to add a new line to the menu entry, press @key{o} if addinga line after the current line or press @key{O} if before the currentline.To delete a line, hit the key @key{d}. Although GRUB unfortunatelydoes not support @dfn{undo}, you can do almost the same thing by justreturning to the main menu.@node Hidden menu interface@section The hidden menu interfaceWhen your terminal is dumb or you request GRUB to hide the menuinterface explicitly with the command @command{hiddenmenu}(@pxref{hiddenmenu}), GRUB doesn't show the menu interface (@pxref{Menuinterface}) and automatically boots the default entry, unlessinterrupted by pressing @key{ESC}.When you interrupt the timeout and your terminal is dumb, GRUB fallsback to the command-line interface (@pxref{Command-line interface}).@node Commands@chapter The list of available commandsIn this chapter, we list all commands that are available in GRUB.Commands belong to different groups. A few can only be used inthe global section of the configuration file (or ``menu''); mostof them can be entered on the command-line and can be used eitheranywhere in the menu or specifically in the menu entries.@menu* Menu-specific commands::* General commands::* Command-line and menu entry commands::@end menu@node Menu-specific commands@section The list of commands for the menu onlyThe semantics used in parsing the configuration file are the following:@itemize @bullet@itemThe menu-specific commands have to be used before any others.@itemThe files @emph{must} be in plain-text format.@item@samp{#} at the beginning of a line in a configuration file means it isonly a comment.@itemOptions are separated by spaces.@itemAll numbers can be either decimal or hexadecimal. A hexadecimal numbermust be preceded by @samp{0x}, and is case-insensitive.@itemExtra options or text at the end of the line are ignored unless otherwisespecified.@itemUnrecognized commands are added to the current entry, except before entriesstart, where they are ignored.@end itemizeThese commands can only be used in the menu:@menu* default::                     Set the default entry* fallback::                    Set the fallback entry* hiddenmenu::                  Hide the menu interface* timeout::                     Set the timeout* title::                       Start a menu entry@end menu@node default@subsection default@deffn Command default numSet the default entry to the entry number @var{num}. Numbering startsfrom 0, and the entry number 0 is the default if the command is notused.You can specify @samp{saved} instead of a number. In this case, thedefault entry is the entry saved with the command@command{savedefault}. @xref{savedefault}, for more information.@end deffn@node fallback@subsection fallback@deffn Command fallback numGo into unattended boot mode: if the default boot entry has any errors,instead of waiting for the user to do something, immediately startover using the @var{num} entry (same numbering as the @code{default}command (@pxref{default})). This obviously won't help if the machine wasrebooted by a kernel that GRUB loaded.@end deffn@node hiddenmenu@subsection hiddenmenu@deffn Command hiddenmenuDon't display the menu. If the command is used, no menu will bedisplayed on the control terminal, and the default entry will bebooted after the timeout expired. The user can still request themenu to be displayed by pressing @key{ESC} before the timeoutexpires. See also @ref{Hidden menu interface}.@end deffn@node timeout@subsection timeout@deffn Command timeout secSet a timeout, in @var{sec} seconds, before automatically booting thedefault entry (nor

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -