do not embed the drive where a Stage 2 resides when using a Stage 1.5 if possible.

This commit is contained in:
okuji 1999-11-13 09:39:43 +00:00
parent 9f88649c8c
commit a40c3176c2
3 changed files with 30 additions and 11 deletions

View file

@ -1,3 +1,13 @@
1999-11-13 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* stage2/builtins.c (install_func): When using a Stage 1.5, set
CURRENT_DRIVE to SAVED_DRIVE and CURRENT_PARTITION to
SAVED_PARTITION if set_device fails. If CURRENT_DRIVE is equal
to SRC_DRIVE, then set CURRENT_DRIVE to 0xFF. We don't want to
embed any drive number whenever possible.
* stage2/disk_io.c (set_device) [STAGE1_5]: Always set
CURRENT_PARTITION to PARTITION.
1999-11-13 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
From Pavel Roskin:

View file

@ -1370,12 +1370,23 @@ install_func (char *arg, int flags)
syntax. */
if (! (config_file = set_device (ptr)))
{
errnum = 0;
current_drive = 0xFF;
/* The Stage 2 PTR does not contain the device name, so
use the root device instead. */
errnum = ERR_NONE;
current_drive = saved_drive;
current_partition = saved_partition;
config_file = ptr;
}
if (current_drive == src_drive)
{
/* If the drive where the Stage 2 resides is the same as
the one where the Stage 1.5 resides, do not embed the
drive number. */
current_drive = 0xFF;
}
device = current_drive << 24 | current_partition;
device = (current_drive << 24) | current_partition;
grub_memmove (config_file_location, (char *) &device,
sizeof (device));
grub_strcpy (config_file_location + sizeof (device), config_file);

View file

@ -686,16 +686,14 @@ set_device (char *device)
int drive = (dev >> 24) & 0xFF;
int partition = dev & 0xFFFFFF;
/* If DRIVE is disabled (0xFF), use SAVED_DRIVE instead. */
if (drive == 0xFF)
{
current_drive = saved_drive;
current_partition = saved_partition;
}
current_drive = saved_drive;
else
{
current_drive = drive;
current_partition = partition;
}
current_drive = drive;
/* The `partition' part must always have a valid number. */
current_partition = partition;
return device + sizeof (unsigned long);