diff --git a/ChangeLog b/ChangeLog index ae19e0e56..b2ffa69fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +1999-11-13 OKUJI Yoshinori + + * 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 From Pavel Roskin: diff --git a/stage2/builtins.c b/stage2/builtins.c index 59f30a133..f30c51f30 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -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); diff --git a/stage2/disk_io.c b/stage2/disk_io.c index 2dbd73a9d..4aeb5d501 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -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);