add a workaround to boot Windows from a logical partition.

This commit is contained in:
okuji 2001-01-10 20:48:50 +00:00
parent 3c8e99279f
commit ca6efbe093
5 changed files with 34 additions and 9 deletions

View file

@ -1,3 +1,14 @@
2001-01-08 OKUJI Yoshinori <okuji@gnu.org>
* stage2/shared.h (BOOTSEC_BPB_HIDDEN_SECTORS): New macro.
* stage2/builtins.c (chainloader_func): If CURRENT_PARTITION is
FAT, set the hidden sectors field of the BPB to PART_START, to
avoid a Windows bug which affects only when Windows is booted
from a logical partition. And, clear ERRNUM after testing if a
partition is FAT, because open_partition or fat_mount may set
ERRNUM. Reported by Ingo Korb <ingo@akana.de>.
2001-01-07 OKUJI Yoshinori <okuji@gnu.org> 2001-01-07 OKUJI Yoshinori <okuji@gnu.org>
* stage2/builtins.c (boot_func): In the chain-loading mode, * stage2/builtins.c (boot_func): In the chain-loading mode,

1
NEWS
View file

@ -20,6 +20,7 @@ New in 1.0 - XXXX-XX-XX:
cannot open a real configuration file, with this option. The argument cannot open a real configuration file, with this option. The argument
must be an existing file. must be an existing file.
* EZ-BIOS support is added. * EZ-BIOS support is added.
* Booting Windows from a logical partition is supported.
New in 0.5.96 - 2000-10-04: New in 0.5.96 - 2000-10-04:
* New commands, "reboot" and "halt". * New commands, "reboot" and "halt".

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH MBCHK "1" "December 2000" "mbchk (GNU GRUB 0.5.97)" FSF .TH MBCHK "1" "January 2001" "mbchk (GNU GRUB 0.5.97)" FSF
.SH NAME .SH NAME
mbchk \- check the format of a Multiboot kernel mbchk \- check the format of a Multiboot kernel
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -447,6 +447,18 @@ chainloader_func (char *arg, int flags)
grub_close (); grub_close ();
kernel_type = KERNEL_TYPE_CHAINLOADER; kernel_type = KERNEL_TYPE_CHAINLOADER;
/* XXX: Windows evil hack. I don't know why, but Windows seems not to
set the start address of an extended partition in the BPB correctly.
So this is necessary to make Windows bootable even with an extended
partition. Maybe this should be made only for Windows, but how can
we determine if it is Windows or not precisely?! */
if (open_partition () && fat_mount ())
*((unsigned long *) (BOOTSEC_LOCATION + BOOTSEC_BPB_HIDDEN_SECTORS))
= part_start;
errnum = ERR_NONE;
return 0; return 0;
} }

View file

@ -171,14 +171,15 @@ extern char *grub_scratch_mem;
#define SECTOR_BITS 9 #define SECTOR_BITS 9
#define BIOS_FLAG_FIXED_DISK 0x80 #define BIOS_FLAG_FIXED_DISK 0x80
#define BOOTSEC_LOCATION RAW_ADDR (0x7C00) #define BOOTSEC_LOCATION RAW_ADDR (0x7C00)
#define BOOTSEC_SIGNATURE 0xAA55 #define BOOTSEC_SIGNATURE 0xAA55
#define BOOTSEC_BPB_OFFSET 0x3 #define BOOTSEC_BPB_OFFSET 0x3
#define BOOTSEC_BPB_LENGTH 0x3B #define BOOTSEC_BPB_LENGTH 0x3B
#define BOOTSEC_PART_OFFSET 0x1BE #define BOOTSEC_BPB_HIDDEN_SECTORS 0x1C
#define BOOTSEC_PART_LENGTH 0x40 #define BOOTSEC_PART_OFFSET 0x1BE
#define BOOTSEC_SIG_OFFSET 0x1FE #define BOOTSEC_PART_LENGTH 0x40
#define BOOTSEC_LISTSIZE 8 #define BOOTSEC_SIG_OFFSET 0x1FE
#define BOOTSEC_LISTSIZE 8
/* Not bad, perhaps. */ /* Not bad, perhaps. */
#define NETWORK_DRIVE 0x20 #define NETWORK_DRIVE 0x20