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:
okuji 2008-02-03 18:56:08 +00:00
parent e0ca067708
commit 9be6b98b6f
9 changed files with 78 additions and 15 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2002,2005,2006,2007 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2002,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
@ -34,6 +34,9 @@
/* The offset of BOOT_DRIVE. */
#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x4c
/* The offset of ROOT_DRIVE. */
#define GRUB_BOOT_MACHINE_ROOT_DRIVE 0x4d
/* The offset of KERNEL_ADDRESS. */
#define GRUB_BOOT_MACHINE_KERNEL_ADDRESS 0x40
@ -44,7 +47,7 @@
#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT 0x42
/* The offset of BOOT_DRIVE_CHECK. */
#define GRUB_BOOT_MACHINE_DRIVE_CHECK 0x4e
#define GRUB_BOOT_MACHINE_DRIVE_CHECK 0x4f
/* The offset of a magic number used by Windows NT. */
#define GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,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
@ -73,6 +73,9 @@ extern char grub_prefix[];
/* The boot BIOS drive number. */
extern grub_int32_t grub_boot_drive;
/* The root BIOS drive number. */
extern grub_int32_t grub_root_drive;
/* The end address of the kernel. */
extern grub_addr_t grub_end_addr;