disable the device map file by default.
This commit is contained in:
parent
c95941d65d
commit
8bc82ce256
5 changed files with 110 additions and 98 deletions
12
ChangeLog
12
ChangeLog
|
@ -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>
|
||||
|
||||
* stage2/boot.c (load_image): grub_close was called after
|
||||
|
|
5
NEWS
5
NEWS
|
@ -7,9 +7,8 @@ New in 0.5.94:
|
|||
* The command "embed" embeds a Stage 1.5 in the sectors after a MBR.
|
||||
* Support symbolic color name syntax in the command "color".
|
||||
* The grub shell loads the BIOS drive mapping information from a device
|
||||
map file (the default is "/boot/grub/device.map") if it already
|
||||
exists. If not found, try to create it based on the guessed
|
||||
information.
|
||||
map file if it is specified and can be opened. If not found, try to
|
||||
create it based on the guessed information.
|
||||
* NetBSD support in the grub shell is improved.
|
||||
* A simple checker for the format of a Multiboot kernel, ``mbchk'', is
|
||||
added.
|
||||
|
|
|
@ -1221,18 +1221,18 @@ Print the version number of GRUB and exit.
|
|||
Print some verbose messages for debugging purpose.
|
||||
|
||||
@item --device-map=@var{file}
|
||||
Read the device map file instead of @file{/boot/grub/device.map}. The
|
||||
format is described in @ref{Device map}.
|
||||
Use the device map file @var{file}. The format is described in
|
||||
@ref{Device map}.
|
||||
|
||||
@item --no-floppy
|
||||
Do not probe any floppy drive. This option has no effect if there is the
|
||||
device map file (@pxref{Device map}).
|
||||
Do not probe any floppy drive. This option has no effect if the option
|
||||
@option{--device-map} is specified (@pxref{Device map}).
|
||||
|
||||
@item --probe-second-floppy
|
||||
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
|
||||
is the device map file (@pxref{Device map}), the grub shell just ignores
|
||||
this option.
|
||||
shell does not probe it, as that sometimes takes a long time. If you
|
||||
specify the device map file (@pxref{Device map}), the grub shell just
|
||||
ignores this option.
|
||||
|
||||
@item --config-file=@var{file}
|
||||
Read the configuration file @var{file} instead of
|
||||
|
@ -1318,10 +1318,9 @@ EOT
|
|||
@node Device map
|
||||
@section The map between BIOS drives and OS devices
|
||||
|
||||
The grub shell creates the @dfn{device map file} automatically unless it
|
||||
already exists. The default location is
|
||||
@file{/boot/grub/device.map}. @xref{Basic usage}, if you want to change
|
||||
the filename.
|
||||
When you specify the option @option{--device-map} (@pxref{Basic usage}),
|
||||
the grub shell creates the @dfn{device map file} automatically unless it
|
||||
already exists. The filename @file{/boot/grub/device.map} is preferred.
|
||||
|
||||
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:
|
||||
|
|
162
grub/asmstub.c
162
grub/asmstub.c
|
@ -223,7 +223,7 @@ init_device_map (void)
|
|||
{
|
||||
int i;
|
||||
int num_hd = 0;
|
||||
FILE *fp;
|
||||
FILE *fp = 0;
|
||||
|
||||
static void print_error (int no, const char *msg)
|
||||
{
|
||||
|
@ -240,96 +240,100 @@ init_device_map (void)
|
|||
for (i = 0; i < NUM_DISKS; i++)
|
||||
device_map[i] = 0;
|
||||
|
||||
/* Open the device map file. */
|
||||
fp = fopen (device_map_file, "r");
|
||||
if (fp)
|
||||
if (device_map_file)
|
||||
{
|
||||
/* If there is the device map file, use the data in it instead of
|
||||
probing devices. */
|
||||
char buf[1024]; /* XXX */
|
||||
int line_number = 0;
|
||||
|
||||
while (fgets (buf, sizeof (buf), fp))
|
||||
/* Open the device map file. */
|
||||
fp = fopen (device_map_file, "r");
|
||||
if (fp)
|
||||
{
|
||||
char *ptr, *eptr;
|
||||
int drive;
|
||||
int is_floppy = 0;
|
||||
/* If there is the device map file, use the data in it instead of
|
||||
probing devices. */
|
||||
char buf[1024]; /* XXX */
|
||||
int line_number = 0;
|
||||
|
||||
/* Increase the number of lines. */
|
||||
line_number++;
|
||||
|
||||
/* If the first character is '#', skip it. */
|
||||
if (buf[0] == '#')
|
||||
continue;
|
||||
|
||||
ptr = buf;
|
||||
/* Skip leading spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (*ptr != '(')
|
||||
while (fgets (buf, sizeof (buf), fp))
|
||||
{
|
||||
print_error (line_number, "No open parenthesis found");
|
||||
stop ();
|
||||
char *ptr, *eptr;
|
||||
int drive;
|
||||
int is_floppy = 0;
|
||||
|
||||
/* Increase the number of lines. */
|
||||
line_number++;
|
||||
|
||||
/* If the first character is '#', skip it. */
|
||||
if (buf[0] == '#')
|
||||
continue;
|
||||
|
||||
ptr = buf;
|
||||
/* Skip leading spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (*ptr != '(')
|
||||
{
|
||||
print_error (line_number, "No open parenthesis found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
ptr++;
|
||||
if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd')
|
||||
{
|
||||
print_error (line_number, "Bad drive name");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (*ptr == 'f')
|
||||
is_floppy = 1;
|
||||
|
||||
ptr += 2;
|
||||
drive = strtoul (ptr, &ptr, 10);
|
||||
if (drive < 0 || drive > 8)
|
||||
{
|
||||
print_error (line_number, "Bad device number");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (! is_floppy)
|
||||
drive += 0x80;
|
||||
|
||||
if (*ptr != ')')
|
||||
{
|
||||
print_error (line_number, "No close parenthesis found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
ptr++;
|
||||
/* Skip spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (! *ptr)
|
||||
{
|
||||
print_error (line_number, "No filename found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
/* Terminate the filename. */
|
||||
eptr = ptr;
|
||||
while (*eptr && ! isspace (*eptr))
|
||||
eptr++;
|
||||
*eptr = 0;
|
||||
|
||||
assign_device_name (drive, ptr);
|
||||
}
|
||||
|
||||
ptr++;
|
||||
if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd')
|
||||
{
|
||||
print_error (line_number, "Bad drive name");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (*ptr == 'f')
|
||||
is_floppy = 1;
|
||||
|
||||
ptr += 2;
|
||||
drive = strtoul (ptr, &ptr, 10);
|
||||
if (drive < 0 || drive > 8)
|
||||
{
|
||||
print_error (line_number, "Bad device number");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (! is_floppy)
|
||||
drive += 0x80;
|
||||
|
||||
if (*ptr != ')')
|
||||
{
|
||||
print_error (line_number, "No close parenthesis found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
ptr++;
|
||||
/* Skip spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (! *ptr)
|
||||
{
|
||||
print_error (line_number, "No filename found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
/* Terminate the filename. */
|
||||
eptr = ptr;
|
||||
while (*eptr && ! isspace (*eptr))
|
||||
eptr++;
|
||||
*eptr = 0;
|
||||
|
||||
assign_device_name (drive, ptr);
|
||||
fclose (fp);
|
||||
return;
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print something as the user does not think GRUB has been crashed. */
|
||||
fprintf (stderr,
|
||||
"Probe devices to guess BIOS drives. This may take a long time.\n");
|
||||
|
||||
/* Try to open the device map file to write the probed data. */
|
||||
fp = fopen (device_map_file, "w");
|
||||
if (device_map_file)
|
||||
/* Try to open the device map file to write the probed data. */
|
||||
fp = fopen (device_map_file, "w");
|
||||
|
||||
/* Floppies. */
|
||||
if (! no_floppy)
|
||||
|
|
|
@ -38,11 +38,10 @@ int verbose = 0;
|
|||
int read_only = 0;
|
||||
int no_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_install_partition;
|
||||
static char *default_config_file;
|
||||
static char *default_device_map_file;
|
||||
|
||||
#define OPT_HELP -2
|
||||
#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\
|
||||
--boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\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\
|
||||
--hold wait until a debugger will attach\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\
|
||||
",
|
||||
default_boot_drive, default_config_file,
|
||||
default_device_map_file, default_install_partition);
|
||||
default_install_partition);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
@ -133,7 +132,6 @@ main (int argc, char **argv)
|
|||
default_config_file = config_file;
|
||||
else
|
||||
default_config_file = "NONE";
|
||||
default_device_map_file = device_map_file;
|
||||
|
||||
/* Parse command-line options. */
|
||||
do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue