288 |
|
|
289 |
gateA20 (0); |
gateA20 (0); |
290 |
boot_drive = saved_drive; |
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; |
|
|
} |
|
|
|
|
291 |
chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); |
chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); |
292 |
break; |
break; |
293 |
|
|
3096 |
/* This is necessary, because the location of a partition table |
/* This is necessary, because the location of a partition table |
3097 |
must be set appropriately. */ |
must be set appropriately. */ |
3098 |
if (open_partition ()) |
if (open_partition ()) |
3099 |
|
{ |
3100 |
set_bootdev (0); |
set_bootdev (0); |
3101 |
|
if (errnum) |
3102 |
|
return 1; |
3103 |
|
} |
3104 |
} |
} |
3105 |
|
|
3106 |
/* Clear ERRNUM. */ |
/* Clear ERRNUM. */ |
3115 |
safe_parse_maxint (&biasptr, &hdbias); |
safe_parse_maxint (&biasptr, &hdbias); |
3116 |
errnum = 0; |
errnum = 0; |
3117 |
bootdev = set_bootdev (hdbias); |
bootdev = set_bootdev (hdbias); |
3118 |
|
if (errnum) |
3119 |
|
return 1; |
3120 |
|
|
3121 |
/* Print the type of the filesystem. */ |
/* Print the type of the filesystem. */ |
3122 |
print_fsys_type (); |
print_fsys_type (); |
3123 |
} |
} |