[U-Boot] [PATCH v3 00/28] Add support for running U-Boot as an EFI payload/application

Simon Glass sjg at chromium.org
Tue Aug 4 20:33:38 CEST 2015


This series allows U-Boot to be build as an EFI payload so that U-Boot
can be started on almost any x86 platform that supports EFI. This is
implemented as a stub which EFI can load plus a payload that is copied
to RAM. The payload contains a normal U-Boot binary image and device tree.

This allows U-Boot to run on platforms that have EFI support but are not
supported natively by U-Boot. It also allows testing and fiddling with the
board using U-Boots memory display and other commands.

In addition, U-Boot can be built as an EFI application. This should work
regardless of the board type since it only relies on EFI services. However
only 32-bit EFI is supported in this case. Again it can be used to snoop
around the platform.

A README provides further details of how this series operates.

Changes in v3:
- Add new patch to allow device tree relocation to be disabled
- Add spaces around EFIARCH=
- Drop LDFLAGS_EFI from this patch
- Fix calling convention to starting U-Boot in the 32-bit stub
- Move '-m elf_i386' into the common PLATFORM_LDFLAGS
- Move 64-bit comment to just above the 64-bit flag adjustments
- Move the rename to u-boot-app.efi into this patch
- Move u-boot-app.efi Makefile change to the earlier patch
- Rename LDFLAGS_EFI to LDFLAGS_EFI_PAYLOAD and move into this patch
- Update the patch subject
- Use "BSD-2-Clause" for the SPDX license
- Use CONFIG_SYS_MONITOR_LEN as a more accurate value for U-Boot's size
- Use quiet_cmd_xxx to link the payload

Changes in v2:
- Add -no-red-zone for 64-bit only
- Add ALIGN() before .dynamic in the linker script
- Add a blank line before return in the _relocate() function
- Add a comment about special handling for backspace
- Add a comment about the REX prefix
- Add a comment as to where LDFLAGS_EFI is used
- Add a comment as to why .hash has to be first in the linker script
- Add a comment as to why debug_uart_init() is empty
- Add a comment as to why interrupt_init() must be skipped for EFI
- Add a comment as to why the AFLAGS_REMOVE_.. lines are needed
- Add a comment as to why we must call exit_boot_services() twice
- Add a note that bootm does not work when running as an EFI app
- Add descriptor bits for the base and limit
- Change 'link script' to 'linker script'
- Check the GDT selector's base and limit against the target address
- Drop . = 0x0;
- Drop \n\t at the end of a one-line asm statement
- Drop a left-over debug printf()
- Drop duplicate OBJCOPYFLAGS_EFI
- Drop no-red-zone as it is not needed for i386
- Drop patch "Add a link script entry for U-Boot as a payload"
- Drop the REX prefix in 32-bit mode
- Drop unnecessary .section .text
- Drop unnecessary SYS_CAR_ADDR/SIZE Kconfig options
- Drop unneeded include of asm/ptrace.h
- Drop unused DECLARE_GLOBAL_DATA_INIT
- Drop unused DECLARE_GLOBAL_DATA_PTR
- Drop unused board_eth_init()
- Drop use of CONFIG_X86_64 since we don't support a 64-bit EFI application yet
- Fix alignment of region index field in the output
- Fix comment style
- Fix efi_mem_desc_VERSION typo
- Fix indenting in board/emulation/qemu-x86/Kconfig
- Fix indenting in board/intel/minnowmax/Kconfig
- Fix reference to elf_ia32_efi instead of elf_x86_64_efi
- Fix spacing around operators
- Fix text alignment in Kconfig files
- Merge in Bin's implementation of adding a U-Boot payload with objcopy
- Move 64-bit crt0 to a later patch
- Move EFI CAR settings to arch/x86/lib/efi/Kconfig
- Move crt0 and reloc files into arch/x86/lib/efi/
- Move the 64-bit crt and reloc code into this patch
- Move the 64-bit efi.h additions into this patch
- Move the crt and reloc files into arch/x86/lib/efi/
- Output the region index in decimal
- Remove CONFIG_SYS_EARLY_PCI_INIT and CONFIG_PCI_PNP
- Remove KEEP in the EFI linker script since garbage collection is not enabled
- Remove comment about reset_cpu() returning to EFI in the stub
- Remove extraneous '+' in comment
- Remove superfluous Kconfig options
- Rename CONFIG_ARCH_EFI to CONFIG_EFI_APP
- Rename CONFIG_DEBUG_UART_EFI to CONFIG_DEBUG_EFI_CONSOLE
- Rename EFI debug UART to EFI_CONSOLE
- Rename GDT_4GB to GDT_4KB
- Rename ImageBase to image_base
- Replace 'Coreboot' with 'coreboot'
- Replace serial_s5p with serial_efi
- Return early in copy_uboot_to_ram() and clear_bbs() when relocation disabled
- Set text_base to 0 to avoid possible compiler warning
- Update based on the elf.h changes
- Use "efi,app" instead of "efi,payload" for the compatible string
- Use CONFIG_EFI_APP instead of CONFIG_ARCH_EFI
- Use SPDX for the EFI start and relocation code
- Use toolchain instead of tool chain
- Use u-boot-app.efi instead of u-boot.efi
- Zero BIST when starting from EFI/coreboot

Ben Stoltz (5):
  efi: Drop CONFIG_SYS_TEXT_BASE for EFI
  x86: Set up toolchain flags for running as EFI application
  x86: Add support for U-Boot as an EFI application
  x86: Add EFI board code
  x86: Add definitions for the x86-efi board and plumb it in

Simon Glass (23):
  Add a way to skip relocation
  efi: Add a serial driver
  efi: Support building a u-boot-app.efi executable
  x86: Support skipping relocation for EFI
  x86: Add asm/elf.h for x86-specific ELF definitions
  x86: dts: Add a device tree file for EFI
  x86: Allow relocation code to build without text base
  x86: Add relocation and link script for a 64-bit EFI application
  efi: Add support for loading U-Boot through an EFI stub
  x86: Support building the EFI stub
  x86: Add an enum for some commonly-used GDT bits
  x86: Add a way to call 32-bit code from 64-bit mode
  efi: Add 64-bit payload support
  x86: Add support for passing tables into U-Boot
  efi: Add functions for decoding the EFI tables
  efi: Add a command to display the memory map
  x86: Handle running as EFI payload
  x86: Add helper code for running from EFI
  x86: baytrail: Support operation as an EFI payload
  x86: qemu: Support operation as an EFI payload
  x86: Gracefully disable the vesa driver when running from EFI
  efi: Add a README to explain how things work
  Allow device tree relocation to be disabled

 Kconfig                              |   1 +
 Makefile                             |  29 +++
 arch/x86/Kconfig                     |  10 +
 arch/x86/Makefile                    |   2 +
 arch/x86/config.mk                   |  47 ++++-
 arch/x86/cpu/Makefile                |   7 +
 arch/x86/cpu/baytrail/Kconfig        |   2 +-
 arch/x86/cpu/baytrail/cpu.c          |   2 +
 arch/x86/cpu/baytrail/valleyview.c   |   2 +
 arch/x86/cpu/call32.S                |  64 ++++++
 arch/x86/cpu/cpu.c                   |  21 +-
 arch/x86/cpu/efi/Makefile            |   8 +
 arch/x86/cpu/efi/efi.c               |  42 ++++
 arch/x86/cpu/efi/elf_ia32_efi.lds    |  94 +++++++++
 arch/x86/cpu/efi/elf_x86_64_efi.lds  |  83 ++++++++
 arch/x86/cpu/efi/sdram.c             |  29 +++
 arch/x86/cpu/interrupts.c            |  16 +-
 arch/x86/cpu/qemu/Makefile           |   5 +-
 arch/x86/cpu/qemu/qemu.c             |   2 +
 arch/x86/cpu/start.S                 |  19 +-
 arch/x86/dts/Makefile                |   1 +
 arch/x86/dts/efi.dts                 |  22 +++
 arch/x86/include/asm/arch-efi/gpio.h |  10 +
 arch/x86/include/asm/cpu.h           |  27 +++
 arch/x86/include/asm/elf.h           |  46 +++++
 arch/x86/include/asm/global_data.h   |   1 +
 arch/x86/include/asm/types.h         |   5 +-
 arch/x86/lib/Makefile                |   3 +-
 arch/x86/lib/asm-offsets.c           |   1 +
 arch/x86/lib/bootm.c                 |   5 +
 arch/x86/lib/efi/Kconfig             |  11 ++
 arch/x86/lib/efi/Makefile            |  27 +++
 arch/x86/lib/efi/car.S               |  10 +
 arch/x86/lib/efi/crt0-efi-ia32.S     |  52 +++++
 arch/x86/lib/efi/crt0-efi-x86_64.S   |  51 +++++
 arch/x86/lib/efi/efi.c               | 151 ++++++++++++++
 arch/x86/lib/efi/reloc_ia32.c        |  72 +++++++
 arch/x86/lib/efi/reloc_x86_64.c      |  66 +++++++
 arch/x86/lib/relocate.c              |  23 ++-
 board/efi/Kconfig                    |  19 ++
 board/efi/efi-x86/Kconfig            |  15 ++
 board/efi/efi-x86/MAINTAINERS        |   6 +
 board/efi/efi-x86/Makefile           |   7 +
 board/efi/efi-x86/efi.c              |  18 ++
 board/emulation/qemu-x86/Kconfig     |   5 +-
 board/intel/minnowmax/Kconfig        |   5 +-
 common/Makefile                      |   1 +
 common/board_f.c                     |   9 +
 common/cmd_efi.c                     | 257 ++++++++++++++++++++++++
 configs/efi-x86_defconfig            |  16 ++
 doc/README.efi                       | 237 ++++++++++++++++++++++
 drivers/serial/Kconfig               |   9 +
 drivers/serial/Makefile              |   1 +
 drivers/serial/serial_efi.c          | 157 +++++++++++++++
 drivers/video/vesa_fb.c              |   8 +
 include/asm-generic/global_data.h    |   1 +
 include/common.h                     |   7 +
 include/configs/efi-x86.h            |  34 ++++
 include/efi.h                        |  11 ++
 lib/efi/Kconfig                      |  21 ++
 lib/efi/Makefile                     |  10 +
 lib/efi/efi_info.c                   |  47 +++++
 lib/efi/efi_stub.c                   | 370 +++++++++++++++++++++++++++++++++++
 63 files changed, 2312 insertions(+), 28 deletions(-)
 create mode 100644 arch/x86/cpu/call32.S
 create mode 100644 arch/x86/cpu/efi/Makefile
 create mode 100644 arch/x86/cpu/efi/efi.c
 create mode 100644 arch/x86/cpu/efi/elf_ia32_efi.lds
 create mode 100644 arch/x86/cpu/efi/elf_x86_64_efi.lds
 create mode 100644 arch/x86/cpu/efi/sdram.c
 create mode 100644 arch/x86/dts/efi.dts
 create mode 100644 arch/x86/include/asm/arch-efi/gpio.h
 create mode 100644 arch/x86/include/asm/elf.h
 create mode 100644 arch/x86/lib/efi/Kconfig
 create mode 100644 arch/x86/lib/efi/Makefile
 create mode 100644 arch/x86/lib/efi/car.S
 create mode 100644 arch/x86/lib/efi/crt0-efi-ia32.S
 create mode 100644 arch/x86/lib/efi/crt0-efi-x86_64.S
 create mode 100644 arch/x86/lib/efi/efi.c
 create mode 100644 arch/x86/lib/efi/reloc_ia32.c
 create mode 100644 arch/x86/lib/efi/reloc_x86_64.c
 create mode 100644 board/efi/Kconfig
 create mode 100644 board/efi/efi-x86/Kconfig
 create mode 100644 board/efi/efi-x86/MAINTAINERS
 create mode 100644 board/efi/efi-x86/Makefile
 create mode 100644 board/efi/efi-x86/efi.c
 create mode 100644 common/cmd_efi.c
 create mode 100644 configs/efi-x86_defconfig
 create mode 100644 doc/README.efi
 create mode 100644 drivers/serial/serial_efi.c
 create mode 100644 include/configs/efi-x86.h
 create mode 100644 lib/efi/efi_info.c
 create mode 100644 lib/efi/efi_stub.c

-- 
2.5.0.rc2.392.g76e840b



More information about the U-Boot mailing list