mirror of
https://git.proxmox.com/git/grub2
synced 2025-05-20 03:02:50 +00:00

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.
82 lines
2.6 KiB
C
82 lines
2.6 KiB
C
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* 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
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* GRUB is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef GRUB_BOOT_MACHINE_HEADER
|
|
#define GRUB_BOOT_MACHINE_HEADER 1
|
|
|
|
/* The signature for bootloader. */
|
|
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
|
|
|
|
/* The offset of the start of BPB (BIOS Parameter Block). */
|
|
#define GRUB_BOOT_MACHINE_BPB_START 0x3
|
|
|
|
/* The offset of the end of BPB (BIOS Parameter Block). */
|
|
#define GRUB_BOOT_MACHINE_BPB_END 0x3e
|
|
|
|
/* The offset of the major version. */
|
|
#define GRUB_BOOT_MACHINE_VER_MAJ 0x3e
|
|
|
|
/* 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
|
|
|
|
/* The offset of KERNEL_SECTOR. */
|
|
#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x44
|
|
|
|
/* The offset of KERNEL_SEGMENT. */
|
|
#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT 0x42
|
|
|
|
/* The offset of BOOT_DRIVE_CHECK. */
|
|
#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
|
|
|
|
/* The offset of the start of the partition table. */
|
|
#define GRUB_BOOT_MACHINE_PART_START 0x1be
|
|
|
|
/* The offset of the end of the partition table. */
|
|
#define GRUB_BOOT_MACHINE_PART_END 0x1fe
|
|
|
|
/* The stack segment. */
|
|
#define GRUB_BOOT_MACHINE_STACK_SEG 0x2000
|
|
|
|
/* The segment of disk buffer. The disk buffer MUST be 32K long and
|
|
cannot straddle a 64K boundary. */
|
|
#define GRUB_BOOT_MACHINE_BUFFER_SEG 0x7000
|
|
|
|
/* The flag for BIOS drive number to designate a hard disk vs. a
|
|
floppy. */
|
|
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
|
|
|
|
/* The segment where the kernel is loaded. */
|
|
#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800
|
|
|
|
/* The address where the kernel is loaded. */
|
|
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
|
|
|
|
/* The size of a block list used in the kernel startup code. */
|
|
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
|
|
|
#endif /* ! BOOT_MACHINE_HEADER */
|