zephyr/arch/x86/zefi/efi.ld
Andy Ross 928d31125f arch/x86: Add zefi, an EFI stub/packer/wrappper/loader
This is a first cut on a tool that will convert a built Zephyr ELF
file into an EFI applciation suitable for launching directly from the
firmware of a UEFI-capable device, without the need for an external
bootloader.

It works by including the Zephyr sections into the EFI binary as
blobs, then copying them into place on startup.

Currently, it is not integrated in the build.  Right now you have to
build an image for your target (up_squared has been tested) and then
pass the resulting zephyr.elf file as an argument to the
arch/x86/zefi/zefi.py script.  It will produce a "zephyr.efi" file in
the current directory.

This involved a little surgery in x86_64 to copy over some setup that
was previously being done in 32 bit mode to a new EFI entry point.
There is no support for 32 bit UEFI targets for toolchain reasons.

See the README for more details.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-02 09:10:01 -04:00

50 lines
1.0 KiB
Plaintext

ENTRY(efi_entry)
SECTIONS {
/* Pick a reasonable base address, EFI won't load us there anyway */
. = 0x4000000;
.text : {
*(.text)
*(.rodata)
}
/* Must be a separately visible section to the EFI loader, doesn't
* need to be page-aligned and can be immediately after text/rodata */
.reloc : { *(.reloc) }
/* Must be page-aligned or EFI balks */
. = ALIGN(4096);
.data : {
*(.data)
*(COMMON)
*(.bss)
*(.runtime_data_end) /* Must be last. Obviously. */
}
/* Because binutils ld really likes to "helpfully" ignore the section
* directives and drop junk in weird places.
*/
.trash_bin : {
*(.comment)
*(.data.rel*)
*(.dynamic)
*(.dynbss)
*(.dynstr)
*(.dynsym)
*(.eh_frame)
*(.gnu.hash)
*(.gnu.version*)
*(.got)
*(.got.plt)
*(.hash)
*(.note.*)
*(.plt)
*(.plt.*)
*(.rela.*)
*(.rel.local)
}
} /* SECTIONS */