arm-coreboot: Start new port.
This commit is contained in:
parent
9808c3ef95
commit
24e37a8852
17 changed files with 482 additions and 12 deletions
|
@ -87,7 +87,8 @@ struct fixup_block_list
|
|||
static int
|
||||
is_relocatable (const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
return image_target->id == IMAGE_EFI || image_target->id == IMAGE_UBOOT;
|
||||
return image_target->id == IMAGE_EFI || image_target->id == IMAGE_UBOOT
|
||||
|| (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM);
|
||||
}
|
||||
|
||||
#ifdef MKIMAGE_ELF32
|
||||
|
@ -274,7 +275,10 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
|
|||
{
|
||||
grub_uint32_t target_addr_mods;
|
||||
phdr->p_filesz = grub_host_to_target32 (layout->kernel_size);
|
||||
phdr->p_memsz = grub_host_to_target32 (layout->kernel_size + layout->bss_size);
|
||||
if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM)
|
||||
phdr->p_memsz = grub_host_to_target32 (layout->kernel_size);
|
||||
else
|
||||
phdr->p_memsz = grub_host_to_target32 (layout->kernel_size + layout->bss_size);
|
||||
|
||||
phdr++;
|
||||
phdr->p_type = grub_host_to_target32 (PT_GNU_STACK);
|
||||
|
@ -290,8 +294,12 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
|
|||
phdr->p_filesz = phdr->p_memsz
|
||||
= grub_host_to_target32 (*core_size - layout->kernel_size);
|
||||
|
||||
if (image_target->id == IMAGE_COREBOOT)
|
||||
if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_386)
|
||||
target_addr_mods = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR;
|
||||
else if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM)
|
||||
target_addr_mods = ALIGN_UP (target_addr + layout->end
|
||||
+ image_target->mod_gap,
|
||||
image_target->mod_align);
|
||||
else
|
||||
target_addr_mods = ALIGN_UP (target_addr + layout->kernel_size + layout->bss_size
|
||||
+ image_target->mod_gap,
|
||||
|
@ -1876,7 +1884,7 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path,
|
|||
Platforms other than EFI and U-boot shouldn't have .bss in
|
||||
their binaries as we build with -Wl,-Ttext.
|
||||
*/
|
||||
if (image_target->id != IMAGE_UBOOT)
|
||||
if (image_target->id == IMAGE_EFI || !is_relocatable (image_target))
|
||||
layout->kernel_size = layout->end;
|
||||
|
||||
return section_addresses;
|
||||
|
@ -1979,6 +1987,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
|
|||
if (image_target->id == IMAGE_SPARC64_AOUT
|
||||
|| image_target->id == IMAGE_SPARC64_RAW
|
||||
|| image_target->id == IMAGE_UBOOT
|
||||
|| image_target->id == IMAGE_COREBOOT
|
||||
|| image_target->id == IMAGE_SPARC64_CDCORE)
|
||||
layout->kernel_size = ALIGN_UP (layout->kernel_size, image_target->mod_align);
|
||||
|
||||
|
@ -2084,7 +2093,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
|
|||
Platforms other than EFI and U-boot shouldn't have .bss in
|
||||
their binaries as we build with -Wl,-Ttext.
|
||||
*/
|
||||
|| (SUFFIX (is_bss_section) (s, image_target) && (image_target->id != IMAGE_UBOOT))
|
||||
|| (SUFFIX (is_bss_section) (s, image_target) && (image_target->id == IMAGE_EFI || !is_relocatable (image_target)))
|
||||
|| SUFFIX (is_text_section) (s, image_target))
|
||||
{
|
||||
if (grub_target_to_host32 (s->sh_type) == SHT_NOBITS)
|
||||
|
|
|
@ -533,6 +533,45 @@ static const struct grub_install_image_target_desc image_targets[] =
|
|||
.mod_align = GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN,
|
||||
.link_align = 4
|
||||
},
|
||||
/* For coreboot versions that don't support self-relocating images. */
|
||||
{
|
||||
.dirname = "arm-coreboot-vexpress",
|
||||
.names = { "arm-coreboot-vexpress", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
.id = IMAGE_COREBOOT,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.total_module_size = GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE,
|
||||
.decompressor_compressed_size = TARGET_NO_FIELD,
|
||||
.decompressor_uncompressed_size = TARGET_NO_FIELD,
|
||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN,
|
||||
.vaddr_offset = 0,
|
||||
.elf_target = EM_ARM,
|
||||
.mod_gap = GRUB_KERNEL_ARM_COREBOOT_MOD_GAP,
|
||||
.mod_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN,
|
||||
.link_align = 4,
|
||||
.link_addr = 0x62000000,
|
||||
},
|
||||
{
|
||||
.dirname = "arm-coreboot-veyron",
|
||||
.names = { "arm-coreboot-veyron", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
.id = IMAGE_COREBOOT,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.total_module_size = GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE,
|
||||
.decompressor_compressed_size = TARGET_NO_FIELD,
|
||||
.decompressor_uncompressed_size = TARGET_NO_FIELD,
|
||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||
.section_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN,
|
||||
.vaddr_offset = 0,
|
||||
.elf_target = EM_ARM,
|
||||
.mod_gap = GRUB_KERNEL_ARM_COREBOOT_MOD_GAP,
|
||||
.mod_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN,
|
||||
.link_align = 4,
|
||||
.link_addr = 0x43000000,
|
||||
},
|
||||
{
|
||||
.dirname = "arm-efi",
|
||||
.names = { "arm-efi", NULL },
|
||||
|
@ -1033,7 +1072,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||
/* fallthrough */
|
||||
case IMAGE_COREBOOT:
|
||||
case IMAGE_QEMU:
|
||||
if (layout.kernel_size + layout.bss_size + GRUB_KERNEL_I386_PC_LINK_ADDR > 0x68000)
|
||||
if (image_target->elf_target != EM_ARM && layout.kernel_size + layout.bss_size + GRUB_KERNEL_I386_PC_LINK_ADDR > 0x68000)
|
||||
grub_util_error (_("kernel image is too big (0x%x > 0x%x)"),
|
||||
(unsigned) layout.kernel_size + (unsigned) layout.bss_size
|
||||
+ GRUB_KERNEL_I386_PC_LINK_ADDR,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue