Help message changes, and a little fix for partition hiding.

This commit is contained in:
gord 1999-09-10 05:06:00 +00:00
parent 82889257ad
commit 99c588976f
5 changed files with 385 additions and 400 deletions

View file

@ -1,3 +1,19 @@
1999-09-09 Gordon Matzigkeit <gord@fig.org>
* docs/grub.texi (Commands): Synchronize descriptions with
builtins.c.
* stage2/builtins.c (hide_func): Use set_partition_hidden_flag.
(unhide_func): Likewise.
Many help message cleanups. From Pavel Roskin.
* stage2/shared.h (set_partition_hidden_flag): Declare.
* stage2/disk_io.c (set_partition_hidden_flag): New function
merged from hide_partition and unhide_partition. Make sure we OR
with the inverse of the flag bit rather than XORing to unhide the
partition.
1999-09-10 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* grub/asmstub.c (_FILE_OFFSET_BITS): Defined.

View file

@ -639,10 +639,6 @@ start, where they are ignored.
Commands usable in configuration files only.
@table @code
@item timeout @var{sec}
Set a timeout, in @var{sec} seconds, before automatically booting the
default entry (normally the first entry defined).
@item default @var{num}
Set the default entry to entry number @var{num} (if not specified, it is
0, the first entry).
@ -651,8 +647,8 @@ Set the default entry to entry number @var{num} (if not specified, it is
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
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
of the boot process (after leaving GRUB's code) and rebooted.
command). This obviously won't help if the machine was rebooted by a
kernel that GRUB loaded.
@item password @var{passwd} @var{new-config-file}
Disable all interactive editing control (menu entry editor and
@ -660,6 +656,10 @@ 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
2.
@item timeout @var{sec}
Set a timeout, in @var{sec} seconds, before automatically booting the
default entry (normally the first entry defined).
@item title @var{name}@dots{}
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.
@ -668,111 +668,19 @@ the line, starting with the first non-space character.
Commands usable both interactively and in configuration files:
@table @code
@item pause @var{message}@dots{}
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
emit the standard beep sound, which is useful when prompting the user to
change floppies.
@item uppermem @var{kbytes}
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
kilobytes of upper memory installed. Any address range maps of the
system are discarded.
@strong{Caution:} This should be used with great caution, and should
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
also be used for debugging purposes to lie to an OS.
@item root @var{device} [@var{hdbias}]
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
descriptor in @code{ES:ESI}, used by some chain-loaded bootloaders), the
BSD drive-type (for booting BSD kernels using their native boot format),
and fix up automatic determination of the PC partition where a BSD
sub-partition is located. The optional @var{hdbias} parameter is a
number to tell a kernel which is using one of the BSD boot methodologies
how many BIOS drive numbers are on controllers before the current
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
methodology (FreeBSD or NetBSD), then use a @samp{1} for @var{hdbias}.
@item rootnoverify @var{device} [@var{hdbias}]
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
disk that GRUB can read, but setting the correct root partition is still
desired. Note that the items mentioned in @command{root} above which
derived from attempting the mount will NOT work correctly.
@item chainloader @var{file}
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
sector of the current partition with @samp{+1}.
@item kernel @var{file} @dots{}
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
@var{file}. This command ignores the rest of the contents of the line,
except that the entire line starting with the kernel filename is passed
verbatim as the @dfn{kernel command line}. The module state is reset,
and so you must reload any modules.
@item module @var{file} @dots{}
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
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}
command.
@item modulenounzip @var{file} @dots{}
Exactly like @command{module}, except that automatic decompression is
disabled.
@item initrd @var{file} @dots{}
Load an initial ramdisk for a Linux format boot image and set the
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}]
This command is fairly complex, and for detailed examples one should
look at @ref{Automated install}. In short, it will perform a full
install presuming the stage2 or stage1.5@footnote{They're loaded the
same way, so we will refer to the stage1.5 as a stage2 from now on.}
is in its final install location.
In slightly more detail, it will load @var{stage1-file}, validate that
it is a GRUB stage1 of the right version number, install a blocklist for
loading @var{file} as a stage2. If the option @samp{d} is present, the
stage1 will always look for the actual disk @var{file} was installed on,
rather than using the booting drive. The stage2 will be loaded at
address @var{addr}, which must be @samp{0x8000} for a true stage2, and
@samp{0x2000} for a stage1.5. It then writes the completed stage1 to
the first block of the device @var{dest-dev}. If the options @samp{p} or
@var{config-file} are present, then it reads the first block of stage2,
modifies it with the values of the partition @var{file} was found on
(for @samp{p}) or places the string @var{config-file} into the area
telling the stage2 where to look for a configuration file at boot time.
This command preserves the DOS BPB (and for hard disks, the partition
table) of the sector the stage1 is to be installed into.
@item makeactive
Set the active partition on the root disk to GRUB's root partition (on a
floppy this has no effect). This is limited to working with @emph{primary}
PC partitions.
@item boot
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
a config-file entry).
@item color @var{normal} [@var{highlight}]
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 where the cursor points to. If you omit @var{highlight}, then the
Change the menu colors. The color @var{normal} is used for most
lines in the menu, and the color @var{highlight} is used to highlight the
line where the cursor points. If you omit @var{highlight}, then the
inverted color of @var{normal} is used for the highlighted line. You
must specify an integer for a color value, and the 0-3 bits represents
the foreground color, the 4-6 bits represents the background color, and
the 7 bit represents that the foreground blinks.
must specify an integer for a color value, where bits 0-3 represent
the foreground color, bits 4-6 represent the background color, and
bit 7 indicates that the foreground blinks.
These are the possible values and the meanings:
@ -845,18 +753,13 @@ title OS-BS like
color 0x16 0x60
@end example
@item testload @var{file}
Read the entire contents of @var{file} in several different ways and
compares them, to test the filesystem code. The output is somewhat
cryptic , but if no errors are reported and the final @samp{i=@var{X},
filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is
definitely consistent, and very likely works correctly subject to a
consistent offset error. If this test succeeds, then a good next step is
to try loading a kernel with your code.
@item chainloader @var{file}
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
sector of the current partition with @samp{+1}.
@item read @var{addr}
Read a 32-bit unsigned value from memory at address @var{addr} and
displays it in hex format.
@item configfile @var{file}
Load @var{file} as the configuration file.
@item displaymem
Display what GRUB thinks the system address space map of the machine is,
@ -868,10 +771,6 @@ at 1MB and going up to the first chipset hole for @dfn{upper memory}
(the standard PC @dfn{upper memory} interface is limited to reporting a
maximum of 64MB).
@item impsprobe
Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration
table and boot the various CPUs which are found into a tight loop.
@item fstest
Toggle filesystem test mode.
@ -885,9 +784,115 @@ requests from the disk.
Filesystem test mode is turned off by any use of the @command{install}
or @command{testload} commands.
@item hide @var{partition}
Hide @var{partition} by setting the @dfn{hidden} bit in its partition
type code.
@item impsprobe
Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration
table and boot the various CPUs which are found into a tight loop.
@item initrd @var{file} @dots{}
Load an initial ramdisk for a Linux format boot image and set the
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}]
This command is fairly complex, and for detailed examples one should
look at @ref{Automated install}. In short, it will perform a full
install presuming the stage2 or stage1.5@footnote{They're loaded the
same way, so we will refer to the stage1.5 as a stage2 from now on.}
is in its final install location.
In slightly more detail, it will load @var{stage1-file}, validate that
it is a GRUB stage1 of the right version number, install a blocklist for
loading @var{file} as a stage2. If the option @samp{d} is present, the
stage1 will always look for the actual disk @var{file} was installed on,
rather than using the booting drive. The stage2 will be loaded at
address @var{addr}, which must be @samp{0x8000} for a true stage2, and
@samp{0x2000} for a stage1.5. It then writes the completed stage1 to
the first block of the device @var{dest-dev}. If the options @samp{p} or
@var{config-file} are present, then it reads the first block of stage2,
modifies it with the values of the partition @var{file} was found on
(for @samp{p}) or places the string @var{config-file} into the area
telling the stage2 where to look for a configuration file at boot time.
This command preserves the DOS BPB (and for hard disks, the partition
table) of the sector the stage1 is to be installed into.
@item kernel @var{file} @dots{}
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
@var{file}. The rest of the line is passed verbatim as the @dfn{kernel
command line}. Any modules must be reloaded after using this command.
@item makeactive
Set the active partition on the root disk to GRUB's root partition.
This command is limited to @emph{primary} PC partitions on a hard disk.
@item module @var{file} @dots{}
Load a boot module @var{file} for a Multiboot format boot image (no
interpretation of the file contents are made, so that user of this
command must know what the kernel in question expects). The rest of the
line is passed as the @dfn{module command line}, like the
@command{kernel} command.
@item modulenounzip @var{file} @dots{}
The same as @command{module}, except that automatic decompression is
disabled.
@item pause @var{message}@dots{}
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
emit the standard beep sound, which is useful when prompting the user to
change floppies.
@item quit
Exit from the grub shell @command{grub} (@pxref{The grub shell}). This
is just ignored in the native Stage 2.
Exit from the GRUB shell @command{grub} (@pxref{The grub shell}). This
command is ignored in the native Stage 2.
@item read @var{addr}
Read a 32-bit value from memory at address @var{addr} and
display it in hex format.
@item root @var{device} [@var{hdbias}]
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
descriptor in @code{ES:ESI}, used by some chain-loaded bootloaders), the
BSD drive-type (for booting BSD kernels using their native boot format),
and correctly determine the PC partition where a BSD sub-partition is
located. The optional @var{hdbias} parameter is a number to tell a BSD
kernel how many BIOS drive numbers are on controllers before the current
one. For example, if there is an IDE disk and a SCSI disk, and your
FreeBSD root partition is on the SCSI disk, then use a @samp{1} for
@var{hdbias}.
@item rootnoverify @var{device} [@var{hdbias}]
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
disk that GRUB can read, but setting the correct root partition is still
desired. Note that the items mentioned in @command{root} above which
derived from attempting the mount will @emph{not} work correctly.
@item testload @var{file}
Read the entire contents of @var{file} in several different ways and
compares them, to test the filesystem code. The output is somewhat
cryptic , but if no errors are reported and the final @samp{i=@var{X},
filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is
definitely consistent, and very likely works correctly subject to a
consistent offset error. If this test succeeds, then a good next step is
to try loading a kernel.
@item unhide @var{partition}
Unhide @var{partition} by clearing the @dfn{hidden} bit in its partition
type code.
@item uppermem @var{kbytes}
Force GRUB to assume that only @var{kbytes} kilobytes of upper memory
are installed. Any system address range maps are discarded.
@strong{Caution:} This should be used with great caution, and should
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
also be used for debugging purposes to lie to an OS.
@end table

View file

@ -187,13 +187,13 @@ static struct builtin builtin_color =
color_func,
BUILTIN_CMDLINE | BUILTIN_MENU,
"color NORMAL [HIGHLIGHT]",
"Change the menu colors. The color NORMAL is used for the normal"
" line in the menu, and the color HIGHLIGHT is used to highlight the"
" line where the cursor points to. If you omit HIGHLIGHT, then the"
"Change the menu colors. The color NORMAL is used for most"
" lines in the menu, and the color HIGHLIGHT is used to highlight the"
" line where the cursor points. If you omit HIGHLIGHT, then the"
" inverted color of NORMAL is used for the highlighted line. You"
" must specify an integer for a color value, and the 0-3 bits"
" represents the foreground color, the 4-6 bits represents the"
" background color, and the 7 bit represents that the foreground"
" must specify an integer for a color value, where bits 0-3"
" represent the foreground color, bits 4-6 represents the"
" background color, and bit 7 indicates that the foreground"
" blinks."
};
@ -230,7 +230,7 @@ static struct builtin builtin_configfile =
configfile_func,
BUILTIN_CMDLINE,
"configfile FILE",
"Load the file FILE as the configuration file."
"Load FILE as the configuration file."
};
@ -357,9 +357,8 @@ static struct builtin builtin_fallback =
"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 over using the NUM entry (same numbering as the"
" `default=' command). This obviously doesn't help if the machine"
" was in the middle of the boot process (after leaving GRUB's code)"
" and rebooted."
" `default=' command). This obviously won't help if the machine"
" was rebooted by a kernel that GRUB loaded."
#endif
};
@ -561,7 +560,7 @@ hide_func (char *arg, int flags)
saved_partition = current_partition;
saved_drive = current_drive;
if (! hide_partition ())
if (! set_partition_hidden_flag (1))
return 1;
return 0;
@ -572,8 +571,9 @@ static struct builtin builtin_hide =
"hide",
hide_func,
BUILTIN_CMDLINE | BUILTIN_MENU,
"hide DRIVE",
"Hide the drive DRIVE by adding 0x10 into the partition type."
"hide PARTITION",
"Hide PARTITION by setting the \"hidden\" bit in"
" its partition type code."
};
@ -777,9 +777,9 @@ install_func (char *arg, int flags)
if (! new_drive)
new_drive = current_drive;
else if (current_drive != dest_drive)
grub_printf ("Warning: the option `d' is not found, but Stage 2 will"
"be install into a\ndifferent drive from a drive into"
" which is installed Stage 1.\n");
grub_printf ("Warning: the option `d' was not used, but the Stage 1 will"
"be installed on a\ndifferent drive than the drive where"
" the Stage 2 resides.\n");
memmove ((char*) BOOTSEC_LOCATION, buffer, SECTOR_SIZE);
@ -884,16 +884,15 @@ static struct builtin builtin_install =
install_func,
BUILTIN_CMDLINE,
"install STAGE1 [d] DEVICE STAGE2 ADDR [p] [CONFIG_FILE]",
"Install STAGE1 into DEVICE, and install a blocklist for loading STAGE2"
"Install STAGE1 on DEVICE, and install a blocklist for loading STAGE2"
" as a Stage 2. If the option `d' is present, the Stage 1 will always"
" look for the actual disk STAGE2 is installed on, rather than using"
" look for the disk where STAGE2 was installed, rather than using"
" the booting drive. The Stage 2 will be loaded at address ADDR, which"
" must be 0x8000 for a true Stage 2, and 0x2000 for a Stage 1.5. If"
" the option `p' or CONFIG_FILE are present, then it reads the first"
" block of Stage 2, modifies it with the values of the partition STAGE2"
" was found on for `p' or places the string CONFIG_FILE into the area"
" telling the Stage 2 where to look for a configuration file at boot"
" time."
" the option `p' or CONFIG_FILE is present, then the first block"
" of Stage 2 is patched with new values of the partition and name"
" of the configuration file used by the true Stage 2 (for a Stage 1.5,"
" this is the name of the true Stage 2) at boot time."
};
@ -929,10 +928,9 @@ static struct builtin builtin_kernel =
"kernel FILE [ARG ...]",
"Attempt to load the primary boot image (Multiboot a.out or ELF,"
" Linux zImage or bzImage, FreeBSD a.out, or NetBSD a.out) from"
" FILE. This command ignores the rest of the contents of the line,"
" except that the entire line starting with FILE is"
" passed verbatim as the \"kernel command line\". The module state is"
" reset, and so you must reload any modules."
" FILE. The rest of the line is passed verbatim as the"
" \"kernel command line\". Any modules must be reloaded after"
" using this command."
};
@ -952,9 +950,8 @@ static struct builtin builtin_makeactive =
makeactive_func,
BUILTIN_CMDLINE,
"makeactive",
"Set the active partition on the root disk to GRUB's root partition"
" (on a floppy this has no effect). This is limited to working with"
" _primary_ PC partitions."
"Set the active partition on the root disk to GRUB's root partition."
" This command is limited to _primary_ PC partitions on a hard disk."
};
@ -999,10 +996,10 @@ static struct builtin builtin_module =
BUILTIN_CMDLINE,
"module FILE [ARG ...]",
"Load a boot module FILE for a Multiboot format boot image (no"
" interpretation 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 as the \"module command line\" much like"
" with the `kernel=' command."
" interpretation of the file contents is made, so users of this"
" command must know what the kernel in question expects). The"
" rest of the line is passed as the \"module command line\", like"
" the `kernel=' command."
};
@ -1031,7 +1028,7 @@ static struct builtin builtin_modulenounzip =
modulenounzip_func,
BUILTIN_CMDLINE,
"modulenounzip FILE [ARG ...]",
"Exactly like `module=', except that automatic decompression is"
"The same as `module=', except that automatic decompression is"
" disabled."
};
@ -1109,7 +1106,7 @@ static struct builtin builtin_quit =
quit_func,
BUILTIN_CMDLINE,
"quit",
"Exit from the grub shell."
"Exit from the GRUB shell."
};
@ -1132,8 +1129,8 @@ static struct builtin builtin_read =
read_func,
BUILTIN_CMDLINE,
"read ADDR",
"Read a 32-bit unsigned value from memory at address ADDR and"
" displays it in hex format."
"Read a 32-bit value from memory at address ADDR and"
" display it in hex format."
};
@ -1180,14 +1177,12 @@ static struct builtin builtin_root =
" attempt to mount it to get the partition size (for passing the"
" partition descriptor in `ES:ESI', used by some chain-loaded"
" bootloaders), the BSD drive-type (for booting BSD kernels using"
" their native boot format), and fix up automatic determination of"
" their native boot format), and correctly determine "
" the PC partition where a BSD sub-partition is located. The"
" optional HDBIAS parameter is a number to tell a kernel which is"
" using one of the BSD boot methodologies how many BIOS drive"
" numbers are on controllers before the current 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"
" methodology (FreeBSD or NetBSD), then use a `1' for HDBIAS."
" optional HDBIAS parameter is a number to tell a BSD kernel"
" how many BIOS drive numbers are on controllers before the current"
" one. For example, if there is an IDE disk and a SCSI disk, and your"
" FreeBSD root partition is on the SCSI disk, then use a `1' for HDBIAS."
};
@ -1301,7 +1296,7 @@ static struct builtin builtin_testload =
" filepos=Y' reading has X and Y equal, then it is definitely"
" consistent, and very likely works correctly subject to a"
" consistent offset error. If this test succeeds, then a good next"
" step is to try loading a kernel with your code."
" step is to try loading a kernel."
};
@ -1358,7 +1353,7 @@ unhide_func (char *arg, int flags)
saved_partition = current_partition;
saved_drive = current_drive;
if (! unhide_partition ())
if (! set_partition_hidden_flag (0))
return 1;
return 0;
@ -1369,8 +1364,9 @@ static struct builtin builtin_unhide =
"unhide",
unhide_func,
BUILTIN_CMDLINE | BUILTIN_MENU,
"unhide DRIVE",
"Unhide the drive DRIVE by subtracting 0x10 from the partition type."
"unhide PARTITION",
"Unhide PARTITION by clearing the \"hidden\" bit in its"
" partition type code."
};
@ -1391,10 +1387,8 @@ static struct builtin builtin_uppermem =
uppermem_func,
BUILTIN_CMDLINE,
"uppermem KBYTES",
"Force GRUB to ignore what it found during the autoprobe of the"
" memory available to the system, and to use KBYTES as the number of"
" kilobytes of upper memory installed. Any address range maps of the"
" system are discarded."
"Force GRUB to assume that only KBYTES kilobytes of upper memory are"
" installed. Any system address range maps are discarded."
};

View file

@ -312,7 +312,7 @@ make_saved_active (void)
}
int
unhide_partition (void)
set_partition_hidden_flag (int hidden)
{
if (saved_drive)
{
@ -329,39 +329,11 @@ unhide_partition (void)
if (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG)
{
PC_SLICE_TYPE (SCRATCHADDR, part) ^= PC_SLICE_TYPE_HIDDEN_FLAG;
buf_track = -1;
if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom,
0, 1, SCRATCHSEG))
{
errnum = ERR_WRITE;
return 0;
}
}
}
return 1;
}
int
hide_partition (void)
{
if (saved_drive)
{
int part = saved_partition >> 16;
if (part > 3)
{
errnum = ERR_NO_PART;
return 0;
}
if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, (char *) SCRATCHADDR))
return 0;
if (! (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG))
{
if (hidden)
PC_SLICE_TYPE (SCRATCHADDR, part) |= PC_SLICE_TYPE_HIDDEN_FLAG;
else
PC_SLICE_TYPE (SCRATCHADDR, part) &= ~PC_SLICE_TYPE_HIDDEN_FLAG;
buf_track = -1;
if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom,
0, 1, SCRATCHSEG))
@ -375,6 +347,7 @@ hide_partition (void)
return 1;
}
static void
check_and_print_mount (void)
{

View file

@ -598,11 +598,8 @@ int open_partition (void);
/* Sets device to the one represented by the SAVED_* parameters. */
int make_saved_active (void);
/* Hide a partition. */
int hide_partition (void);
/* Unhide a partition. */
int unhide_partition (void);
/* Set or clear the current root partition's hidden flag. */
int set_partition_hidden_flag (int hidden);
/* Open a file or directory on the active device, using GRUB's
internal filesystem support. */