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:
parent
1548282786
commit
80d0f93b30
4 changed files with 45 additions and 43 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
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.
|
||||
|
||||
2002-07-04 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* docs/grub.texi (Reporting bugs): Use the group name (i.e.
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@ unsigned long current_partition;
|
|||
/* The register ESI should contain the address of the partition to be
|
||||
used for loading a chain-loader when chain-loading the loader. */
|
||||
unsigned long boot_part_addr = 0;
|
||||
unsigned long boot_part_offset;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1072,9 +1071,32 @@ set_bootdev (int hdbias)
|
|||
{
|
||||
int i, j;
|
||||
|
||||
/* Save the boot partition for chain-loading. */
|
||||
boot_part_offset = cur_part_offset;
|
||||
boot_part_addr = cur_part_addr;
|
||||
/* Copy the boot partition information to 0x7be-0x7fd for chain-loading. */
|
||||
if ((saved_drive & 0x80) && cur_part_addr)
|
||||
{
|
||||
if (rawread (saved_drive, cur_part_offset,
|
||||
0, SECTOR_SIZE, (char *) SCRATCHADDR))
|
||||
{
|
||||
char *dst, *src;
|
||||
|
||||
/* 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 *) cur_part_addr) = PC_SLICE_FLAG_BOOTABLE;
|
||||
boot_part_addr = cur_part_addr;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set BSD boot device.
|
||||
|
|
|
@ -545,7 +545,6 @@ extern unsigned long boot_drive;
|
|||
extern unsigned long install_second_sector;
|
||||
extern struct apm_info apm_bios_info;
|
||||
extern unsigned long boot_part_addr;
|
||||
extern unsigned long boot_part_offset;
|
||||
extern int saved_entryno;
|
||||
extern unsigned char force_lba;
|
||||
extern char version_string[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue