2008-02-03 Yoshinori K. Okuji <okuji@enbug.org>
Add support for having a grub directory in a different drive. This is still only the data handling part. * kern/i386/pc/startup.S (multiboot_trampoline): Set %dh to 0xFF. (codestart): Save %dh in GRUB_ROOT_DRIVE. (grub_root_drive): New variable. * kern/i386/pc/init.c (make_install_device): Use GRUB_ROOT_DRIVE instead of GRUB_BOOT_DRIVE to construct a device name. Set GRUB_ROOT_DRIVE to GRUB_BOOT_DRIVE if it is 0xFF, otherwise use it as it was. * include/grub/i386/pc/kernel.h (grub_root_drive): New prototype. * include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_ROOT_DRIVE): New macro. (GRUB_BOOT_MACHINE_DRIVE_CHECK): Set to 0x4f. * boot/i386/pc/pxeboot.S (_start): Set %dh to 0xFF. For now, this is bogus, because PXE booting does not specify any drive correctly. * boot/i386/pc/lnxboot.S (reg_edx): Set the second byte to 0xFF. I am not sure if this is really correct. * boot/i386/pc/cdboot.S: Set %dh to 0xFF, because the root drive is always identical to the boot drive when booting from a CD. * boot/i386/pc/boot.S (MOV_MEM_TO_AL): Removed. Not needed any longer. (root_drive): New variable. (real_start): Unconditionally set %dh to ROOT_DRIVE. (setup_sectors): Push %dx right after popping it, because %dh will be modified later. (copy_buffer): Restore %dx.
This commit is contained in:
parent
e0ca067708
commit
9be6b98b6f
9 changed files with 78 additions and 15 deletions
|
@ -72,13 +72,18 @@ make_install_device (void)
|
|||
}
|
||||
else if (grub_install_dos_part != -2)
|
||||
{
|
||||
if (grub_boot_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
|
||||
/* If the root drive is not set explicitly, assume that it is identical
|
||||
to the boot drive. */
|
||||
if (grub_root_drive == 0xFF)
|
||||
grub_root_drive = grub_boot_drive;
|
||||
|
||||
if (grub_root_drive >= GRUB_BIOSDISK_MACHINE_CDROM_START)
|
||||
grub_sprintf (dev, "(cd%u",
|
||||
grub_boot_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
|
||||
grub_root_drive - GRUB_BIOSDISK_MACHINE_CDROM_START);
|
||||
else
|
||||
grub_sprintf (dev, "(%cd%u",
|
||||
(grub_boot_drive & 0x80) ? 'h' : 'f',
|
||||
grub_boot_drive & 0x7f);
|
||||
(grub_root_drive & 0x80) ? 'h' : 'f',
|
||||
grub_root_drive & 0x7f);
|
||||
|
||||
if (grub_install_dos_part >= 0)
|
||||
grub_sprintf (dev + grub_strlen (dev), ",%u", grub_install_dos_part + 1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -162,6 +162,7 @@ multiboot_trampoline:
|
|||
movl %ebx, EXT_C(grub_install_bsd_part)
|
||||
2:
|
||||
shrl $24, %edx
|
||||
movb $0xFF, %dh
|
||||
/* enter the usual booting */
|
||||
call prot_to_real
|
||||
.code16
|
||||
|
@ -182,8 +183,9 @@ codestart:
|
|||
|
||||
sti /* we're safe again */
|
||||
|
||||
/* save boot drive reference */
|
||||
/* save boot and root drive references */
|
||||
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
||||
ADDR32 movb %dh, EXT_C(grub_root_drive)
|
||||
|
||||
/* reset disk system (%ah = 0) */
|
||||
int $0x13
|
||||
|
@ -255,6 +257,9 @@ codestart:
|
|||
VARIABLE(grub_boot_drive)
|
||||
.long 0
|
||||
|
||||
VARIABLE(grub_root_drive)
|
||||
.long 0
|
||||
|
||||
VARIABLE(grub_start_addr)
|
||||
.long START_SYMBOL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue