From 5b956a8ac8a014cc90afa80af1b1f0cd1734ac3b Mon Sep 17 00:00:00 2001 From: okuji Date: Sat, 7 Oct 2000 07:19:12 +0000 Subject: [PATCH] merge the changes on the branch prepare_0_5_96 to the main trunk. --- ChangeLog | 53 +++++++++++++ NEWS | 2 +- config.h.in | 56 +++++++------ debian/changelog | 12 +++ debian/rules | 7 ++ docs/appendices.texi | 24 +++--- docs/grub.texi | 9 ++- docs/prog-ref.texi | 2 +- docs/stamp-vti | 2 +- docs/tutorial.texi | 152 ++++++++++++++++++++++++----------- docs/user-ref.texi | 176 ++++++++++++++++++++++++++++++----------- docs/version.texi | 2 +- lib/device.c | 82 +++++++------------ stage2/builtins.c | 16 ++-- stage2/disk_io.c | 12 +++ stage2/fsys_reiserfs.c | 4 +- util/grub-image.in | 2 +- 17 files changed, 412 insertions(+), 201 deletions(-) diff --git a/ChangeLog b/ChangeLog index 461978263..d6f146aba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2000-10-06 Alessandro Rubini + + * docs/user-ref.texi (Commands): Added missing commands and + reworded part of the text. + + * stage2/builtins.c (serial_func): Unswap the setting of "speed" + and "port". + +2000-10-06 OKUJI Yoshinori + + * stage2/builtins.c (setup_func): Append "... " to the + messages when calling embed_func and install_func, and print + the result. + Don't jump to the label "fail", even when embed_func failed. + +2000-10-05 Gordon Matzigkeit + + * stage2/disk_io.c (real_open_partition): Make sure that buf_geom + corresponds to the current drive before using it. + + * lib/device.c (get_drive_geometry): Use fstat if the native + geometry methods fail, such as when the drive is mapped to a + regular file. + + * docs/tutorial.texi: Add `@kbd{...}' to examples in order to + differentiate between command output and characters the user + should type. + * docs/user-ref.texi: Likewise. + +2000-10-05 OKUJI Yoshinori + + * docs/grub.texi: Added an entry for the chapter "Serial + terminal". + * docs/tutorial.texi (Serial terminal): New chapter. + +2000-10-04 Gordon Matzigkeit + + * util/grub-image (VERSION): Fix version calculation to tolerate + `(GNU GRUB 0.5.96)'-style versions. + + * docs/grub.texi: Remove braces from `@unnumbered' sections so + that texi2html doesn't complain. + + * debian/rules: Build HTML documentation to appease the Debian + masses. + +2000-10-04 OKUJI Yoshinori + + * stage2/fsys_reiserfs.c (reiserfs_mount): Compare PART_LENGTH + with SUPERBLOCK + (sizeof(super) >> SECTOR_BITS) instead of + sizeof(struct reiserfs_super_block). Reported by Jochen + Hoenicke. + 2000-10-05 OKUJI Yoshinori * configure.in (AM_INIT_AUTOMAKE): The version number is set to diff --git a/NEWS b/NEWS index 554ce5f4c..108c4f6b2 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ NEWS - list of user-visible changes between releases of GRUB -New in 0.5.96 - XXXX-XX-XX: +New in 0.5.96 - 2000-10-04: * New commands, "reboot" and "halt". * New command, "hiddenmenu". You can hide the menu interface by default with this command. diff --git a/config.h.in b/config.h.in index 56db8bd27..d04a7eb0a 100644 --- a/config.h.in +++ b/config.h.in @@ -27,36 +27,44 @@ /* Defined if an absolute indirect call/jump must NOT be prefixed with `*'. */ #undef ABSOLUTE_WITHOUT_ASTERISK -/* Define if you have the header file. */ -#undef HAVE_CURSES_H - -/* Define if you have the header file. */ -#undef HAVE_NCURSES_H - -/* Define if you have the header file. */ -#undef HAVE_NCURSES_CURSES_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - -/* Define if C symbols get an underscore after compilation */ -#undef HAVE_ASM_USCORE - /* Define it to "addr32" or "addr32;" to make GAS happy */ #undef ADDR32 /* Define it to "data32" or "data32;" to make GAS happy */ #undef DATA32 +/* Define if C symbols get an underscore after compilation */ +#undef HAVE_ASM_USCORE + +/* Define if you have the header file. */ +#undef HAVE_CURSES_H + +/* Define if you have the `curses' library (-lcurses). */ +#undef HAVE_LIBCURSES + +/* Define if you have the `ncurses' library (-lncurses). */ +#undef HAVE_LIBNCURSES + +/* Define if you have the `util' library (-lutil). */ +#undef HAVE_LIBUTIL + +/* Define if you have the header file. */ +#undef HAVE_NCURSES_CURSES_H + +/* Define if you have the header file. */ +#undef HAVE_NCURSES_H + /* Define if opendisk() in -lutil can be used */ #undef HAVE_OPENDISK +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION diff --git a/debian/changelog b/debian/changelog index c8e4066f6..34ea8f045 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +grub (0.5.96) unstable; urgency=low + + * Many, many new features and bugfixes. This is the final test release; + the next release will be version 1.0. + * Install HTML documentation in addition to Info pages. + (closes:bug#42242,bug#42273) + * Fix documentation to refer to /usr/sbin/grub as well as + /sbin/grub. (closes:bug#67132) + * Be more verbose about missing setup files. (closes:bug#71661) + + -- Gordon Matzigkeit Wed, 4 Oct 2000 10:44:42 -0600 + grub (0.5.95) unstable; urgency=low * ReiserFS support from Jochen Hoenicke. diff --git a/debian/rules b/debian/rules index c4d654714..f6bdd9fdc 100644 --- a/debian/rules +++ b/debian/rules @@ -48,6 +48,13 @@ binary-arch: checkroot build ## install files dir=`cd debian/tmp && pwd` && make install DESTDIR=$$dir + + top=`pwd` && cd debian/tmp/usr/share/doc/grub && \ + ln -s $$top/docs/{grub,multiboot}.texi . && \ + texi2html -split_chapter -I$$top/docs grub.texi && \ + texi2html -split_chapter -I$$top/docs multiboot.texi && \ + rm -f grub.texi multiboot.texi + gzip -f9 debian/tmp/usr/share/info/* debian/tmp/usr/share/man/*/* strip -s debian/tmp/usr/sbin/grub debian/tmp/usr/bin/mbchk diff --git a/docs/appendices.texi b/docs/appendices.texi index 93e29b15b..4e910bba3 100644 --- a/docs/appendices.texi +++ b/docs/appendices.texi @@ -5,17 +5,18 @@ @item How does GNU GRUB differ from Erich's original GRUB? GNU GRUB is the successor of Erich's great GRUB. He couldn't work on -GRUB because of some other tasks, so the current maintainer Gordon -Matzigkeit took over the maintainership, and opened the development in -order for everybody to participate it. +GRUB because of some other tasks, so the current maintainers OKUJI +Yoshinori and Gordon Matzigkeit took over the maintainership, and opened +the development in order for everybody to participate it. -Technically speaking, GNU GRUB has many features that are not -seen in the original GRUB. For example, GNU GRUB can be installed on -UNIX-like operating system (such as GNU/Linux) via the grub shell -@file{/sbin/grub}, it supports Logical Block Address (LBA) mode that -solves the 1024 cylinders problem, and @kbd{@key{TAB}} completes a -filename when it's unique. Of course, many bug fixes are done as well, -so it is recommended to use GNU GRUB. +Technically speaking, GNU GRUB has many features that are not seen in +the original GRUB. For example, GNU GRUB can be installed on UNIX-like +operating system (such as GNU/Hurd) via the grub shell +@file{/sbin/grub} (or @file{/usr/sbin/grub} on older systems), it +supports Logical Block Address (LBA) mode that solves the 1024 cylinders +problem, and @kbd{@key{TAB}} completes a filename when it's unique. Of +course, many bug fixes are done as well, so it is recommended to use GNU +GRUB. @item Can GRUB boot my operating system from over 8GB hard disks? @@ -53,7 +54,8 @@ Copy the GRUB images to @file{/mnt/boot/grub}. Only @file{stage1}, @dfn{stage1.5}s. @item -Run the following command: +Run the following command (substitute @file{/usr/sbin/grub} for +@file{/sbin/grub} if you are using an older system): @example @group diff --git a/docs/grub.texi b/docs/grub.texi index 4d4516414..a4df13f97 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -99,6 +99,7 @@ Part I: The Tutorial Manual * Installation:: Installing GRUB on your drive * Booting:: How to boot different operating systems * Network:: Downloading OS images from a network +* Serial terminal:: Using GRUB via a serial line * Configuration:: Writing your own configuration file Part II: The User Reference Manual @@ -135,28 +136,28 @@ Appendices and Indices @iftex @page -@unnumbered{Part I: The Tutorial Manual} +@unnumbered Part I: The Tutorial Manual @end iftex @include tutorial.texi @iftex @page -@unnumbered{Part II: The User Reference Manual} +@unnumbered Part II: The User Reference Manual @end iftex @include user-ref.texi @iftex @page -@unnumbered{Part III: The Programmer Reference Manual} +@unnumbered Part III: The Programmer Reference Manual @end iftex @include prog-ref.texi @iftex @page -@unnumbered{Appendices and Indices} +@unnumbered Appendices and Indices @end iftex @include appendices.texi diff --git a/docs/prog-ref.texi b/docs/prog-ref.texi index cb488c505..c9478fdff 100644 --- a/docs/prog-ref.texi +++ b/docs/prog-ref.texi @@ -368,7 +368,7 @@ map}. If the INT 13 handler returns, the TF flag is cleared automatically by the instruction @code{iret}, and then output the I/O map on the screen. See the source code for the command @command{ioprobe} -(@pxref{Command-line-specific commands}), for more information. +(@pxref{Command-line and menu entry commands}), for more information. @node Memory detection diff --git a/docs/stamp-vti b/docs/stamp-vti index 5877d2a0c..9d332a22e 100644 --- a/docs/stamp-vti +++ b/docs/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 3 April 2000 +@set UPDATED 7 October 2000 @set EDITION 0.5.97 @set VERSION 0.5.97 diff --git a/docs/tutorial.texi b/docs/tutorial.texi index 819338cb5..47f34ce18 100644 --- a/docs/tutorial.texi +++ b/docs/tutorial.texi @@ -171,9 +171,14 @@ commands: @example @group -# cd /boot/grub -# dd if=stage1 of=/dev/fd0 bs=512 count=1 -# dd if=stage2 of=/dev/fd0 bs=512 seek=1 +# @kbd{cd /boot/grub} +# @kbd{dd if=stage1 of=/dev/fd0 bs=512 count=1} +1+0 records in +1+0 records out +# @kbd{dd if=stage2 of=/dev/fd0 bs=512 seek=1} +153+1 records in +153+1 records out +# @end group @end example @@ -208,14 +213,14 @@ the command @command{kernel}.} to the partition which has your GRUB images, like this: @example -grub> root (hd0,0) +grub> @kbd{root (hd0,0)} @end example If you are not sure which partition actually holds these files, use the @command{find} command, like this: @example -grub> find /boot/grub/stage1 +grub> @kbd{find /boot/grub/stage1} @end example This will search for the filename @file{/boot/grub/stage1} and show the @@ -225,7 +230,7 @@ Once you've set the root device correctly, run the command @command{setup}: @example -grub> setup (hd0) +grub> @kbd{setup (hd0)} @end example This command will install GRUB on the MBR (@pxref{MBR}) in the first @@ -234,7 +239,7 @@ partition instead of the MBR, specify a partition into which you want to install GRUB: @example -grub> setup (hd0,0) +grub> @kbd{setup (hd0,0)} @end example If you install GRUB into a partition or a drive other than the first @@ -258,19 +263,19 @@ either of a device file or a GRUB's drive/partition. So, this will install GRUB into the MBR of the first IDE disk under Linux: @example -# grub-install /dev/hda +# @kbd{grub-install /dev/hda} @end example Likewise, under Hurd, this has the same effect: @example -# grub-install /dev/hd0 +# @kbd{grub-install /dev/hd0} @end example If it is the first BIOS drive, this is the same as well: @example -# grub-install '(hd0)' +# @kbd{grub-install '(hd0)'} @end example But all the above examples assume that you use GRUB images under @@ -281,10 +286,10 @@ boot floppy with a filesystem. Here is an example: @example @group -# mke2fs /dev/fd0 -# mount -t ext2 /dev/fd0 /mnt -# grub-install --root-directory=/mnt '(fd0)' -# umount /mnt +# @kbd{mke2fs /dev/fd0} +# @kbd{mount -t ext2 /dev/fd0 /mnt} +# @kbd{grub-install --root-directory=/mnt '(fd0)'} +# @kbd{umount /mnt} @end group @end example @@ -294,7 +299,7 @@ doesn't know anything about mountpoints at all. Thus, you need to run @command{grub-install} like this: @example -# grub-install --root-directory=/boot /dev/hda +# @kbd{grub-install --root-directory=/boot /dev/hda} @end example By the way, as you may already know, it is quite difficult to guess BIOS @@ -391,7 +396,7 @@ First, set GRUB's root device to the partition by the command @command{rootnoverify}: @example -grub> rootnoverify (hd0,0) +grub> @kbd{rootnoverify (hd0,0)} @end example Second, set the @dfn{active} flag in the partition by the command @@ -399,13 +404,13 @@ Second, set the @dfn{active} flag in the partition by the command modern operating systems.}: @example -grub> makeactive +grub> @kbd{makeactive} @end example Third, load the boot loader by the command @command{chainloader}: @example -grub> chainloader +1 +grub> @kbd{chainloader +1} @end example @samp{+1} indicates that GRUB should read one sector from the start of @@ -450,8 +455,8 @@ Load the kernel and the module, like this: @example @group -grub> kernel /boot/gnumach root=hd0s1 -grub> module /boot/serverboot +grub> @kbd{kernel /boot/gnumach root=hd0s1} +grub> @kbd{module /boot/serverboot} @end group @end example @@ -475,14 +480,14 @@ command @code{find /vmlinuz} or similar can help you. Load the kernel: @example -grub> kernel /vmlinuz root=/dev/hda1 +grub> @kbd{kernel /vmlinuz root=/dev/hda1} @end example If you need to specify some kernel parameters, just append them to the command. For example, to set @option{vga} to @samp{ext}, do this: @example -grub> kernel /vmlinuz root=/dev/hda1 vga=ext +grub> @kbd{kernel /vmlinuz root=/dev/hda1 vga=ext} @end example See the documentation in the Linux source tree for the complete @@ -493,7 +498,7 @@ If you use an initrd, execute the command @command{initrd} after @command{kernel}: @example -grub> initrd /initrd +grub> @kbd{initrd /initrd} @end example @item @@ -504,7 +509,7 @@ Finally, run the command @command{boot}. option to the kernel, to let it use less than actual memory size, you will also have to specify the same memory size to GRUB. To let GRUB know the size, run the command @command{uppermem} @emph{before} loading the -kernel. @xref{Command-line-specific commands}, for more information. +kernel. @xref{Command-line and menu entry commands}, for more information. @node FreeBSD @subsection FreeBSD @@ -519,9 +524,9 @@ Thus, we'd recommend loading the very flexible loader @example @group -grub> root (hd0,a) -grub> kernel /boot/loader -grub> boot +grub> @kbd{root (hd0,a)} +grub> @kbd{kernel /boot/loader} +grub> @kbd{boot} @end group @end example @@ -540,7 +545,7 @@ Load the kernel with @command{kernel}. You should append the ugly option @option{--type=netbsd}, if you want to load an ELF kernel, like this: @example -grub> kernel --type=netbsd /netbsd-elf +grub> @kbd{kernel --type=netbsd /netbsd-elf} @end example @item @@ -574,8 +579,8 @@ command @command{map} (@pxref{Commands}), like this: @example @group -grub> map (hd0) (hd1) -grub> map (hd1) (hd0) +grub> @kbd{map (hd0) (hd1)} +grub> @kbd{map (hd1) (hd0)} @end group @end example @@ -600,12 +605,12 @@ first copy, do the following: @example @group -grub> unhide (hd0,0) -grub> hide (hd0,1) -grub> rootnoverify (hd0,0) -grub> chainloader +1 -grub> makeactive -grub> boot +grub> @kbd{unhide (hd0,0)} +grub> @kbd{hide (hd0,1)} +grub> @kbd{rootnoverify (hd0,0)} +grub> @kbd{chainloader +1} +grub> @kbd{makeactive} +grub> @kbd{boot} @end group @end example @@ -619,10 +624,10 @@ wrong, so you will have to specify the option @option{--force} to @example @group -grub> rootnoverify (hd1,0) -grub> chainloader --force +1 -grub> makeactive -grub> boot +grub> @kbd{rootnoverify (hd1,0)} +grub> @kbd{chainloader --force +1} +grub> @kbd{makeactive} +grub> @kbd{boot} @end group @end example @@ -666,16 +671,16 @@ Here is an example: @example @group -grub> bootp +grub> @kbd{bootp} Probing... [NE*000] NE2000 base ... Address: 192.168.110.23 Netmask: 255.255.255.0 Server: 192.168.110.14 Gateway: 192.168.110.1 -grub> root (nd) -grub> kernel /tftproot/gnumach.gz root=sd0s1 -grub> module /tftproot/serverboot.gz -grub> boot +grub> @kbd{root (nd)} +grub> @kbd{kernel /tftproot/gnumach.gz root=sd0s1} +grub> @kbd{module /tftproot/serverboot.gz} +grub> @kbd{boot} @end group @end example @@ -726,6 +731,58 @@ See the manual about your BOOTP/DHCP server, for more information. The exact syntax should differ from the example, more or less. +@node Serial terminal +@chapter Using GRUB via a serial line + +This chapter describes how to use the serial terminal support in GRUB. + +If you have many computers or computers with no display/keyboard, it +would be very useful to control the computers with serial +communications. To connect a computer with another via a serial line, +you need to prepare a null-modem (cross) serial cable, and you may need +to have multiport serial boards, if your computer doesn't have extra +serial ports. In addition, a terminal emulator is also required, such as +minicom. Refer to a manual of your operating system, for more +information. + +As for GRUB, the instruction to set up a serial terminal is quite +simple. First of all, make sure that you haven't specified the option +@option{--disable-serial} to the configure script when you built your +GRUB images. If you get them in binary form, probably they have serial +terminal support already. + +Then, initialize your serial terminal after GRUB starts up. Here is an +example: + +@example +@group +grub> @kbd{serial --unit=0 --speed=9600} +grub> @kbd{terminal serial} +@end group +@end example + +The command @command{serial} initializes the serial unit 0 with the +speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if +you want to use COM2, you must specify @samp{--unit=1} instead. This +command accepts many other options, so please refer to @ref{Commands}, +for more details. + +The command @command{terminal} chooses which type of terminal you want +to use. In that case above, the terminal will be a serial terminal, but +you can also pass @code{console} to the command, like @samp{terminal +serial console}. In this case, a terminal in which you press any key +will be selected as a GRUB terminal. + +However, note that GRUB assumes that your terminal emulator is +compatible with VT100 by default. This is true for most terminal +emulators nowadays, but you should pass the option @option{--dumb} to +the command, if your terminal emulator is not VT100-compatible or +implement few VT100 escape sequences. If you specify the option, then +GRUB doesn't provide you with the menu interface, because the menu +requires several fancy features for your terminal. Instead, GRUB only +gives you the hidden menu interface and the command-line interface. + + @node Configuration @chapter Configuration @@ -892,8 +949,9 @@ color light-green/brown blink-red/blue In the last entry, the command @command{color} is used, to change the menu colors (try it!). This command is somewhat special, because it can -be used both in the command-line and in the menu (@pxref{General -commands}). GRUB has several such commands, see the user reference. +be used both in the command-line and in the menu (@pxref{Command-line +and menu commands}). GRUB has several such commands, see the user +reference. We hope that you now understand how to use the basic features of GRUB. To learn more about GRUB, see the User Reference Manual diff --git a/docs/user-ref.texi b/docs/user-ref.texi index c95dc3c53..a0be73bfd 100644 --- a/docs/user-ref.texi +++ b/docs/user-ref.texi @@ -430,20 +430,24 @@ returning to the main menu. @node Commands @chapter The list of available commands -In this chapter, we list the available commands, both in the -configuration file and in the command line. +In this chapter, we list all commands that are available in GRUB. + +Commands belong to different groups. A few can only be used in +the global section of the configuration file (or ``menu''); most +of them can be entered on the command line and can be either used +in the menu or in the menu entries. @menu * Menu-specific commands:: -* General commands:: -* Command-line-specific commands:: +* Command-line and menu commands:: +* Command-line and menu entry commands:: @end menu @node Menu-specific commands @section The list of commands for the menu only -The semantics are as follows: +The semantics used in parsing the configuration file are the following: @itemize @bullet @item @@ -468,25 +472,33 @@ Extra options or text at the end of the line is ignored unless otherwise specified. @item -Bad commands are added to the current entry, except before entries +Unrecognized commands are added to the current entry, except before entries start, where they are ignored. @end itemize -Commands usable in the menu only. +These commands can only be used in the menu: @deffn Command default num -Set the default entry to the entry number @var{num} (if not specified, -it is 0, the first entry). +Set the default entry to the entry number @var{num}. Numbering starts +from 0, and entry number 0 is the default if the command is not used. @end deffn @deffn Command fallback num Go into unattended boot mode: if the default boot entry has any errors, -instead of waiting for the user to do anything, it immediately starts +instead of waiting for the user to do anything, immediately start over using the @var{num} entry (same numbering as the @code{default} command). This obviously won't help if the machine was rebooted by a kernel that GRUB loaded. @end deffn +@deffn Command hiddenmenu +Don't display the menu. If the command is used, no menu will be +displayed on the control terminal, and the default entry will be +booted after the timeout expired. The user can still request the +menu to be displayed by pressing @key{ESC} before the timeout +expires. +@end deffn + @deffn Command password passwd [new-config-file] Disable all interactive editing control (menu entry editor and command line) and entries protected by the command @command{lock}. If @@ -507,13 +519,14 @@ the line, starting with the first non-space character. @end deffn -@node General commands -@section The list of general commands +@node Command-line and menu commands +@section The list of command-line and menu commands Commands usable both in the menu and in the command line. @deffn Command bootp -Initialize a network device via the @dfn{BOOTP} protocol. +Initialize a network device via the @dfn{BOOTP} protocol. This command +is only available if GRUB is compiled with netboot support. @end deffn @deffn Command color normal [highlight] @@ -602,8 +615,8 @@ image, and/or to fix the drives guessed by GRUB when GRUB fails to determine them correctly, like this: @example -grub> device (fd0) /floppy-image -grub> device (hd0) /dev/sd0 +grub> @kbd{device (fd0) /floppy-image} +grub> @kbd{device (hd0) /dev/sd0} @end example This command can be used only in the grub shell (@pxref{Invoking the @@ -611,18 +624,54 @@ grub shell}). @end deffn @deffn Command dhcp -Initialize a network device via the @dfn{DHCP} protocol. At the moment, -this command is just an alias for @command{bootp}. +Initialize a network device via the @dfn{DHCP} protocol. Currently, +this command is just an alias for @command{bootp}, since the two +protocols are very similar. This command +is only available if GRUB is compiled with netboot support. @end deffn @deffn Command hide partition Hide @var{partition} by setting the @dfn{hidden} bit in its partition -type code. This is useful only for DOS or Windows when multiple primary -partitions exist in one disk. +type code. This is useful only when booting DOS or Windows +and multiple primary FAT partitions exist in one disk. +@end deffn + +@deffn Command part_new part type from to +Create a new primary partition. @var{part} is a partition specification +in GRUB syntax (@pxref{Naming convention}); @var{type} is the partition +type and must be a number in the range @code{0-0xff}; @var{from} and +@var{to} are the starting and ending sectors, expressed as an absolute +sector number. +@end deffn + +@deffn Command part_type part type +Change the type of an existing partition. @var{part} is a partition +specification in GRUB syntax (@pxref{Naming convention}); @var{type} +is the new partition type and must be a number in the range 0-0xff. @end deffn @deffn Command rarp -Initialize a network device via the @dfn{RARP} protocol. +Initialize a network device via the @dfn{RARP} protocol. This command +is only available if GRUB is compiled with netboot support. +@end deffn + +@deffn Command serial [@option{--unit=}unit] [@option{--port=}port] [@option{--speed=}speed] [@option{--word=}word] [@option{--parity=}parity] [@option{--stop=}stop] [@option{--device=}dev] +Initialize a serial device. @var{unit} is a number in the range 0-3 +specifying which serial port to use; default is 0, that corresponds +the port often called COM1. @var{port} is the I/O port where the UART +is to be found; if specified it takes precedence over @var{unit}. +@var{speed} is the transmission speed; default is 9600. @var{word} and +@var{stop} are the number of data bits and stop bits. Data bits must +be in the range 5-8 and stop bits are 1 or 2. Default is 8 data bits +and one stop bit. @var{parity} is one of @option{no}, @option{odd}, +@option{even} and defaults to @option{no}. The option @option{--device} +can only be used in the GRUB shell and is used to specify the +tty device to be used in the host Operating System. + +The serial port is not used as a communication channel unless the +@var{terminal} command is used. + +This command is only available if GRUB is compiled with serial support. @end deffn @deffn Command setkey to_key from_key @@ -632,8 +681,8 @@ keys. If you want to exchange the keys, run this command again with the arguments exchanged, like this: @example -grub> setkey capslock control -grub> setkey control capslock +grub> @kbd{setkey capslock control} +grub> @kbd{setkey control capslock} @end example A key must be an alphabet, a digit, or one of these symbols: @@ -752,24 +801,35 @@ character each of the symbols corresponds: @end table @end deffn +@deffn Command terminal [@option{--dumb}] [@option{--timeout=}secs] [console] [serial]" +Select a terminal for user interaction. The terminal is assumed to be +vt100 compatible unless @option{--dumb} is specified. If both +@option{console} and @option{serial} are specified, then GRUB will use +the one where a key is entered first. If neither are specified, the +current setting is reported. Default is @option{console}. +This command is only available if GRUB is compiled with serial support. +@end deffn + + @deffn Command tftpserver ipaddr Override a TFTP server address returned by a BOOTP/DHCP/RARP server. The argument @var{ipaddr} must be in dotted decimal format, like -@samp{192.168.0.15}. +@samp{192.168.0.15}. This command is only available if GRUB is compiled +with netboot support. @end deffn @deffn Command unhide partition Unhide @var{partition} by clearing the @dfn{hidden} bit in its partition -type code. This is useful only for DOS or Windows when multiple primary -partitions exist in one disk. +type code. This is useful only when booting DOS or Windows and multiple +primary partitions exist in one disk. @end deffn -@node Command-line-specific commands -@section The list of commands in the command line +@node Command-line and menu entry commands +@section The list of command-line and menu entry commands -These commands are usable only in the command line and in menu entries. -If you forget some command, run the command @command{help}. +These commands are usable in the command line and in menu entries. If +you forget a command, you can run the command @command{help}. @deffn Command blocklist file Print the blocklist notation of the file @var{file} (@pxref{Blocklist @@ -777,9 +837,9 @@ syntax}). @end deffn @deffn Command boot -This boots the OS/chain-loader which has been loaded. Only necessary if +Boot the OS/chain-loader which has been loaded. Only necessary if running the fully interactive command line (it is implicit at the end of -a config-file entry). +a menu entry). @end deffn @deffn Command cat file @@ -787,7 +847,7 @@ Display the contents of the file @var{file}. This command may be useful to remind you of your OS's root partition: @example -grub> cat /etc/fstab +grub> @kbd{cat /etc/fstab} @end example @end deffn @@ -822,12 +882,10 @@ If they are completely identical, nothing will be printed. Load @var{file} as a configuration file. @end deffn -@deffn Command embed stage1_5 device -Embed the Stage 1.5 @var{stage1_5} in the sectors after the MBR if -@var{device} is a drive, or in the @dfn{boot loader} area if @var{device} -is a FFS partition or a ReiserFS partition.@footnote{The latter feature -has not been implemented yet.} Print the number of sectors which -@var{stage1_5} occupies, if successful. +@deffn Command debug +Toggle debug mode (by default it is off). When debug mode is on, some +extra messages are printed to show disk activity. This global debug flag +is mainly useful for GRUB developers when testing new code. @end deffn @deffn Command displaymem @@ -841,6 +899,14 @@ at 1MB and going up to the first chipset hole for @dfn{upper memory} maximum of 64MB). @end deffn +@deffn Command embed stage1_5 device +Embed the Stage 1.5 @var{stage1_5} in the sectors after the MBR if +@var{device} is a drive, or in the @dfn{boot loader} area if @var{device} +is a FFS partition or a ReiserFS partition.@footnote{The latter feature +has not been implemented yet.} Print the number of sectors which +@var{stage1_5} occupies, if successful. +@end deffn + @deffn Command find filename Search for the filename @var{filename} in all of partitions and print the list of the devices which contain the file. The filename @@ -861,7 +927,7 @@ or @command{testload} commands. @end deffn @deffn Command geometry drive [cylinder head sector [total_sector]] -Print the information for the drive @var{drive}. In the grub shell, you +Print the information for the drive @var{drive}. In the GRUB shell, you can set the geometry of the drive arbitrarily. The number of the cylinders, the one of the heads, the one of the sectors and the one of the total sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR, @@ -869,11 +935,18 @@ respectively. If you omit TOTAL_SECTOR, then it will be calculated based on the C/H/S values automatically. @end deffn +@deffn Command halt @option{--no-apm} +The commands halts the computer. If the @option{--no-apm} option +is specified, no APM BIOS call is performed. Otherwise, the computer +is shut down using APM. +@end deffn + @deffn Command help [pattern @dots{}] Display helpful information about builtin commands. If you do not -specify @var{pattern}, this command lists the short documents of all -available commands, and, if you specify one or more @var{pattern}s, it -displays long documents of the commands which match @var{pattern}(s). +specify @var{pattern}, this command shows short descriptions of all +available commands. If you specify any @var{patterns}, it displays +longer information about each of the commands which match those +@var{patterns}. @end deffn @deffn Command impsprobe @@ -960,10 +1033,10 @@ Prevent normal users from executing arbitrary menu entries. You must use the command @command{password} if you really want this command to be useful. -This command will be used like this example: +This command is used in a menu, as shown in this this example: @example -title This is a too dangerous entry to be executed by normal users +title This entry is too dangerous to be executed by normal users lock root (hd0,a) kernel /no-security-os @@ -981,8 +1054,8 @@ necessary when you chain-load some operating systems, such as DOS, if such an OS resides at a non-first drive. Here is an example: @example -grub> map (hd0) (hd1) -grub> map (hd1) (hd0) +grub> @kbd{map (hd0) (hd1)} +grub> @kbd{map (hd1) (hd0)} @end example The example exchanges the order between the first hard disk and the @@ -1012,7 +1085,11 @@ change floppies. @deffn Command quit Exit from the GRUB shell @command{grub} (@pxref{Invoking the grub -shell}). This command can be used only in the grub shell. +shell}). This command can be used only in the GRUB shell. +@end deffn + +@deffn Command reboot +Reboot the computer. @end deffn @deffn Command read addr @@ -1041,6 +1118,10 @@ desired. Note that the items mentioned in @command{root} above which derived from attempting the mount will @emph{not} work correctly. @end deffn +@deffn Command savedefault +Save the current menu entry as default entry. +@end deffn + @deffn Command setup [@option{--force-lba}] install_device [image_device] Set up the installation of GRUB automatically. This command uses the more flexible command @command{install} in the backend and installs GRUB @@ -1424,6 +1505,7 @@ option in the command line. This is a simple example: @example #!/bin/sh +# Use /usr/sbin/grub if you are on an older system. /sbin/grub --batch </dev/null 2>/dev/null root (hd0,0) setup (hd0) diff --git a/docs/version.texi b/docs/version.texi index 5877d2a0c..9d332a22e 100644 --- a/docs/version.texi +++ b/docs/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 3 April 2000 +@set UPDATED 7 October 2000 @set EDITION 0.5.97 @set VERSION 0.5.97 diff --git a/lib/device.c b/lib/device.c index 77750c957..84eafcf33 100644 --- a/lib/device.c +++ b/lib/device.c @@ -97,38 +97,6 @@ get_drive_geometry (struct geometry *geom, char **map, int drive) return; } -#elif defined(__GNU__) -# warning "Automatic detection of geometries will be performed only \ -partially. This is not fatal." - /* Hurd */ - { - /* For now, Hurd doesn't support the system call to get a geometry - from Mach, so get only the number of total sectors. */ - struct stat st; - - if (fstat (fd, &st) || ! st.st_blocks) - goto fail; - - geom->total_sectors = st.st_blocks; - - /* Set the rest arbitrarily. */ - if (drive & 0x80) - { - geom->cylinders = DEFAULT_HD_CYLINDERS; - geom->heads = DEFAULT_HD_HEADS; - geom->sectors = DEFAULT_HD_SECTORS; - } - else - { - geom->cylinders = DEFAULT_FD_CYLINDERS; - geom->heads = DEFAULT_FD_HEADS; - geom->sectors = DEFAULT_FD_SECTORS; - } - - close (fd); - return; - } - #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) /* FreeBSD, NetBSD or OpenBSD */ { @@ -146,32 +114,36 @@ partially. This is not fatal." } #else -# warning "In your operating system, automatic detection of geometries \ -will not be performed." + /* Notably, defined(__GNU__) */ +# warning "Automatic detection of geometries will be performed only \ +partially. This is not fatal." #endif fail: - /* Set some arbitrary defaults. */ - if (drive & 0x80) - { - /* Hard drive. */ - geom->cylinders = DEFAULT_HD_CYLINDERS; - geom->heads = DEFAULT_HD_HEADS; - geom->sectors = DEFAULT_HD_SECTORS; - geom->total_sectors = (DEFAULT_HD_CYLINDERS - * DEFAULT_HD_HEADS - * DEFAULT_HD_SECTORS); - } - else - { - /* Floppy. */ - geom->cylinders = DEFAULT_FD_CYLINDERS; - geom->heads = DEFAULT_FD_HEADS; - geom->sectors = DEFAULT_FD_SECTORS; - geom->total_sectors = (DEFAULT_FD_CYLINDERS - * DEFAULT_FD_HEADS - * DEFAULT_FD_SECTORS); - } + { + struct stat st; + + /* FIXME: It would be nice to somehow compute fake C/H/S settings, + given a proper st_blocks size. */ + if (drive & 0x80) + { + geom->cylinders = DEFAULT_HD_CYLINDERS; + geom->heads = DEFAULT_HD_HEADS; + geom->sectors = DEFAULT_HD_SECTORS; + } + else + { + geom->cylinders = DEFAULT_FD_CYLINDERS; + geom->heads = DEFAULT_FD_HEADS; + geom->sectors = DEFAULT_FD_SECTORS; + } + + /* Set the total sectors properly, if we can. */ + if (! fstat (fd, &st) && st.st_blocks) + geom->total_sectors = st.st_blocks; + else + geom->total_sectors = geom->cylinders * geom->heads * geom->sectors; + } close (fd); } diff --git a/stage2/builtins.c b/stage2/builtins.c index 52ce0bb14..a375e604a 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -2967,7 +2967,7 @@ serial_func (char *arg, int flags) if (! safe_parse_maxint (&p, &num)) return 1; - port = (unsigned int) num; + speed = (unsigned int) num; } else if (grub_memcmp (arg, "--port=", sizeof ("--port=") - 1) == 0) { @@ -2977,7 +2977,7 @@ serial_func (char *arg, int flags) if (! safe_parse_maxint (&p, &num)) return 1; - speed = (unsigned short) num; + port = (unsigned short) num; } else if (grub_memcmp (arg, "--word=", sizeof ("--word=") - 1) == 0) { @@ -3506,7 +3506,7 @@ setup_func (char *arg, int flags) grub_sprintf (cmd_arg, "%s %s", stage2, device); /* Notify what will be run. */ - grub_printf (" Running \"embed %s\"\n", cmd_arg); + grub_printf (" Running \"embed %s\"... ", cmd_arg); embed_func (cmd_arg, flags); if (! errnum) @@ -3519,9 +3519,11 @@ setup_func (char *arg, int flags) sprint_device (image_drive, image_partition); grub_sprintf (buffer, "%s%s", device, config_filename); grub_strcpy (config_filename, buffer); + + grub_printf ("succeeded\n"); } else - goto fail; + grub_printf ("failed (this is not fatal)\n"); } else if (fsys_table[fsys_type].embed_func != 0) { @@ -3568,7 +3570,7 @@ setup_func (char *arg, int flags) #endif /* ! NO_BUGGY_BIOS_IN_THE_WORLD */ /* Notify what will be run. */ - grub_printf (" Running \"install %s\"\n", cmd_arg); + grub_printf (" Running \"install %s\"... ", cmd_arg); /* Make sure that SAVED_DRIVE and SAVED_PARTITION are identical with IMAGE_DRIVE and IMAGE_PARTITION, respectively. */ @@ -3577,7 +3579,9 @@ setup_func (char *arg, int flags) /* Run the command. */ if (! install_func (cmd_arg, flags)) - grub_printf ("Done.\n"); + grub_printf ("succeeded\nDone.\n"); + else + grub_printf ("failed\n"); fail: saved_drive = tmp_drive; diff --git a/stage2/disk_io.c b/stage2/disk_io.c index df3cd5c57..f1532937a 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -639,6 +639,18 @@ real_open_partition (int flags) bsd_evil_hack = 0; current_slice = 0; part_start = 0; + + /* Make sure that buf_geom is valid. */ + if (buf_drive != current_drive) + { + if (get_diskinfo (current_drive, &buf_geom)) + { + errnum = ERR_NO_DISK; + return 0; + } + buf_drive = current_drive; + buf_track = -1; + } part_length = buf_geom.total_sectors; /* If this is the whole disk, return here. */ diff --git a/stage2/fsys_reiserfs.c b/stage2/fsys_reiserfs.c index 1caf01cc3..4288f7e83 100644 --- a/stage2/fsys_reiserfs.c +++ b/stage2/fsys_reiserfs.c @@ -560,7 +560,7 @@ reiserfs_mount (void) struct reiserfs_super_block super; int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; - if (part_length < sizeof (struct reiserfs_super_block) + if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), (char *) &super) || (substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0 @@ -571,7 +571,7 @@ reiserfs_mount (void) { /* Try old super block position */ superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; - if (part_length < sizeof (struct reiserfs_super_block) + if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), (char *) &super)) return 0; diff --git a/util/grub-image.in b/util/grub-image.in index ee1d14c09..136998f11 100644 --- a/util/grub-image.in +++ b/util/grub-image.in @@ -52,7 +52,7 @@ set -e # Get GRUB's version from the Grub shell, since we use the # installed files. -VERSION=`$grub_shell --version | sed 's/^.* //'` +VERSION=`$grub_shell --version | sed -e 's/^.* \([0-9.]*\).*$/\1/'` test "X$VERSION" != X bootdir=${PACKAGE}-${VERSION}-${context}