mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 09:39:22 +00:00
2002-07-06 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/shared.h (boot_part_offset): Removed. * stage2/disk_io.c (set_bootdev): Copy the partition information here. Now this function can call rawread, so it can fail. (boot_part_offset): Removed. * stage2/builtins.c (boot_func): Don't copy the partition information here. (real_root_func): Check ERRNUM after calling set_bootdev.
This commit is contained in:
1 parent
1548282786
commit
80d0f93b30
4 files changed
+45
-43
No files matched your search
+7
-38
@@ -288,43 +288,6 @@ boot_func (char *arg, int flags)
|
||||
|
||||
gateA20 (0);
|
||||
boot_drive = saved_drive;
|
||||
|
||||
/* Copy the boot partition information to 0x7be-0x7fd, if
|
||||
BOOT_DRIVE is a hard disk drive and the address of the boot
|
||||
partition entry is set. */
|
||||
if ((boot_drive & 0x80) && boot_part_addr)
|
||||
{
|
||||
char *dst, *src;
|
||||
int i;
|
||||
|
||||
if (debug)
|
||||
grub_printf ("reading the offset 0x%x in the drive 0x%x\n",
|
||||
boot_drive, boot_part_offset);
|
||||
|
||||
/* Read the MBR here, because it might be modified
|
||||
after opening the partition. */
|
||||
if (! rawread (boot_drive, boot_part_offset,
|
||||
0, SECTOR_SIZE, (char *) SCRATCHADDR))
|
||||
{
|
||||
/* This should never happen. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Need only the partition table.
|
||||
XXX: We cannot use grub_memmove because BOOT_PART_TABLE
|
||||
(0x07be) is less than 0x1000. */
|
||||
dst = (char *) BOOT_PART_TABLE;
|
||||
src = (char *) SCRATCHADDR + BOOTSEC_PART_OFFSET;
|
||||
while (dst < (char *) BOOT_PART_TABLE + BOOTSEC_PART_LENGTH)
|
||||
*dst++ = *src++;
|
||||
|
||||
/* Set the active flag of the booted partition. */
|
||||
for (i = 0; i < 4; i++)
|
||||
PC_SLICE_FLAG (BOOT_PART_TABLE, i) = 0;
|
||||
|
||||
*((unsigned char *) boot_part_addr) = PC_SLICE_FLAG_BOOTABLE;
|
||||
}
|
||||
|
||||
chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr);
|
||||
break;
|
||||
|
||||
@@ -3133,7 +3096,11 @@ real_root_func (char *arg, int attempt_mount)
|
||||
/* This is necessary, because the location of a partition table
|
||||
must be set appropriately. */
|
||||
if (open_partition ())
|
||||
{
|
||||
set_bootdev (0);
|
||||
if (errnum)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear ERRNUM. */
|
||||
@@ -3148,7 +3115,9 @@ real_root_func (char *arg, int attempt_mount)
|
||||
safe_parse_maxint (&biasptr, &hdbias);
|
||||
errnum = 0;
|
||||
bootdev = set_bootdev (hdbias);
|
||||
|
||||
if (errnum)
|
||||
return 1;
|
||||
|
||||
/* Print the type of the filesystem. */
|
||||
print_fsys_type ();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user