Defer multiboot device parsing until we're in compressed part.
* grub-core/boot/i386/pc/lnxboot.S: Remove setting dos_part and bsd_part. setdevice has fallen into disuse. * grub-core/boot/i386/pc/startup_raw.S (dos_part): Removed. (bsd_part): Likewise. (boot_dev): New variable. (multiboot_trampoline): Don't parse multiboot device. Pass multiboot device in %edx. * grub-core/disk/i386/pc/biosdisk.c (GRUB_MOD_INIT): Parse grub_boot_device. * grub-core/kern/i386/pc/init.c (grub_machine_get_bootlocation): Likewise. * grub-core/kern/i386/pc/startup.S: Save edx. (grub_boot_drive): Removed. (grub_install_dos_part): Likewise. (grub_install_bsd_part): Likewise. (grub_boot_device): New variable. * include/grub/i386/pc/kernel.h (grub_install_dos_part): Removed. (grub_install_bsd_part): Likewise. (grub_boot_drive): Likewise. (grub_boot_device): New variable. * include/grub/offsets.h (GRUB_KERNEL_I386_PC_INSTALL_DOS_PART): Removed. (GRUB_KERNEL_I386_PC_INSTALL_BSD_PART): Likewise. (GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY): Moved lower. (GRUB_KERNEL_MACHINE_INSTALL_BSD_PART): Removed. (GRUB_KERNEL_MACHINE_INSTALL_DOS_PART): Likewise. * util/grub-install.in: Remove redundant condition.
This commit is contained in:
parent
691cbb5816
commit
5fbdac149b
11 changed files with 63 additions and 171 deletions
|
@ -564,7 +564,7 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
|||
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
||||
config_opt="-c ${grubdir}/load.cfg "
|
||||
modules="$modules search_fs_uuid"
|
||||
elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ] || [ "x$platform" = xieee1275 ]; then
|
||||
else
|
||||
# we need to hardcode the partition number in the core image's prefix.
|
||||
if [ x"$grub_partition" = x ]; then
|
||||
prefix_drive="()"
|
||||
|
|
|
@ -84,7 +84,6 @@ struct image_target_desc
|
|||
grub_uint16_t elf_target;
|
||||
unsigned section_align;
|
||||
signed vaddr_offset;
|
||||
unsigned install_dos_part, install_bsd_part;
|
||||
grub_uint64_t link_addr;
|
||||
unsigned mod_gap, mod_align;
|
||||
grub_compression_t default_compression;
|
||||
|
@ -113,8 +112,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
||||
.elf_target = EM_386,
|
||||
.link_align = 4,
|
||||
|
@ -134,8 +131,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
||||
.elf_target = EM_386,
|
||||
.link_align = 4,
|
||||
|
@ -155,8 +150,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = GRUB_KERNEL_I386_PC_INSTALL_DOS_PART,
|
||||
.install_bsd_part = GRUB_KERNEL_I386_PC_INSTALL_BSD_PART,
|
||||
.link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
|
||||
},
|
||||
{
|
||||
|
@ -172,8 +165,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = GRUB_KERNEL_I386_PC_INSTALL_DOS_PART,
|
||||
.install_bsd_part = GRUB_KERNEL_I386_PC_INSTALL_BSD_PART,
|
||||
.link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
|
||||
},
|
||||
{
|
||||
|
@ -194,8 +185,6 @@ struct image_target_desc image_targets[] =
|
|||
+ sizeof (struct grub_pe32_optional_header)
|
||||
+ 4 * sizeof (struct grub_pe32_section_table),
|
||||
GRUB_PE32_SECTION_ALIGNMENT),
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.pe_target = GRUB_PE32_MACHINE_I386,
|
||||
.elf_target = EM_386,
|
||||
},
|
||||
|
@ -212,8 +201,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_I386_IEEE1275_LINK_ADDR,
|
||||
.elf_target = EM_386,
|
||||
.mod_gap = GRUB_KERNEL_I386_IEEE1275_MOD_GAP,
|
||||
|
@ -233,8 +220,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_I386_QEMU_LINK_ADDR
|
||||
},
|
||||
{
|
||||
|
@ -250,8 +235,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
|
||||
.vaddr_offset = EFI64_HEADER_SIZE,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.pe_target = GRUB_PE32_MACHINE_X86_64,
|
||||
.elf_target = EM_X86_64,
|
||||
},
|
||||
|
@ -268,8 +251,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
||||
|
@ -288,8 +269,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
||||
|
@ -310,8 +289,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
||||
|
@ -330,8 +307,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR,
|
||||
.elf_target = EM_PPC,
|
||||
.mod_gap = GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP,
|
||||
|
@ -351,8 +326,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
||||
},
|
||||
{
|
||||
|
@ -368,8 +341,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
||||
},
|
||||
{
|
||||
|
@ -385,8 +356,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
|
||||
.vaddr_offset = EFI64_HEADER_SIZE,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.pe_target = GRUB_PE32_MACHINE_IA64,
|
||||
.elf_target = EM_IA_64,
|
||||
},
|
||||
|
@ -404,8 +373,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_ARC_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
|
||||
|
@ -424,8 +391,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
||||
|
@ -444,8 +409,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
||||
|
@ -464,8 +427,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
||||
|
@ -484,8 +445,6 @@ struct image_target_desc image_targets[] =
|
|||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
||||
|
@ -990,17 +949,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
core_size = full_size;
|
||||
}
|
||||
|
||||
/* If we included a drive in our prefix, let GRUB know it doesn't have to
|
||||
prepend the drive told by BIOS. */
|
||||
if (image_target->install_dos_part != TARGET_NO_FIELD
|
||||
&& image_target->install_bsd_part != TARGET_NO_FIELD && prefix[0] == '(')
|
||||
{
|
||||
*((grub_int32_t *) (core_img + image_target->install_dos_part))
|
||||
= grub_host_to_target32 (-2);
|
||||
*((grub_int32_t *) (core_img + image_target->install_bsd_part))
|
||||
= grub_host_to_target32 (-2);
|
||||
}
|
||||
|
||||
switch (image_target->id)
|
||||
{
|
||||
case IMAGE_I386_PC:
|
||||
|
|
|
@ -101,56 +101,12 @@ write_rootdev (char *core_img, grub_device_t root_dev,
|
|||
{
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
{
|
||||
grub_int32_t *install_dos_part, *install_bsd_part;
|
||||
grub_int32_t dos_part, bsd_part;
|
||||
grub_uint8_t *boot_drive;
|
||||
grub_disk_addr_t *kernel_sector;
|
||||
boot_drive = (grub_uint8_t *) (boot_img + GRUB_BOOT_MACHINE_BOOT_DRIVE);
|
||||
kernel_sector = (grub_disk_addr_t *) (boot_img
|
||||
+ GRUB_BOOT_MACHINE_KERNEL_SECTOR);
|
||||
|
||||
|
||||
install_dos_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
|
||||
+ GRUB_KERNEL_MACHINE_INSTALL_DOS_PART);
|
||||
install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
|
||||
+ GRUB_KERNEL_MACHINE_INSTALL_BSD_PART);
|
||||
|
||||
/* If we hardcoded drive as part of prefix, we don't want to
|
||||
override the current setting. */
|
||||
if (*install_dos_part != -2)
|
||||
{
|
||||
/* Embed information about the installed location. */
|
||||
if (root_dev->disk->partition)
|
||||
{
|
||||
if (root_dev->disk->partition->parent)
|
||||
{
|
||||
if (root_dev->disk->partition->parent->parent)
|
||||
grub_util_error (_("Installing on doubly nested partitions "
|
||||
"is not supported"));
|
||||
dos_part = root_dev->disk->partition->parent->number;
|
||||
bsd_part = root_dev->disk->partition->number;
|
||||
}
|
||||
else
|
||||
{
|
||||
dos_part = root_dev->disk->partition->number;
|
||||
bsd_part = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
dos_part = bsd_part = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dos_part = grub_le_to_cpu32 (*install_dos_part);
|
||||
bsd_part = grub_le_to_cpu32 (*install_bsd_part);
|
||||
}
|
||||
|
||||
grub_util_info ("dos partition is %d, bsd partition is %d",
|
||||
dos_part, bsd_part);
|
||||
|
||||
*install_dos_part = grub_cpu_to_le32 (dos_part);
|
||||
*install_bsd_part = grub_cpu_to_le32 (bsd_part);
|
||||
|
||||
/* FIXME: can this be skipped? */
|
||||
*boot_drive = 0xFF;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue