
On 5 August 2015 at 01:59, Bin Meng bmeng.cn@gmail.com wrote:
On Wed, Aug 5, 2015 at 2:33 AM, Simon Glass sjg@chromium.org wrote:
It is useful to be able to load U-Boot onto a board even if is it already running EFI. This can allow access to the U-Boot command interface, flexible booting options and easier development.
The easiest way to do this is to build U-Boot as a binary blob and have an EFI stub copy it into RAM. Add support for this feature, targeting 32-bit initially.
Also add a way to detect when U-Boot has been loaded via a stub. This goes in common.h since it needs to be widely available so that we avoid redoing initialisation that should be skipped.
Signed-off-by: Simon Glass sjg@chromium.org Improvements to how the payload is built: Signed-off-by: Bin Meng bmeng.cn@gmail.com
Changes in v3:
- Fix calling convention to starting U-Boot in the 32-bit stub
- Rename LDFLAGS_EFI to LDFLAGS_EFI_PAYLOAD and move into this patch
- Use quiet_cmd_xxx to link the payload
Changes in v2:
- Add a comment as to why we must call exit_boot_services() twice
- Drop \n\t at the end of a one-line asm statement
- Merge in Bin's implementation of adding a U-Boot payload with objcopy
- Remove comment about reset_cpu() returning to EFI in the stub
- Rename CONFIG_ARCH_EFI to CONFIG_EFI_APP
Makefile | 24 +++++ arch/x86/config.mk | 7 ++ include/common.h | 7 ++ include/efi.h | 4 + lib/efi/Kconfig | 21 ++++ lib/efi/Makefile | 9 ++ lib/efi/efi_stub.c | 304 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 376 insertions(+) create mode 100644 lib/efi/efi_stub.c
[snip]
--
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Tested on QEMU 32-bit and 64-bit Tested-by: Bin Meng bmeng.cn@gmail.com
Applied to u-boot-x86.