mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-12 17:26:21 +00:00
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>
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
/*
|
|
* Copyright (c) 2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#ifndef _EFI_H
|
|
#define _EFI_H
|
|
|
|
/* Minimal restatement of a minimal subset of the EFI runtime API */
|
|
|
|
#define __abi __attribute__((ms_abi))
|
|
|
|
typedef uintptr_t __abi (*efi_fn1_t)(void *);
|
|
typedef uintptr_t __abi (*efi_fn2_t)(void *, void *);
|
|
typedef uintptr_t __abi (*efi_fn3_t)(void *, void *, void *);
|
|
typedef uintptr_t __abi (*efi_fn4_t)(void *, void *, void *, void *);
|
|
|
|
struct efi_simple_text_output {
|
|
efi_fn2_t Reset;
|
|
efi_fn2_t OutputString;
|
|
efi_fn2_t TestString;
|
|
efi_fn4_t QueryMode;
|
|
efi_fn2_t SetMode;
|
|
efi_fn2_t SetAttribute;
|
|
efi_fn1_t ClearScreen;
|
|
efi_fn3_t SetCursorPosition;
|
|
efi_fn2_t EnableCursor;
|
|
struct simple_text_output_mode *Mode;
|
|
};
|
|
|
|
struct efi_system_table {
|
|
uint64_t Signature;
|
|
uint32_t Revision;
|
|
uint32_t HeaderSize;
|
|
uint32_t CRC32;
|
|
uint32_t Reserved;
|
|
uint16_t *FirmwareVendor;
|
|
uint32_t FirmwareRevision;
|
|
void *ConsoleInHandle;
|
|
struct efi_simple_input *ConIn;
|
|
void *ConsoleOutHandle;
|
|
struct efi_simple_text_output *ConOut;
|
|
void *StandardErrorHandle;
|
|
struct efi_simple_text_output *StdErr;
|
|
struct efi_runtime_services *RuntimeServices;
|
|
struct efi_boot_services *BootServices;
|
|
uint64_t NumberOfTableEntries;
|
|
struct efi_configuration_table *ConfigurationTable;
|
|
};
|
|
|
|
#endif /* _EFI_H */
|