Bug#345931: A patch solving #345931
Robert Millan
rmh at aybabtu.com
Mon Sep 25 14:17:15 UTC 2006
On Mon, Sep 11, 2006 at 06:26:37PM +0200, Mats Erik Andersson wrote:
> Venerable Maintainers of Grub,
>
> I offer you a patch that should close bug report
> #345931.
>
> The patch has been built on top of grub-0.97-13 with
> success and it repaired with honours mbr-installs of
>
> grub-0.97-1ubuntu1 on kubuntu 6.0.6
> and
> grub-0.95+cvs20040624-17sarge1 on Debian
> Sarge.
Does your patch work with grub from debian sid?
Does GRUB 2 also exhibit this problem?
> As you will see the coding is independent of any
> Debian patches and contains a few lines of code for
> the source file
>
> grub-0.97/stage2/builtins.c
>
> and thus would easily integrate in the upstream
> version 0.97. I leave to you to decide whether the
> author ought to be informed, since I am still a
> novice in these matters.
>
> Best regards
>
> Mats Erik Andersson
> ynglingatal at yahoo.se
Content-Description: 526972506-drive_correction.diff
> diff -Naur grub-0.97.orig/stage2/builtins.c grub-0.97/stage2/builtins.c
> --- grub-0.97.orig/stage2/builtins.c 2006-09-11 16:08:32.261227280 +0200
> +++ grub-0.97/stage2/builtins.c 2006-09-11 16:15:54.035067448 +0200
> @@ -1953,13 +1953,30 @@
> *((unsigned char *) (stage1_buffer + STAGE1_FORCE_LBA)) = is_force_lba;
>
> /* If DEST_DRIVE is a hard disk, enable the workaround, which is
> - for buggy BIOSes which don't pass boot drive correctly. Instead,
> - they pass 0x00 or 0x01 even when booted from 0x80. */
> + * for buggy BIOSes which don't pass boot drive correctly. Instead,
> + * they pass 0x00 or 0x01 even when booted from 0x80. */
> if (dest_drive & BIOS_FLAG_FIXED_DISK)
> - /* Replace the jmp (2 bytes) with double nop's. */
> - *((unsigned short *) (stage1_buffer + STAGE1_BOOT_DRIVE_CHECK))
> - = 0x9090;
> -
> + {
> + if ( *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE_CHECK)) == 0xeb )
> + /* For version 0.97:
> + * Replace the jmp (2 bytes) with double nop's. */
> + *((unsigned short *) (stage1_buffer + STAGE1_BOOT_DRIVE_CHECK))
> + = 0x9090;
> + else if ( *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE_CHECK)) == 0x80 )
> + {
> + /* For versions 0.94-96:
> + * Set the boot drive mask. This is a workaround for buggy BIOSes which
> + * don't pass boot drive correctly. Instead, they pass 0x00 even when
> + * booted from 0x80.
> + * Rem: the old STAGE1_BOOT_DRIVE_MASK equals STAGE1_BOOT_DRIVE_CHECK + 2 */
> + *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE_CHECK + 2 ))
> + = (dest_drive & BIOS_FLAG_FIXED_DISK);
> + }
> + else
> + /* The boot sector is older than version 0.94.
> + * Changing to a "nop" could make 0.92 and 0.93 acceptable. */
> + goto fail;
> + }
> /* Read the first sector of Stage 2. */
> disk_read_hook = disk_read_savesect_func;
> if (grub_read (stage2_first_buffer, SECTOR_SIZE) != SECTOR_SIZE)
--
Robert Millan
My spam trap is honeypot at aybabtu.com. Note: this address is only intended for
spam harvesters. Writing to it will get you added to my black list.
More information about the Pkg-grub-devel
mailing list