disable the device map file by default.

This commit is contained in:
okuji 1999-11-11 23:48:15 +00:00
parent c95941d65d
commit 8bc82ce256
5 changed files with 110 additions and 98 deletions

View file

@ -1,3 +1,15 @@
1999-11-12 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
Do not use the device map file unless --device-map is specified.
* grub/main.c (device_map_file): Set to 0.
(default_device_map_file): Removed.
(usage): Do not print DEFAULT_DEVICE_MAP_FILE.
* grub/asmstub.c (init_device_map): If DEVICE_MAP_FILE is NULL,
do not try to open the device map file.
Set FP to NULL by default.
* docs/grub.8: Regenerated.
1999-11-11 Michael Hohmuth <hohmuth@innocent.com> 1999-11-11 Michael Hohmuth <hohmuth@innocent.com>
* stage2/boot.c (load_image): grub_close was called after * stage2/boot.c (load_image): grub_close was called after

5
NEWS
View file

@ -7,9 +7,8 @@ New in 0.5.94:
* The command "embed" embeds a Stage 1.5 in the sectors after a MBR. * The command "embed" embeds a Stage 1.5 in the sectors after a MBR.
* Support symbolic color name syntax in the command "color". * Support symbolic color name syntax in the command "color".
* The grub shell loads the BIOS drive mapping information from a device * The grub shell loads the BIOS drive mapping information from a device
map file (the default is "/boot/grub/device.map") if it already map file if it is specified and can be opened. If not found, try to
exists. If not found, try to create it based on the guessed create it based on the guessed information.
information.
* NetBSD support in the grub shell is improved. * NetBSD support in the grub shell is improved.
* A simple checker for the format of a Multiboot kernel, ``mbchk'', is * A simple checker for the format of a Multiboot kernel, ``mbchk'', is
added. added.

View file

@ -1221,18 +1221,18 @@ Print the version number of GRUB and exit.
Print some verbose messages for debugging purpose. Print some verbose messages for debugging purpose.
@item --device-map=@var{file} @item --device-map=@var{file}
Read the device map file instead of @file{/boot/grub/device.map}. The Use the device map file @var{file}. The format is described in
format is described in @ref{Device map}. @ref{Device map}.
@item --no-floppy @item --no-floppy
Do not probe any floppy drive. This option has no effect if there is the Do not probe any floppy drive. This option has no effect if the option
device map file (@pxref{Device map}). @option{--device-map} is specified (@pxref{Device map}).
@item --probe-second-floppy @item --probe-second-floppy
Probe the second floppy drive. If this option is not specified, the grub Probe the second floppy drive. If this option is not specified, the grub
shell does not probe it, as that sometimes takes a long time. If there shell does not probe it, as that sometimes takes a long time. If you
is the device map file (@pxref{Device map}), the grub shell just ignores specify the device map file (@pxref{Device map}), the grub shell just
this option. ignores this option.
@item --config-file=@var{file} @item --config-file=@var{file}
Read the configuration file @var{file} instead of Read the configuration file @var{file} instead of
@ -1318,10 +1318,9 @@ EOT
@node Device map @node Device map
@section The map between BIOS drives and OS devices @section The map between BIOS drives and OS devices
The grub shell creates the @dfn{device map file} automatically unless it When you specify the option @option{--device-map} (@pxref{Basic usage}),
already exists. The default location is the grub shell creates the @dfn{device map file} automatically unless it
@file{/boot/grub/device.map}. @xref{Basic usage}, if you want to change already exists. The filename @file{/boot/grub/device.map} is preferred.
the filename.
If the device map file exists, the grub shell reads it to map BIOS If the device map file exists, the grub shell reads it to map BIOS
drives to OS devices. This file consists of lines like this: drives to OS devices. This file consists of lines like this:

View file

@ -223,7 +223,7 @@ init_device_map (void)
{ {
int i; int i;
int num_hd = 0; int num_hd = 0;
FILE *fp; FILE *fp = 0;
static void print_error (int no, const char *msg) static void print_error (int no, const char *msg)
{ {
@ -240,6 +240,8 @@ init_device_map (void)
for (i = 0; i < NUM_DISKS; i++) for (i = 0; i < NUM_DISKS; i++)
device_map[i] = 0; device_map[i] = 0;
if (device_map_file)
{
/* Open the device map file. */ /* Open the device map file. */
fp = fopen (device_map_file, "r"); fp = fopen (device_map_file, "r");
if (fp) if (fp)
@ -323,11 +325,13 @@ init_device_map (void)
fclose (fp); fclose (fp);
return; return;
} }
}
/* Print something as the user does not think GRUB has been crashed. */ /* Print something as the user does not think GRUB has been crashed. */
fprintf (stderr, fprintf (stderr,
"Probe devices to guess BIOS drives. This may take a long time.\n"); "Probe devices to guess BIOS drives. This may take a long time.\n");
if (device_map_file)
/* Try to open the device map file to write the probed data. */ /* Try to open the device map file to write the probed data. */
fp = fopen (device_map_file, "w"); fp = fopen (device_map_file, "w");

View file

@ -38,11 +38,10 @@ int verbose = 0;
int read_only = 0; int read_only = 0;
int no_floppy = 0; int no_floppy = 0;
int probe_second_floppy = 0; int probe_second_floppy = 0;
char *device_map_file = "/boot/grub/device.map"; char *device_map_file = 0;
static int default_boot_drive; static int default_boot_drive;
static int default_install_partition; static int default_install_partition;
static char *default_config_file; static char *default_config_file;
static char *default_device_map_file;
#define OPT_HELP -2 #define OPT_HELP -2
#define OPT_VERSION -3 #define OPT_VERSION -3
@ -94,7 +93,7 @@ Enter the GRand Unified Bootloader command shell.\n\
--batch turn on batch mode for non-interactive use\n\ --batch turn on batch mode for non-interactive use\n\
--boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\n\ --boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\n\
--config-file=FILE specify stage2 config_file [default=%s]\n\ --config-file=FILE specify stage2 config_file [default=%s]\n\
--device-map=FILE specify the device map file [default=%s]\n\ --device-map=FILE Use the device map file FILE\n\
--help display this message and exit\n\ --help display this message and exit\n\
--hold wait until a debugger will attach\n\ --hold wait until a debugger will attach\n\
--install-partition=PAR specify stage2 install_partition [default=0x%x]\n\ --install-partition=PAR specify stage2 install_partition [default=0x%x]\n\
@ -109,7 +108,7 @@ Enter the GRand Unified Bootloader command shell.\n\
Report bugs to bug-grub@gnu.org\n\ Report bugs to bug-grub@gnu.org\n\
", ",
default_boot_drive, default_config_file, default_boot_drive, default_config_file,
default_device_map_file, default_install_partition); default_install_partition);
exit (status); exit (status);
} }
@ -133,7 +132,6 @@ main (int argc, char **argv)
default_config_file = config_file; default_config_file = config_file;
else else
default_config_file = "NONE"; default_config_file = "NONE";
default_device_map_file = device_map_file;
/* Parse command-line options. */ /* Parse command-line options. */
do do