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
32
ChangeLog
32
ChangeLog
|
@ -1,3 +1,35 @@
|
||||||
|
2011-11-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2011-11-12 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-11-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Fix bug introduced by previous commit.
|
Fix bug introduced by previous commit.
|
||||||
|
|
|
@ -205,11 +205,6 @@ real_code_2:
|
||||||
2:
|
2:
|
||||||
call LOCAL(move_memory)
|
call LOCAL(move_memory)
|
||||||
|
|
||||||
movsbl %dh, %eax
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
|
||||||
movsbl (reg_edx + 2 - start), %eax
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
|
||||||
|
|
||||||
movb $0xFF, %dh
|
movb $0xFF, %dh
|
||||||
|
|
||||||
ljmp $(DATA_ADDR >> 4), $0
|
ljmp $(DATA_ADDR >> 4), $0
|
||||||
|
|
|
@ -57,13 +57,6 @@ LOCAL(compressed_size):
|
||||||
LOCAL(uncompressed_size):
|
LOCAL(uncompressed_size):
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
. = _start + GRUB_KERNEL_I386_PC_INSTALL_DOS_PART
|
|
||||||
LOCAL(dos_part):
|
|
||||||
.long 0xFFFFFFFF
|
|
||||||
. = _start + GRUB_KERNEL_I386_PC_INSTALL_BSD_PART
|
|
||||||
LOCAL(bsd_part):
|
|
||||||
.long 0xFFFFFFFF
|
|
||||||
|
|
||||||
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
|
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
|
||||||
reed_solomon_redundancy:
|
reed_solomon_redundancy:
|
||||||
.long 0
|
.long 0
|
||||||
|
@ -72,8 +65,10 @@ reed_solomon_redundancy:
|
||||||
* This is the area for all of the special variables.
|
* This is the area for all of the special variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
LOCAL(boot_dev):
|
||||||
|
.byte 0xFF, 0xFF, 0xFF
|
||||||
LOCAL(boot_drive):
|
LOCAL(boot_drive):
|
||||||
.byte 0
|
.byte 0x00
|
||||||
|
|
||||||
/* the real mode code continues... */
|
/* the real mode code continues... */
|
||||||
LOCAL (codestart):
|
LOCAL (codestart):
|
||||||
|
@ -164,28 +159,12 @@ multiboot_entry:
|
||||||
|
|
||||||
multiboot_trampoline:
|
multiboot_trampoline:
|
||||||
/* fill the boot information */
|
/* fill the boot information */
|
||||||
movl %edx, %eax
|
movl %edx, LOCAL(boot_dev)
|
||||||
shrl $8, %eax
|
|
||||||
xorl %ebx, %ebx
|
|
||||||
cmpb $0xFF, %ah
|
|
||||||
je 1f
|
|
||||||
movb %ah, %bl
|
|
||||||
movl %ebx, LOCAL(dos_part)
|
|
||||||
1:
|
|
||||||
cmpb $0xFF, %al
|
|
||||||
je 2f
|
|
||||||
movb %al, %bl
|
|
||||||
movl %ebx, LOCAL(bsd_part)
|
|
||||||
2:
|
|
||||||
shrl $24, %edx
|
shrl $24, %edx
|
||||||
movb %dl, LOCAL(boot_drive)
|
|
||||||
movb $0xFF, %dh
|
|
||||||
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
|
|
||||||
/* enter the usual booting */
|
/* enter the usual booting */
|
||||||
call prot_to_real
|
call prot_to_real
|
||||||
.code16
|
.code16
|
||||||
jmp LOCAL (codestart)
|
jmp LOCAL (codestart)
|
||||||
|
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
post_reed_solomon:
|
post_reed_solomon:
|
||||||
|
@ -201,9 +180,7 @@ post_reed_solomon:
|
||||||
popl %esi
|
popl %esi
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
movb LOCAL(boot_drive), %dl
|
movl LOCAL(boot_dev), %edx
|
||||||
movl LOCAL(dos_part), %eax
|
|
||||||
movl LOCAL(bsd_part), %ebx
|
|
||||||
movl $prot_to_real, %edi
|
movl $prot_to_real, %edi
|
||||||
movl $real_to_prot, %ecx
|
movl $real_to_prot, %ecx
|
||||||
jmp *%esi
|
jmp *%esi
|
||||||
|
|
|
@ -622,7 +622,8 @@ grub_disk_biosdisk_fini (void)
|
||||||
GRUB_MOD_INIT(biosdisk)
|
GRUB_MOD_INIT(biosdisk)
|
||||||
{
|
{
|
||||||
struct grub_biosdisk_cdrp *cdrp
|
struct grub_biosdisk_cdrp *cdrp
|
||||||
= (struct grub_biosdisk_cdrp *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
= (struct grub_biosdisk_cdrp *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||||
|
grub_uint8_t boot_drive;
|
||||||
|
|
||||||
if (grub_disk_firmware_is_tainted)
|
if (grub_disk_firmware_is_tainted)
|
||||||
{
|
{
|
||||||
|
@ -634,15 +635,16 @@ GRUB_MOD_INIT(biosdisk)
|
||||||
grub_memset (cdrp, 0, sizeof (*cdrp));
|
grub_memset (cdrp, 0, sizeof (*cdrp));
|
||||||
cdrp->size = sizeof (*cdrp);
|
cdrp->size = sizeof (*cdrp);
|
||||||
cdrp->media_type = 0xFF;
|
cdrp->media_type = 0xFF;
|
||||||
if ((! grub_biosdisk_get_cdinfo_int13_extensions (grub_boot_drive, cdrp)) &&
|
boot_drive = (grub_boot_device >> 24);
|
||||||
((cdrp->media_type & GRUB_BIOSDISK_CDTYPE_MASK)
|
if ((! grub_biosdisk_get_cdinfo_int13_extensions (boot_drive, cdrp))
|
||||||
== GRUB_BIOSDISK_CDTYPE_NO_EMUL))
|
&& ((cdrp->media_type & GRUB_BIOSDISK_CDTYPE_MASK)
|
||||||
|
== GRUB_BIOSDISK_CDTYPE_NO_EMUL))
|
||||||
cd_drive = cdrp->drive_no;
|
cd_drive = cdrp->drive_no;
|
||||||
/* Since diskboot.S rejects devices over 0x90 it must be a CD booted with
|
/* Since diskboot.S rejects devices over 0x90 it must be a CD booted with
|
||||||
cdboot.S
|
cdboot.S
|
||||||
*/
|
*/
|
||||||
if (grub_boot_drive >= 0x90)
|
if (boot_drive >= 0x90)
|
||||||
cd_drive = grub_boot_drive;
|
cd_drive = boot_drive;
|
||||||
|
|
||||||
grub_disk_dev_register (&grub_biosdisk_dev);
|
grub_disk_dev_register (&grub_biosdisk_dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,15 @@ void
|
||||||
grub_machine_get_bootlocation (char **device, char **path)
|
grub_machine_get_bootlocation (char **device, char **path)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
grub_uint8_t boot_drive, dos_part, bsd_part;
|
||||||
|
|
||||||
|
boot_drive = (grub_boot_device >> 24);
|
||||||
|
dos_part = (grub_boot_device >> 16);
|
||||||
|
bsd_part = (grub_boot_device >> 8);
|
||||||
|
|
||||||
/* No hardcoded root partition - make it from the boot drive and the
|
/* No hardcoded root partition - make it from the boot drive and the
|
||||||
partition number encoded at the install time. */
|
partition number encoded at the install time. */
|
||||||
if (grub_boot_drive == GRUB_BOOT_MACHINE_PXE_DL)
|
if (boot_drive == GRUB_BOOT_MACHINE_PXE_DL)
|
||||||
{
|
{
|
||||||
if (grub_pc_net_config)
|
if (grub_pc_net_config)
|
||||||
grub_pc_net_config (device, path);
|
grub_pc_net_config (device, path);
|
||||||
|
@ -82,18 +87,18 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||||
*device = grub_malloc (DEV_SIZE);
|
*device = grub_malloc (DEV_SIZE);
|
||||||
ptr = *device;
|
ptr = *device;
|
||||||
grub_snprintf (*device, DEV_SIZE,
|
grub_snprintf (*device, DEV_SIZE,
|
||||||
"%cd%u", (grub_boot_drive & 0x80) ? 'h' : 'f',
|
"%cd%u", (boot_drive & 0x80) ? 'h' : 'f',
|
||||||
grub_boot_drive & 0x7f);
|
boot_drive & 0x7f);
|
||||||
ptr += grub_strlen (ptr);
|
ptr += grub_strlen (ptr);
|
||||||
|
|
||||||
if (grub_install_dos_part >= 0)
|
if (dos_part != 0xff)
|
||||||
grub_snprintf (ptr, DEV_SIZE - (ptr - *device),
|
grub_snprintf (ptr, DEV_SIZE - (ptr - *device),
|
||||||
",%u", grub_install_dos_part + 1);
|
",%u", dos_part + 1);
|
||||||
ptr += grub_strlen (ptr);
|
ptr += grub_strlen (ptr);
|
||||||
|
|
||||||
if (grub_install_bsd_part >= 0)
|
if (bsd_part != 0xff)
|
||||||
grub_snprintf (ptr, DEV_SIZE - (ptr - *device), ",%u",
|
grub_snprintf (ptr, DEV_SIZE - (ptr - *device), ",%u",
|
||||||
grub_install_bsd_part + 1);
|
bsd_part + 1);
|
||||||
ptr += grub_strlen (ptr);
|
ptr += grub_strlen (ptr);
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,6 @@ LOCAL(cont):
|
||||||
movsb
|
movsb
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
movl %eax, %esi
|
|
||||||
|
|
||||||
/* clean out the bss */
|
/* clean out the bss */
|
||||||
movl $BSS_START_SYMBOL, %edi
|
movl $BSS_START_SYMBOL, %edi
|
||||||
|
|
||||||
|
@ -97,9 +95,7 @@ LOCAL(cont):
|
||||||
rep
|
rep
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
movl %esi, EXT_C(grub_install_dos_part)
|
movl %edx, EXT_C(grub_boot_device)
|
||||||
movb %dl, EXT_C(grub_boot_drive)
|
|
||||||
movl %ebx, EXT_C(grub_install_bsd_part)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call the start of main body of C code.
|
* Call the start of main body of C code.
|
||||||
|
@ -182,9 +178,5 @@ FUNCTION(grub_pxe_call)
|
||||||
#include "../int.S"
|
#include "../int.S"
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
VARIABLE(grub_boot_drive)
|
VARIABLE(grub_boot_device)
|
||||||
.byte 0
|
.long 0
|
||||||
VARIABLE(grub_install_dos_part)
|
|
||||||
.long 0xFFFFFFFF
|
|
||||||
VARIABLE(grub_install_bsd_part)
|
|
||||||
.long 0xFFFFFFFF
|
|
||||||
|
|
|
@ -32,14 +32,7 @@
|
||||||
/* The total size of module images following the kernel. */
|
/* The total size of module images following the kernel. */
|
||||||
extern grub_int32_t grub_total_module_size;
|
extern grub_int32_t grub_total_module_size;
|
||||||
|
|
||||||
/* The DOS partition number of the installed partition. */
|
extern grub_uint32_t EXPORT_VAR(grub_boot_device);
|
||||||
extern grub_int32_t grub_install_dos_part;
|
|
||||||
|
|
||||||
/* The BSD partition number of the installed partition. */
|
|
||||||
extern grub_int32_t grub_install_bsd_part;
|
|
||||||
|
|
||||||
/* The boot BIOS drive number. */
|
|
||||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
|
||||||
|
|
||||||
extern void (*EXPORT_VAR(grub_pc_net_config)) (char **device, char **path);
|
extern void (*EXPORT_VAR(grub_pc_net_config)) (char **device, char **path);
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,8 @@
|
||||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||||
#define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE 0x0c
|
#define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE 0x0c
|
||||||
|
|
||||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
|
||||||
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x10
|
|
||||||
|
|
||||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
|
||||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x14
|
|
||||||
|
|
||||||
/* Offset of reed_solomon_redundancy. */
|
/* Offset of reed_solomon_redundancy. */
|
||||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x18
|
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x10
|
||||||
|
|
||||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6e0
|
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6e0
|
||||||
|
|
||||||
|
@ -129,8 +123,6 @@
|
||||||
|
|
||||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
|
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
|
||||||
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
|
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
|
||||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
|
|
||||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
|
|
||||||
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
|
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
|
||||||
|
|
||||||
#define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
#define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||||
|
|
|
@ -564,7 +564,7 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
||||||
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
||||||
config_opt="-c ${grubdir}/load.cfg "
|
config_opt="-c ${grubdir}/load.cfg "
|
||||||
modules="$modules search_fs_uuid"
|
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.
|
# we need to hardcode the partition number in the core image's prefix.
|
||||||
if [ x"$grub_partition" = x ]; then
|
if [ x"$grub_partition" = x ]; then
|
||||||
prefix_drive="()"
|
prefix_drive="()"
|
||||||
|
|
|
@ -84,7 +84,6 @@ struct image_target_desc
|
||||||
grub_uint16_t elf_target;
|
grub_uint16_t elf_target;
|
||||||
unsigned section_align;
|
unsigned section_align;
|
||||||
signed vaddr_offset;
|
signed vaddr_offset;
|
||||||
unsigned install_dos_part, install_bsd_part;
|
|
||||||
grub_uint64_t link_addr;
|
grub_uint64_t link_addr;
|
||||||
unsigned mod_gap, mod_align;
|
unsigned mod_gap, mod_align;
|
||||||
grub_compression_t default_compression;
|
grub_compression_t default_compression;
|
||||||
|
@ -113,8 +112,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
||||||
.elf_target = EM_386,
|
.elf_target = EM_386,
|
||||||
.link_align = 4,
|
.link_align = 4,
|
||||||
|
@ -134,8 +131,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
||||||
.elf_target = EM_386,
|
.elf_target = EM_386,
|
||||||
.link_align = 4,
|
.link_align = 4,
|
||||||
|
@ -155,8 +150,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.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
|
.link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -172,8 +165,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.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
|
.link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -194,8 +185,6 @@ struct image_target_desc image_targets[] =
|
||||||
+ sizeof (struct grub_pe32_optional_header)
|
+ sizeof (struct grub_pe32_optional_header)
|
||||||
+ 4 * sizeof (struct grub_pe32_section_table),
|
+ 4 * sizeof (struct grub_pe32_section_table),
|
||||||
GRUB_PE32_SECTION_ALIGNMENT),
|
GRUB_PE32_SECTION_ALIGNMENT),
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.pe_target = GRUB_PE32_MACHINE_I386,
|
.pe_target = GRUB_PE32_MACHINE_I386,
|
||||||
.elf_target = EM_386,
|
.elf_target = EM_386,
|
||||||
},
|
},
|
||||||
|
@ -212,8 +201,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_I386_IEEE1275_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_I386_IEEE1275_LINK_ADDR,
|
||||||
.elf_target = EM_386,
|
.elf_target = EM_386,
|
||||||
.mod_gap = GRUB_KERNEL_I386_IEEE1275_MOD_GAP,
|
.mod_gap = GRUB_KERNEL_I386_IEEE1275_MOD_GAP,
|
||||||
|
@ -233,8 +220,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_I386_QEMU_LINK_ADDR
|
.link_addr = GRUB_KERNEL_I386_QEMU_LINK_ADDR
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -250,8 +235,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
|
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
|
||||||
.vaddr_offset = EFI64_HEADER_SIZE,
|
.vaddr_offset = EFI64_HEADER_SIZE,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.pe_target = GRUB_PE32_MACHINE_X86_64,
|
.pe_target = GRUB_PE32_MACHINE_X86_64,
|
||||||
.elf_target = EM_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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
.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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
.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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
.link_align = GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN,
|
||||||
|
@ -330,8 +307,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR,
|
||||||
.elf_target = EM_PPC,
|
.elf_target = EM_PPC,
|
||||||
.mod_gap = GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP,
|
.mod_gap = GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP,
|
||||||
|
@ -351,8 +326,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -368,8 +341,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -385,8 +356,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
|
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
|
||||||
.vaddr_offset = EFI64_HEADER_SIZE,
|
.vaddr_offset = EFI64_HEADER_SIZE,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.pe_target = GRUB_PE32_MACHINE_IA64,
|
.pe_target = GRUB_PE32_MACHINE_IA64,
|
||||||
.elf_target = EM_IA_64,
|
.elf_target = EM_IA_64,
|
||||||
},
|
},
|
||||||
|
@ -404,8 +373,6 @@ struct image_target_desc image_targets[] =
|
||||||
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_ARC_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_ARC_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
|
.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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
.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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
.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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
.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,
|
.decompressor_uncompressed_addr = GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.install_dos_part = TARGET_NO_FIELD,
|
|
||||||
.install_bsd_part = TARGET_NO_FIELD,
|
|
||||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||||
.elf_target = EM_MIPS,
|
.elf_target = EM_MIPS,
|
||||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
.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;
|
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)
|
switch (image_target->id)
|
||||||
{
|
{
|
||||||
case IMAGE_I386_PC:
|
case IMAGE_I386_PC:
|
||||||
|
|
|
@ -101,56 +101,12 @@ write_rootdev (char *core_img, grub_device_t root_dev,
|
||||||
{
|
{
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
#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_uint8_t *boot_drive;
|
||||||
grub_disk_addr_t *kernel_sector;
|
grub_disk_addr_t *kernel_sector;
|
||||||
boot_drive = (grub_uint8_t *) (boot_img + GRUB_BOOT_MACHINE_BOOT_DRIVE);
|
boot_drive = (grub_uint8_t *) (boot_img + GRUB_BOOT_MACHINE_BOOT_DRIVE);
|
||||||
kernel_sector = (grub_disk_addr_t *) (boot_img
|
kernel_sector = (grub_disk_addr_t *) (boot_img
|
||||||
+ GRUB_BOOT_MACHINE_KERNEL_SECTOR);
|
+ 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? */
|
/* FIXME: can this be skipped? */
|
||||||
*boot_drive = 0xFF;
|
*boot_drive = 0xFF;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue