the equal character after a command is now optional.

This commit is contained in:
okuji 1999-09-01 22:50:01 +00:00
parent d409155dc8
commit 9bf749438c
6 changed files with 125 additions and 102 deletions

View file

@ -1,3 +1,16 @@
1999-09-02 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
The character `=' after a command is now optional.
* stage2/char_io.c (get_cmdline): Search for a space or a equal
character after the first word in CMDLINE when TAB lists
completions, instead of just searching for a eqaul character.
* stage2/cmdline.c (skip_to): Treat the character `=' as a space
if AFTER_EQUAL is non-zero.
(commands): Delete all the equal characters.
* docs/menu.lst: Likewise.
* docs/grub.texi: Likewise.
1999-09-01 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp> 1999-09-01 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* grub/asmstub.c (env_for_exit): New variable. * grub/asmstub.c (env_for_exit): New variable.

4
NEWS
View file

@ -8,7 +8,9 @@ New in 0.5.93:
ext2fs, FAT and FFS support in Stage 2 respectively. ext2fs, FAT and FFS support in Stage 2 respectively.
* FAT32 support is added. * FAT32 support is added.
* Minix fs support is added. * Minix fs support is added.
* The new commands "hide" and "unhide" are added. * New commands "hide" and "unhide".
* The character `=' after a command is not necessary any longer, but it
is supported for backward compatibility.
New in 0.5.92 - 1999-07-26: New in 0.5.92 - 1999-07-26:
* Bug fixes (i.e. Stage 1.5 can work fine again). * Bug fixes (i.e. Stage 1.5 can work fine again).

View file

@ -98,7 +98,7 @@ Introduction
How to install GRUB on your computer How to install GRUB on your computer
* Boot floppy:: Creating a GRUB boot floppy. * Boot floppy:: Creating a GRUB boot floppy.
* Automated install:: Installation via @code{install=}. * Automated install:: Installation via @code{install}.
Booting your operating system Booting your operating system
@ -342,12 +342,12 @@ writing it.
Due to the nature of a @dfn{bootloader}, you need to install GRUB on Due to the nature of a @dfn{bootloader}, you need to install GRUB on
bootable media, such as a floppy disk. The installation can be performed bootable media, such as a floppy disk. The installation can be performed
by @code{dd} or @code{rawrite} for a boot floppy, or the @code{install=} by @code{dd} or @code{rawrite} for a boot floppy, or the @code{install}
command at the GRUB command line (@pxref{Using}). command at the GRUB command line (@pxref{Using}).
@menu @menu
* Boot floppy:: Creating a GRUB boot floppy. * Boot floppy:: Creating a GRUB boot floppy.
* Automated install:: Installation via @code{install=}. * Automated install:: Installation via @code{install}.
@end menu @end menu
@ -392,7 +392,7 @@ come with many GNU and GNU/Linux distributions.
@node Automated install @node Automated install
@section Installation via the @code{install=} command @section Installation via the @code{install} command
@quotation @quotation
@strong{Caution:} Installing GRUB's stage1 in this manner will erase the @strong{Caution:} Installing GRUB's stage1 in this manner will erase the
@ -404,7 +404,7 @@ important if you are installing GRUB on the first sector of a hard disk,
since it's easy to reinitialize it (by running @code{FDISK /MBR} from DOS). since it's easy to reinitialize it (by running @code{FDISK /MBR} from DOS).
@end quotation @end quotation
GRUB has a command called @code{install=} which is described in GRUB has a command called @code{install} which is described in
@xref{Using}. The purpose of this section is to give examples and @xref{Using}. The purpose of this section is to give examples and
describe how to use the command in different situations. describe how to use the command in different situations.
@ -417,10 +417,10 @@ in the @dfn{install partition}. Place the GRUB @file{stage2} file, any
optional @file{stage1.5} files, and the configuration file optional @file{stage1.5} files, and the configuration file
(@file{menu.lst}) in that directory. (@file{menu.lst}) in that directory.
Now figure out how to use the @code{install=} command appropriately, and Now figure out how to use the @code{install} command appropriately, and
you're done! you're done!
Examples of how to use the @code{install=} command: Examples of how to use the @code{install} command:
@itemize @bullet @itemize @bullet
@item @item
@ -431,7 +431,7 @@ configuration file), then run the following command at GRUB's command
line (after booting from the GRUB floppy): line (after booting from the GRUB floppy):
@example @example
install= (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p install (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p
@end example @end example
This tells GRUB to grab the first sector of the floppy and use it as the This tells GRUB to grab the first sector of the floppy and use it as the
@ -448,7 +448,7 @@ telling GRUB's stage1 to read from the first hard disk no matter where
the stage1 was loaded from: the stage1 was loaded from:
@example @example
install= (fd0)+1 d (fd0) (hd0,1)/boot/grub/stage2 0x8000 p install (fd0)+1 d (fd0) (hd0,1)/boot/grub/stage2 0x8000 p
@end example @end example
By default, GRUB loads the stage2 from the disk where the stage1 was By default, GRUB loads the stage2 from the disk where the stage1 was
@ -474,7 +474,7 @@ dd if=stage2/e2fs_stage1_5 of=/dev/hda bs=512 seek=1
Second, specify the stage1.5 argument in blocklist format: Second, specify the stage1.5 argument in blocklist format:
@example @example
install= (fd0)+1 (hd0) (hd0)1+1 0x2000 p (hd0,1)/boot/grub/stage2 install (fd0)+1 (hd0) (hd0)1+1 0x2000 p (hd0,1)/boot/grub/stage2
@end example @end example
@item @item
@ -485,7 +485,7 @@ hard disk, and setting the stage2's @dfn{configuration file} to
@file{(hd1,a)/grubdir/configfile}: @file{(hd1,a)/grubdir/configfile}:
@example @example
install= (hd0,1)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile install (hd0,1)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile
@end example @end example
@end itemize @end itemize
@ -494,14 +494,14 @@ and a configuration file which contains entries such as:
@example @example
# Start of entry: # Start of entry:
title= GNU/Linux installation title GNU/Linux installation
# Installation command: # Installation command:
install= (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p install (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p
# Actually boot here: # Actually boot here:
root= (hd0,1) root (hd0,1)
kernel= /zImage root=/dev/hda2 kernel /zImage root=/dev/hda2
@end example @end example
@dots{} then have the install script continue from there after boot of @dots{} then have the install script continue from there after boot of
@ -547,14 +547,11 @@ subset of the functions available in the BASH shell (@kbd{C-f} forward,
@kbd{C-k} delete to end, @kbd{C-u} delete to beginning; the PC left and @kbd{C-k} delete to end, @kbd{C-u} delete to beginning; the PC left and
right arrow keys, @key{HOME}, @key{DEL}, and @key{END} work as well). right arrow keys, @key{HOME}, @key{DEL}, and @key{END} work as well).
When typing commands interactively, if the cursor is before the @samp{=} When typing commands interactively, if the cursor is within or before
character in a command being typed, pressing the @key{TAB} key will the first word in the command-line, pressing the @key{TAB} key will
display a listing of the available commands, and if the cursor is after display a listing of the available commands, and if the cursor is after
the @samp{=} character, the @key{TAB} will provide a completion listing the first word, the @key{TAB} will provide a completion listing
of disks, partitions, and filenames depending on the context. of disks, partitions, and filenames depending on the context.
@c FIXME: But I want to stop this stupid hack and provide more BASH-like
@c interface. I don't think commands ending with @samp{=} are
@c beautiful.
@node Menu @node Menu
@ -642,28 +639,28 @@ start, where they are ignored.
Commands usable in configuration files only. Commands usable in configuration files only.
@table @code @table @code
@item timeout= @var{sec} @item timeout @var{sec}
Set a timeout, in @var{sec} seconds, before automatically booting the Set a timeout, in @var{sec} seconds, before automatically booting the
default entry (normally the first entry defined). default entry (normally the first entry defined).
@item default= @var{num} @item default @var{num}
Set the default entry to entry number @var{num} (if not specified, it is Set the default entry to entry number @var{num} (if not specified, it is
0, the first entry). 0, the first entry).
@item fallback= @var{num} @item fallback @var{num}
Go into unattended boot mode: if the default boot entry has any errors, 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, it immediately starts
over using the @var{num} entry (same numbering as the @code{default=} over using the @var{num} entry (same numbering as the @code{default}
command). This obviously doesn't help if the machine was in the middle command). This obviously doesn't help if the machine was in the middle
of the boot process (after leaving GRUB's code) and rebooted. of the boot process (after leaving GRUB's code) and rebooted.
@item password= @var{passwd} @var{new-config-file} @item password @var{passwd} @var{new-config-file}
Disable all interactive editing control (menu entry editor and Disable all interactive editing control (menu entry editor and
command line). If the password @var{passwd} is entered, it loads the command line). If the password @var{passwd} is entered, it loads the
@var{new-config-file} as a new config file and restarts the GRUB Stage @var{new-config-file} as a new config file and restarts the GRUB Stage
2. 2.
@item title= @var{name}@dots{} @item title @var{name}@dots{}
Start a new boot entry, and set its name to the contents of the rest of Start a new boot entry, and set its name to the contents of the rest of
the line, starting with the first non-space character. the line, starting with the first non-space character.
@end table @end table
@ -671,13 +668,13 @@ the line, starting with the first non-space character.
Commands usable both interactively and in configuration files: Commands usable both interactively and in configuration files:
@table @code @table @code
@item pause= @var{message}@dots{} @item pause @var{message}@dots{}
Print the @var{message}, then wait until a key is pressed. Note that Print the @var{message}, then wait until a key is pressed. Note that
placing @key{^G} (ASCII code 7) in the message will cause the speaker to placing @key{^G} (ASCII code 7) in the message will cause the speaker to
emit the standard beep sound, which is useful when prompting the user to emit the standard beep sound, which is useful when prompting the user to
change floppies. change floppies.
@item uppermem= @var{kbytes} @item uppermem @var{kbytes}
Force GRUB to ignore what it found during the autoprobe of the memory Force GRUB to ignore what it found during the autoprobe of the memory
available to the system, and to use @var{kbytes} as the number of available to the system, and to use @var{kbytes} as the number of
kilobytes of upper memory installed. Any address range maps of the kilobytes of upper memory installed. Any address range maps of the
@ -688,7 +685,7 @@ only be necessary on some old machines. GRUB's BIOS probe can pick up
all @sc{ram} on all new machines the author has ever heard of. It can all @sc{ram} on all new machines the author has ever heard of. It can
also be used for debugging purposes to lie to an OS. also be used for debugging purposes to lie to an OS.
@item root= @var{device} [@var{hdbias}] @item root @var{device} [@var{hdbias}]
Set the current @dfn{root partition} to the device @var{device}, then Set the current @dfn{root partition} to the device @var{device}, then
attempt to mount it to get the partition size (for passing the partition attempt to mount it to get the partition size (for passing the partition
descriptor in @code{ES:ESI}, used by some chain-loaded bootloaders), the descriptor in @code{ES:ESI}, used by some chain-loaded bootloaders), the
@ -701,19 +698,19 @@ one. An example is if there is an IDE disk and a SCSI disk, then set the
root partition normally, except for a kernel using a BSD boot root partition normally, except for a kernel using a BSD boot
methodology (FreeBSD or NetBSD), then use a @samp{1} for @var{hdbias}. methodology (FreeBSD or NetBSD), then use a @samp{1} for @var{hdbias}.
@item rootnoverify= @var{device} [@var{hdbias}] @item rootnoverify @var{device} [@var{hdbias}]
Similar to @command{root=}, but don't attempt to mount the Similar to @command{root}, but don't attempt to mount the
partition. This is useful for when an OS is outside of the area of the partition. This is useful for when an OS is outside of the area of the
disk that GRUB can read, but setting the correct root partition is still disk that GRUB can read, but setting the correct root partition is still
desired. Note that the items mentioned in @command{root=} above which desired. Note that the items mentioned in @command{root} above which
derived from attempting the mount will NOT work correctly. derived from attempting the mount will NOT work correctly.
@item chainloader= @var{file} @item chainloader @var{file}
Load @var{file} as a chain-loader. Like any other file loaded by the Load @var{file} as a chain-loader. Like any other file loaded by the
filesystem code, it can use the blocklist notation to grab the first filesystem code, it can use the blocklist notation to grab the first
sector of the current partition with @samp{+1}. sector of the current partition with @samp{+1}.
@item kernel= @var{file} @dots{} @item kernel @var{file} @dots{}
Attempt to load the primary boot image (Multiboot a.out or @sc{elf}, Attempt to load the primary boot image (Multiboot a.out or @sc{elf},
Linux zImage or bzImage, FreeBSD a.out, or NetBSD a.out) from Linux zImage or bzImage, FreeBSD a.out, or NetBSD a.out) from
@var{file}. This command ignores the rest of the contents of the line, @var{file}. This command ignores the rest of the contents of the line,
@ -721,22 +718,22 @@ except that the entire line starting with the kernel filename is passed
verbatim as the @dfn{kernel command line}. The module state is reset, verbatim as the @dfn{kernel command line}. The module state is reset,
and so you must reload any modules. and so you must reload any modules.
@item module= @var{file} @dots{} @item module @var{file} @dots{}
Load a boot module for a Multiboot format boot image (no interpretation Load a boot module for a Multiboot format boot image (no interpretation
of the file contents are made, so that user of this command must know of the file contents are made, so that user of this command must know
what the kernel in question works with). The rest of the line is passed what the kernel in question works with). The rest of the line is passed
as the @dfn{module command line} much like with the @command{kernel=} as the @dfn{module command line} much like with the @command{kernel}
command. command.
@item modulenounzip= @var{file} @dots{} @item modulenounzip @var{file} @dots{}
Exactly like @command{module=}, except that automatic decompression is Exactly like @command{module}, except that automatic decompression is
disabled. disabled.
@item initrd= @var{file} @dots{} @item initrd @var{file} @dots{}
Load an initial ramdisk for a Linux format boot image and set the Load an initial ramdisk for a Linux format boot image and set the
appropriate parameters in the Linux setup area in memory. appropriate parameters in the Linux setup area in memory.
@item install= @var{stage1-file} [d] @var{dest-device} @var{file} @var{addr} [p] [@var{config-file}] @item install @var{stage1-file} [d] @var{dest-device} @var{file} @var{addr} [p] [@var{config-file}]
This command is fairly complex, and for detailed examples one should This command is fairly complex, and for detailed examples one should
look at @ref{Automated install}. In short, it will perform a full look at @ref{Automated install}. In short, it will perform a full
install presuming the stage2 or stage1.5@footnote{They're loaded the install presuming the stage2 or stage1.5@footnote{They're loaded the
@ -768,7 +765,7 @@ This boots the OS/chain-loader which has been loaded. Only necessary if
running the fully interactive command line (it is implicit at the end of running the fully interactive command line (it is implicit at the end of
a config-file entry). a config-file entry).
@item color= @var{normal} [@var{highlight}] @item color @var{normal} [@var{highlight}]
Change the menu colors. The color @var{normal} is used for the normal Change the menu colors. The color @var{normal} is used for the normal
line in the menu, and the color @var{highlight} is used to highlight the line in the menu, and the color @var{highlight} is used to highlight the
line where the cursor points to. If you omit @var{highlight}, then the line where the cursor points to. If you omit @var{highlight}, then the
@ -841,24 +838,23 @@ file:
@example @example
# Set default colors (light gray / blue, black / light gray). # Set default colors (light gray / blue, black / light gray).
color= 0x17 0x70 color 0x17 0x70
# Change the colors. # Change the colors.
title= OS-BS like title OS-BS like
color= 0x16 0x60 color 0x16 0x60
@end example @end example
@item testload= @var{file} @item testload @var{file}
Read the entire contents of @var{file} in several different ways and Read the entire contents of @var{file} in several different ways and
compares them, to test the filesystem code. The output is somewhat compares them, to test the filesystem code. The output is somewhat
cryptic (see the @samp{T} subcommand of @command{syscmd=} below), but if cryptic , but if no errors are reported and the final @samp{i=@var{X},
no errors are reported and the final @samp{i=@var{X}, filepos=@var{Y}} filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is
reading has @var{X} and @var{Y} equal, then it is definitely consistent, definitely consistent, and very likely works correctly subject to a
and very likely works correctly subject to a consistent offset error. If consistent offset error. If this test succeeds, then a good next step is
this test succeeds, then a good next step is to try loading a kernel to try loading a kernel with your code.
with your code.
@item read= @var{addr} @item read @var{addr}
Read a 32-bit unsigned value from memory at address @var{addr} and Read a 32-bit unsigned value from memory at address @var{addr} and
displays it in hex format. displays it in hex format.
@ -886,8 +882,8 @@ routines. The format is @samp{<@var{partition-offset-sector},
partition, and @samp{[@var{disk-offset-sector}]} for low-level sector partition, and @samp{[@var{disk-offset-sector}]} for low-level sector
requests from the disk. requests from the disk.
Filesystem test mode is turned off by any use of the @command{install=} Filesystem test mode is turned off by any use of the @command{install}
or @command{testload=} commands. or @command{testload} commands.
@item quit @item quit
Exit from the grub shell @command{grub} (@pxref{The grub shell}). This Exit from the grub shell @command{grub} (@pxref{The grub shell}). This
@ -1284,8 +1280,8 @@ option in the command line. This is a simple example:
#!/bin/sh #!/bin/sh
/sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null /sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null
root= (hd0,0) root (hd0,0)
install= /boot/grub/stage1 (hd0) /boot/grub/stage2 0x8000 p install /boot/grub/stage1 (hd0) /boot/grub/stage2 0x8000 p
quit quit
EOT EOT
@end example @end example
@ -2856,7 +2852,7 @@ Should be set to the value of @samp{debug_fs} @emph{only} during reading
of data for the file, not any other fs data, inodes, FAT tables, of data for the file, not any other fs data, inodes, FAT tables,
whatever, then set to @code{NULL} at all other times (it will be whatever, then set to @code{NULL} at all other times (it will be
@code{NULL} by default). If this isn't done corrently, then the @code{NULL} by default). If this isn't done corrently, then the
@command{testload=} and @command{install=} commands won't work @command{testload} and @command{install} commands won't work
correctly. correctly.
@end vtable @end vtable

View file

@ -3,49 +3,49 @@
# #
# Boot automatically after 30 secs. # Boot automatically after 30 secs.
timeout= 30 timeout 30
# By default, boot the first entry. # By default, boot the first entry.
default= 0 default 0
# For booting the GNU HURD # For booting the GNU HURD
title= GNU/HURD title GNU/HURD
root= (hd0,0) root (hd0,0)
kernel= /boot/gnumach root=hd0s1 kernel /boot/gnumach root=hd0s1
module= /boot/serverboot module /boot/serverboot
# For booting Linux # For booting Linux
title= GNU/Linux title GNU/Linux
kernel= (hd1,0)/vmlinuz root=/dev/hdb1 kernel (hd1,0)/vmlinuz root=/dev/hdb1
# For booting Mach (getting kernel from floppy) # For booting Mach (getting kernel from floppy)
title= Utah Mach4 multiboot title Utah Mach4 multiboot
root= (hd0,2) root (hd0,2)
pause=My test!! pause My test!!
kernel= (fd0)/boot/kernel root=hd0s3 kernel (fd0)/boot/kernel root=hd0s3
module= (fd0)/boot/bootstrap module (fd0)/boot/bootstrap
# For booting FreeBSD (getting kernel from floppy) # For booting FreeBSD (getting kernel from floppy)
title= FreeBSD 2.2-SNAP title FreeBSD 2.2-SNAP
root= (hd0,2) root (hd0,2)
kernel= (fd0)/kernel kernel (fd0)/kernel
# For booting OS/2 # For booting OS/2
title= OS/2 title OS/2
root= (hd0,1) root (hd0,1)
makeactive makeactive
# chainload OS/2 bootloader from the first sector # chainload OS/2 bootloader from the first sector
chainloader= +1 chainloader +1
# This is similar to "chainload", but loads a specific file # This is similar to "chainload", but loads a specific file
#chainloader= /boot/chain.os2 #chainloader /boot/chain.os2
# For booting Windows NT 3.5 or Windows95 # For booting Windows NT 3.5 or Windows95
title= Windows NT 3.5/Windows 95 boot menu title Windows NT 3.5/Windows 95 boot menu
root= (0x80,0) root (0x80,0)
makeactive makeactive
chainloader= +1 chainloader +1
# For installing GRUB into the hard disk # For installing GRUB into the hard disk
title= Install GRUB into the hard disk title Install GRUB into the hard disk
root= (hd0,0) root (hd0,0)
install= /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 p install /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 p

View file

@ -262,7 +262,10 @@ get_cmdline (char *prompt, char *commands, char *cmdline, int maxlen,
{ {
int i, j = 0, llen_old = llen; int i, j = 0, llen_old = llen;
while (cmdline[j] && cmdline[j] != '=') /* Find the first word. */
while (cmdline[j] == ' ')
j++;
while (cmdline[j] && cmdline[j] != '=' && cmdline[j] != ' ')
j++; j++;
/* since the command line cannot have a '\n', we're OK to use c */ /* since the command line cannot have a '\n', we're OK to use c */

View file

@ -40,17 +40,26 @@ int debug = 0;
int normal_color; int normal_color;
int highlight_color; int highlight_color;
/* Find the next word from CMDLINE and return the pointer. If
AFTER_EQUAL is non-zero, assume that the character `=' is treated as
a space. Caution: this assumption is for backward compatibility. */
char * char *
skip_to (int after_equal, char *cmdline) skip_to (int after_equal, char *cmdline)
{ {
while (*cmdline && (*cmdline != (after_equal ? '=' : ' '))) if (after_equal)
cmdline++; {
while (*cmdline && *cmdline != ' ' && *cmdline != '=')
if (after_equal && *cmdline) cmdline++;
cmdline++; while (*cmdline == ' ' || *cmdline == '=')
cmdline++;
while (*cmdline == ' ') }
cmdline++; else
{
while (*cmdline && *cmdline != ' ')
cmdline++;
while (*cmdline == ' ')
cmdline++;
}
return cmdline; return cmdline;
} }
@ -65,13 +74,13 @@ init_cmdline (void)
} }
char commands[] = char commands[] =
" Possible commands are: \"pause= ...\", \"uppermem= <kbytes>\", \"root= <device>\", " Possible commands are: \"pause ...\", \"uppermem <kbytes>\", \"root <device>\",
\"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\", \"rootnoverify <device>\", \"chainloader <file>\", \"kernel <file> ...\",
\"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\", \"testload <file>\", \"read <addr>\", \"displaymem\", \"impsprobe\",
\"geometry= <drive>\", \"hide= <device>\", \"unhide= <device>\", \"geometry <drive>\", \"hide <device>\", \"unhide <device>\",
\"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\", \"fstest\", \"debug\", \"module <file> ...\", \"modulenounzip <file> ...\",
\"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\" and \"color <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\" and
\"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n"; \"install <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
static void static void
debug_fs_print_func (int sector) debug_fs_print_func (int sector)