diff --git a/ChangeLog b/ChangeLog index 2855033da..950baec90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-01-08 OKUJI Yoshinori + + * 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 . + 2001-01-07 OKUJI Yoshinori * stage2/builtins.c (boot_func): In the chain-loading mode, diff --git a/NEWS b/NEWS index 78c8160b5..fe0ac5110 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ New in 1.0 - XXXX-XX-XX: cannot open a real configuration file, with this option. The argument must be an existing file. * EZ-BIOS support is added. +* Booting Windows from a logical partition is supported. New in 0.5.96 - 2000-10-04: * New commands, "reboot" and "halt". diff --git a/docs/mbchk.1 b/docs/mbchk.1 index c5fa68562..2399e64d6 100644 --- a/docs/mbchk.1 +++ b/docs/mbchk.1 @@ -1,5 +1,5 @@ .\" 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 mbchk \- check the format of a Multiboot kernel .SH SYNOPSIS diff --git a/stage2/builtins.c b/stage2/builtins.c index 3506f8cec..4d9559fd1 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -447,6 +447,18 @@ chainloader_func (char *arg, int flags) grub_close (); 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; } diff --git a/stage2/shared.h b/stage2/shared.h index ca659c620..46fceb457 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -171,14 +171,15 @@ extern char *grub_scratch_mem; #define SECTOR_BITS 9 #define BIOS_FLAG_FIXED_DISK 0x80 -#define BOOTSEC_LOCATION RAW_ADDR (0x7C00) -#define BOOTSEC_SIGNATURE 0xAA55 -#define BOOTSEC_BPB_OFFSET 0x3 -#define BOOTSEC_BPB_LENGTH 0x3B -#define BOOTSEC_PART_OFFSET 0x1BE -#define BOOTSEC_PART_LENGTH 0x40 -#define BOOTSEC_SIG_OFFSET 0x1FE -#define BOOTSEC_LISTSIZE 8 +#define BOOTSEC_LOCATION RAW_ADDR (0x7C00) +#define BOOTSEC_SIGNATURE 0xAA55 +#define BOOTSEC_BPB_OFFSET 0x3 +#define BOOTSEC_BPB_LENGTH 0x3B +#define BOOTSEC_BPB_HIDDEN_SECTORS 0x1C +#define BOOTSEC_PART_OFFSET 0x1BE +#define BOOTSEC_PART_LENGTH 0x40 +#define BOOTSEC_SIG_OFFSET 0x1FE +#define BOOTSEC_LISTSIZE 8 /* Not bad, perhaps. */ #define NETWORK_DRIVE 0x20