Make grub_prefix into module to fix the arbitrary limit and save
some space. * grub-core/kern/emu/main.c (grub_prefix): Removed. * grub-core/kern/i386/coreboot/startup.S (grub_prefix): Likewise. * grub-core/kern/i386/efi/startup.S (grub_prefix): Likewise. * grub-core/kern/i386/ieee1275/startup.S (grub_prefix): Likewise. * grub-core/kern/i386/pc/startup.S (grub_prefix): Likewise. * grub-core/kern/i386/qemu/startup.S (grub_prefix): Likewise. * grub-core/kern/ia64/efi/startup.S (grub_prefix): Likewise. * grub-core/kern/mips/startup.S (grub_prefix): Likewise. * grub-core/kern/powerpc/ieee1275/startup.S (grub_prefix): Likewise. * grub-core/kern/sparc64/ieee1275/crt0.S (grub_prefix): Likewise. * grub-core/kern/x86_64/efi/startup.S (grub_prefix): Likewise. * include/grub/ia64/efi/kernel.h: Removed. * include/grub/kernel.h: New module type OBJ_TYPE_PREFIX. (grub_prefix): Removed. * include/grub/offsets.h (GRUB_KERNEL_I386_PC_PREFIX): Removed. (GRUB_KERNEL_I386_PC_PREFIX_END): Likewise. (GRUB_KERNEL_I386_QEMU_PREFIX): Likewise. (GRUB_KERNEL_I386_QEMU_PREFIX_END): Likewise. (GRUB_KERNEL_SPARC64_IEEE1275_PREFIX): Likewise. (GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END): Likewise. (GRUB_KERNEL_POWERPC_IEEE1275_PREFIX): Likewise. (GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END): Likewise. (GRUB_KERNEL_MIPS_LOONGSON_PREFIX): Likewise. (GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END): Likewise. (GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX): Likewise. (GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END): Likewise. (GRUB_KERNEL_MIPS_ARC_PREFIX): Likewise. (GRUB_KERNEL_MIPS_ARC_PREFIX_END): Likewise. (GRUB_KERNEL_I386_EFI_PREFIX): Likewise. (GRUB_KERNEL_I386_EFI_PREFIX_END): Likewise. (GRUB_KERNEL_IA64_EFI_PREFIX): Likewise. (GRUB_KERNEL_IA64_EFI_PREFIX_END): Likewise. (GRUB_KERNEL_X86_64_EFI_PREFIX): Likewise. (GRUB_KERNEL_X86_64_EFI_PREFIX_END): Likewise. (GRUB_KERNEL_I386_COREBOOT_PREFIX): Likewise. (GRUB_KERNEL_I386_COREBOOT_PREFIX_END): Likewise. (GRUB_KERNEL_I386_MULTIBOOT_PREFIX): Likewise. (GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END): Likewise. (GRUB_KERNEL_I386_IEEE1275_PREFIX): Likewise. (GRUB_KERNEL_I386_IEEE1275_PREFIX_END): Likewise. (GRUB_KERNEL_MACHINE_PREFIX): Likewise. (GRUB_KERNEL_MACHINE_PREFIX_END): Likewise. * grub-core/kern/main.c (grub_set_prefix_and_root): Retrieve grub_prefix from module. * util/grub-mkimage.c (image_target_desc): Removed prefix and prefix_end. (image_targets): Likewise. (generate_image): Put prefix as a module.
This commit is contained in:
parent
39705fadd7
commit
a97501d238
17 changed files with 106 additions and 283 deletions
54
ChangeLog
54
ChangeLog
|
@ -1,3 +1,57 @@
|
|||
2011-10-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Make grub_prefix into module to fix the arbitrary limit and save
|
||||
some space.
|
||||
|
||||
* grub-core/kern/emu/main.c (grub_prefix): Removed.
|
||||
* grub-core/kern/i386/coreboot/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/i386/efi/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/i386/ieee1275/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/i386/pc/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/i386/qemu/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/ia64/efi/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/mips/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/powerpc/ieee1275/startup.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/sparc64/ieee1275/crt0.S (grub_prefix): Likewise.
|
||||
* grub-core/kern/x86_64/efi/startup.S (grub_prefix): Likewise.
|
||||
* include/grub/ia64/efi/kernel.h: Removed.
|
||||
* include/grub/kernel.h: New module type OBJ_TYPE_PREFIX.
|
||||
(grub_prefix): Removed.
|
||||
* include/grub/offsets.h (GRUB_KERNEL_I386_PC_PREFIX): Removed.
|
||||
(GRUB_KERNEL_I386_PC_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_I386_QEMU_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_I386_QEMU_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_SPARC64_IEEE1275_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_POWERPC_IEEE1275_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MIPS_LOONGSON_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_I386_EFI_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_I386_EFI_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_IA64_EFI_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_IA64_EFI_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_X86_64_EFI_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_X86_64_EFI_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_I386_COREBOOT_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_I386_COREBOOT_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_I386_MULTIBOOT_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_I386_IEEE1275_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_I386_IEEE1275_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MACHINE_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MACHINE_PREFIX_END): Likewise.
|
||||
* grub-core/kern/main.c (grub_set_prefix_and_root): Retrieve grub_prefix
|
||||
from module.
|
||||
* util/grub-mkimage.c (image_target_desc): Removed prefix and
|
||||
prefix_end.
|
||||
(image_targets): Likewise.
|
||||
(generate_image): Put prefix as a module.
|
||||
|
||||
2011-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Replace grub_module_iterate with FOR_MODULES.
|
||||
|
|
|
@ -79,8 +79,6 @@ grub_machine_fini (void)
|
|||
grub_console_fini ();
|
||||
}
|
||||
|
||||
char grub_prefix[64] = "";
|
||||
|
||||
|
||||
|
||||
static struct option options[] =
|
||||
|
|
|
@ -40,21 +40,6 @@ start:
|
|||
_start:
|
||||
jmp codestart
|
||||
|
||||
/*
|
||||
* This is a special data area at a fixed offset from the beginning.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
||||
/*
|
||||
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
||||
*/
|
||||
|
|
|
@ -41,17 +41,6 @@ _start:
|
|||
* This is a special data area 8 bytes from the beginning.
|
||||
*/
|
||||
|
||||
. = _start + 0x8
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + 0x50
|
||||
|
||||
codestart:
|
||||
/*
|
||||
* EFI_SYSTEM_TABLE * and EFI_HANDLE are passed on the stack.
|
||||
|
|
|
@ -36,24 +36,6 @@
|
|||
|
||||
start:
|
||||
_start:
|
||||
jmp codestart
|
||||
|
||||
/*
|
||||
* This is a special data area at a fixed offset from the beginning.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
||||
codestart:
|
||||
movl %eax, EXT_C(grub_ieee1275_entry_fn)
|
||||
jmp EXT_C(grub_main)
|
||||
|
||||
|
|
|
@ -455,17 +455,6 @@ gate_a20_check_state:
|
|||
*/
|
||||
. = _start + GRUB_KERNEL_MACHINE_RAW_SIZE
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* grub_exit()
|
||||
*
|
||||
|
|
|
@ -34,14 +34,6 @@ VARIABLE(grub_core_entry_addr)
|
|||
.long 0
|
||||
VARIABLE(grub_kernel_image_size)
|
||||
.long 0
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
||||
codestart:
|
||||
/* Relocate to low memory. First we figure out our location.
|
||||
|
|
|
@ -42,13 +42,3 @@ _start:
|
|||
br.ret.sptk.few rp
|
||||
|
||||
.endp _start
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
VARIABLE(grub_prefix)
|
||||
.byte 0
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
|
|
@ -105,25 +105,32 @@ grub_set_prefix_and_root (void)
|
|||
char *path = NULL;
|
||||
char *fwdevice = NULL;
|
||||
char *fwpath = NULL;
|
||||
char *prefix;
|
||||
struct grub_module_header *header;
|
||||
|
||||
FOR_MODULES (header)
|
||||
if (header->type == OBJ_TYPE_PREFIX)
|
||||
prefix = (char *) header + sizeof (struct grub_module_header);
|
||||
|
||||
grub_register_variable_hook ("root", 0, grub_env_write_root);
|
||||
|
||||
{
|
||||
char *pptr = NULL;
|
||||
if (grub_prefix[0] == '(')
|
||||
{
|
||||
pptr = grub_strrchr (grub_prefix, ')');
|
||||
if (pptr)
|
||||
{
|
||||
device = grub_strndup (grub_prefix + 1, pptr - grub_prefix - 1);
|
||||
pptr++;
|
||||
}
|
||||
}
|
||||
if (!pptr)
|
||||
pptr = grub_prefix;
|
||||
if (pptr[0])
|
||||
path = grub_strdup (pptr);
|
||||
}
|
||||
if (prefix)
|
||||
{
|
||||
char *pptr = NULL;
|
||||
if (prefix[0] == '(')
|
||||
{
|
||||
pptr = grub_strrchr (prefix, ')');
|
||||
if (pptr)
|
||||
{
|
||||
device = grub_strndup (prefix + 1, pptr - prefix - 1);
|
||||
pptr++;
|
||||
}
|
||||
}
|
||||
if (!pptr)
|
||||
pptr = prefix;
|
||||
if (pptr[0])
|
||||
path = grub_strdup (pptr);
|
||||
}
|
||||
if ((!device || device[0] == ',' || !device[0]) || !path)
|
||||
grub_machine_get_bootlocation (&fwdevice, &fwpath);
|
||||
|
||||
|
@ -152,13 +159,13 @@ grub_set_prefix_and_root (void)
|
|||
path = fwpath;
|
||||
if (device)
|
||||
{
|
||||
char *prefix;
|
||||
char *prefix_set;
|
||||
|
||||
prefix = grub_xasprintf ("(%s)%s", device, path ? : "");
|
||||
if (prefix)
|
||||
prefix_set = grub_xasprintf ("(%s)%s", device, path ? : "");
|
||||
if (prefix_set)
|
||||
{
|
||||
grub_env_set ("prefix", prefix);
|
||||
grub_free (prefix);
|
||||
grub_env_set ("prefix", prefix_set);
|
||||
grub_free (prefix_set);
|
||||
}
|
||||
grub_env_set ("root", device);
|
||||
}
|
||||
|
|
|
@ -40,17 +40,6 @@ start:
|
|||
VARIABLE(grub_total_modules_size)
|
||||
.long 0
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
VARIABLE (grub_arch_busclock)
|
||||
.long 0
|
||||
VARIABLE (grub_arch_cpuclock)
|
||||
|
|
|
@ -28,20 +28,6 @@
|
|||
.globl start, _start
|
||||
start:
|
||||
_start:
|
||||
b codestart
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
||||
codestart:
|
||||
li 2, 0
|
||||
li 13, 0
|
||||
|
||||
|
|
|
@ -35,14 +35,6 @@ VARIABLE(grub_kernel_image_size)
|
|||
.word 0
|
||||
VARIABLE(grub_compressed_size)
|
||||
.word 0
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
|
||||
codestart:
|
||||
/* Copy the modules past the end of the kernel image.
|
||||
|
|
|
@ -39,21 +39,6 @@ _start:
|
|||
. = _start + 0x6
|
||||
.byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
||||
|
||||
/*
|
||||
* This is a special data area 8 bytes from the beginning.
|
||||
*/
|
||||
|
||||
. = _start + 0x8
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
/* to be filled by grub-mkimage */
|
||||
|
||||
/*
|
||||
* Leave some breathing room for the prefix.
|
||||
*/
|
||||
|
||||
. = _start + 0x50
|
||||
|
||||
codestart:
|
||||
movq %rcx, EXT_C(grub_efi_image_handle)(%rip)
|
||||
movq %rdx, EXT_C(grub_efi_system_table)(%rip)
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007,2008,2010 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_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#ifndef ASM_FILE
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
|
@ -26,7 +26,8 @@ enum
|
|||
{
|
||||
OBJ_TYPE_ELF,
|
||||
OBJ_TYPE_MEMDISK,
|
||||
OBJ_TYPE_CONFIG
|
||||
OBJ_TYPE_CONFIG,
|
||||
OBJ_TYPE_PREFIX
|
||||
};
|
||||
|
||||
/* The module header. */
|
||||
|
@ -98,9 +99,4 @@ void grub_register_exported_symbols (void);
|
|||
|
||||
extern void (*EXPORT_VAR(grub_net_poll_cards_idle)) (void);
|
||||
|
||||
|
||||
#if ! defined (ASM_FILE)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_HEADER */
|
||||
|
|
|
@ -42,12 +42,6 @@
|
|||
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x730
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX_END (GRUB_KERNEL_I386_PC_PREFIX + 0x40)
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
|
||||
|
||||
|
@ -66,12 +60,6 @@
|
|||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
|
@ -83,20 +71,12 @@
|
|||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END 0x114
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END 0x44
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
|
||||
|
||||
|
@ -109,8 +89,6 @@
|
|||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR 0x80200000
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN 32
|
||||
|
@ -118,8 +96,6 @@
|
|||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
|
||||
|
||||
|
@ -130,36 +106,9 @@
|
|||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX_END 0x50
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_IA64_EFI_PREFIX 0x50
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_IA64_EFI_PREFIX_END 0xa0
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX_END 0x42
|
||||
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
|
||||
|
||||
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX GRUB_KERNEL_I386_COREBOOT_PREFIX
|
||||
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END GRUB_KERNEL_I386_COREBOOT_PREFIX_END
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX_END 0x42
|
||||
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
|
||||
|
@ -194,8 +143,6 @@
|
|||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
|
||||
#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_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
|
||||
|
|
|
@ -77,8 +77,6 @@ struct image_target_desc
|
|||
PLATFORM_FLAGS_DECOMPRESSORS = 2,
|
||||
PLATFORM_FLAGS_MODULES_BEFORE_KERNEL = 4,
|
||||
} flags;
|
||||
unsigned prefix;
|
||||
unsigned prefix_end;
|
||||
unsigned raw_size;
|
||||
unsigned total_module_size;
|
||||
unsigned kernel_image_size;
|
||||
|
@ -110,8 +108,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_COREBOOT,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_I386_COREBOOT_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_COREBOOT_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -133,8 +129,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_COREBOOT,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_I386_MULTIBOOT_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -156,8 +150,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_I386_PC,
|
||||
.flags = PLATFORM_FLAGS_LZMA,
|
||||
.prefix = GRUB_KERNEL_I386_PC_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_PC_PREFIX_END,
|
||||
.raw_size = GRUB_KERNEL_I386_PC_RAW_SIZE,
|
||||
.total_module_size = GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE,
|
||||
.kernel_image_size = GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE,
|
||||
|
@ -175,8 +167,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_I386_PC_PXE,
|
||||
.flags = PLATFORM_FLAGS_LZMA,
|
||||
.prefix = GRUB_KERNEL_I386_PC_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_PC_PREFIX_END,
|
||||
.raw_size = GRUB_KERNEL_I386_PC_RAW_SIZE,
|
||||
.total_module_size = GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE,
|
||||
.kernel_image_size = GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE,
|
||||
|
@ -194,8 +184,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_EFI,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_I386_EFI_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_EFI_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -219,8 +207,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_I386_IEEE1275,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_I386_IEEE1275_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_IEEE1275_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -242,8 +228,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_QEMU,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_I386_QEMU_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_I386_QEMU_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -261,8 +245,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_EFI,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_X86_64_EFI_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_X86_64_EFI_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -281,8 +263,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_YEELOONG_FLASH,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_LOONGSON_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -303,8 +283,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_FULOONG2F_FLASH,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_LOONGSON_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -327,8 +305,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_LOONGSON_ELF,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_LOONGSON_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -349,8 +325,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 1,
|
||||
.id = IMAGE_PPC,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_POWERPC_IEEE1275_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -372,8 +346,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 1,
|
||||
.id = IMAGE_SPARC64_RAW,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END,
|
||||
.raw_size = GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE,
|
||||
.total_module_size = GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE,
|
||||
.kernel_image_size = GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE,
|
||||
|
@ -391,8 +363,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 1,
|
||||
.id = IMAGE_SPARC64_AOUT,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END,
|
||||
.raw_size = GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE,
|
||||
.total_module_size = GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE,
|
||||
.kernel_image_size = GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE,
|
||||
|
@ -410,8 +380,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_EFI,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.prefix = GRUB_KERNEL_IA64_EFI_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_IA64_EFI_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
|
@ -431,8 +399,6 @@ struct image_target_desc image_targets[] =
|
|||
.id = IMAGE_MIPS_ARC,
|
||||
.flags = (PLATFORM_FLAGS_DECOMPRESSORS
|
||||
| PLATFORM_FLAGS_MODULES_BEFORE_KERNEL),
|
||||
.prefix = GRUB_KERNEL_MIPS_ARC_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_ARC_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -453,8 +419,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_LOONGSON_ELF,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -475,8 +439,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 1,
|
||||
.id = IMAGE_QEMU_MIPS_FLASH,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -497,8 +459,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 0,
|
||||
.id = IMAGE_QEMU_MIPS_FLASH,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -519,8 +479,6 @@ struct image_target_desc image_targets[] =
|
|||
.bigendian = 1,
|
||||
.id = IMAGE_LOONGSON_ELF,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
|
@ -797,6 +755,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
char *kernel_img, *core_img;
|
||||
size_t kernel_size, total_module_size, core_size, exec_size;
|
||||
size_t memdisk_size = 0, config_size = 0, config_size_pure = 0;
|
||||
size_t prefix_size = 0;
|
||||
char *kernel_path;
|
||||
size_t offset;
|
||||
struct grub_util_path_list *path_list, *p, *next;
|
||||
|
@ -833,6 +792,12 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
total_module_size += config_size + sizeof (struct grub_module_header);
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
{
|
||||
prefix_size = ALIGN_ADDR (strlen (prefix) + 1);
|
||||
total_module_size += prefix_size + sizeof (struct grub_module_header);
|
||||
}
|
||||
|
||||
for (p = path_list; p; p = p->next)
|
||||
total_module_size += (ALIGN_ADDR (grub_util_get_image_size (p->name))
|
||||
+ sizeof (struct grub_module_header));
|
||||
|
@ -848,10 +813,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
total_module_size, &start_address, &rel_section,
|
||||
&reloc_size, &align, image_target);
|
||||
|
||||
if (image_target->prefix + strlen (prefix) + 1 > image_target->prefix_end)
|
||||
grub_util_error (_("prefix is too long"));
|
||||
strcpy (kernel_img + image_target->prefix, prefix);
|
||||
|
||||
if ((image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
|
||||
&& (image_target->total_module_size != TARGET_NO_FIELD))
|
||||
*((grub_uint32_t *) (kernel_img + image_target->total_module_size))
|
||||
|
@ -943,6 +904,21 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
offset += config_size;
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
{
|
||||
struct grub_module_header *header;
|
||||
|
||||
header = (struct grub_module_header *) (kernel_img + offset);
|
||||
memset (header, 0, sizeof (struct grub_module_header));
|
||||
header->type = grub_host_to_target32 (OBJ_TYPE_PREFIX);
|
||||
header->size = grub_host_to_target32 (prefix_size + sizeof (*header));
|
||||
offset += sizeof (*header);
|
||||
|
||||
grub_memset (kernel_img + offset, 0, prefix_size);
|
||||
grub_strcpy (kernel_img + offset, prefix);
|
||||
offset += prefix_size;
|
||||
}
|
||||
|
||||
grub_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size);
|
||||
compress_kernel (image_target, kernel_img, kernel_size + total_module_size,
|
||||
&core_img, &core_size, comp);
|
||||
|
|
Loading…
Reference in a new issue