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

Simon Glass sjg at chromium.org
Fri Jul 31 17:31:17 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 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 comment as to why we only allocate pages below 4GB
- Add a comment as to why we use global_data_ptr
- Add a marker for the cold reset entry point
- Add a note that bootm does not work when running as an EFI app
- Add comments as to why we need efi_memset(), efi_putc(), efi_puts()
- Add descriptor bits for the base and limit
- Add new patch to reserve the top 16 flag bits for architecture-specific use
- Avoid useless u64 cast on EFI_RUNTIME_SERVICES_SIGNATURE
- Change 'link script' to 'linker script'
- Check the GDT selector's base and limit against the target address
- Correct the return code to avoid a test failure
- Drop . = 0x0;
- Drop \n\t at the end of a one-line asm statement
- Drop __packed from struct efi_device_path
- 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
- Explain in a comment how the debug UART is implemented for the EFI app
- Fix 'command problem' typo - it should say 'command prompt'
- Fix 'withU-Boot.' typo
- Fix _aligned() typo
- Fix a few comment typos
- 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 mention of CHAR16 which should be wchar_t
- Fix missing struct comments
- Fix reference to elf_ia32_efi instead of elf_x86_64_efi
- Fix spacing around operators
- Fix text alignment in Kconfig files
- Follow existing file conventions for type definitions
- 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 64-bit payload code to a later patch
- Move the crt and reloc files into arch/x86/lib/efi/
- Move this patch to before the EFI start-up code patch
- Output the region index in decimal
- Refer to FS as F segment register instead of frame segment register
- 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
- Reorder this patch to after CONFIG_EFI_APP is introduced
- Replace 'Coreboot' with 'coreboot'
- Replace serial_s5p with serial_efi
- Return early in copy_uboot_to_ram() and clear_bbs() when relocation disabled
- Reword the efi_putc() unicode comment to make more sense
- 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 image_base instead of ImageBase
- Use one-line comments when appropriate
- Use reserved instead of __reserved in struct efi_boot_services
- Use the now-defined top 16-bits of the global_data flags
- 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 (6):
  efi: Avoid using non-existent text base
  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 (41):
  Support removing default assembler flags
  dm: core: Check for empty list in uclass_find_device()
  dm: serial: Correct logic in serial_find_console_or_panic()
  elf: Add a few definitions for 64-bit relocation
  Add a way to skip relocation
  Allow objcopy to work without filling gaps with 0xff
  Bring in __aligned_u64 and friends to linux/types.h
  x86: Add various minor tidy-ups to the 32-bit startup code
  x86: Use CR0 constants in CPU init
  Reserve the top 16 flag bits for architecture-specific use
  x86: Tidy up global_data flags
  x86: Drop unused copy_fdt_to_ram()
  x86: Tidy up the 64-bit calling code
  x86: Add some missing global_data declarations in files that use gd
  x86: Tidy up a few minor issues with interrupts
  pci: Use debug() instead of DEBUGF() in pci_auto.c
  pci: Fix up code for CONFIG_PCI_ENUM_ONLY
  x86: Allow use of global_data with EFI
  efi: Add start-up library code
  efi: Display the correct initcall pre-relocation values
  efi: Add a serial driver
  efi: Support building a u-boot.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

 Kconfig                              |   1 +
 Makefile                             |  34 +++-
 arch/x86/Kconfig                     |  10 +
 arch/x86/Makefile                    |   2 +
 arch/x86/config.mk                   |  48 ++++-
 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/call64.S                |   4 +-
 arch/x86/cpu/cpu.c                   |  23 ++-
 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            |  25 ++-
 arch/x86/cpu/mp_init.c               |   2 +
 arch/x86/cpu/qemu/Makefile           |   5 +-
 arch/x86/cpu/qemu/qemu.c             |   2 +
 arch/x86/cpu/start.S                 |  73 ++++---
 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/fsp/fsp_hob.h   |  59 +-----
 arch/x86/include/asm/global_data.h   |  16 +-
 arch/x86/include/asm/relocate.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                 |   7 +
 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/fsp/fsp_common.c        |   2 +
 arch/x86/lib/lpc-uclass.c            |   2 +
 arch/x86/lib/pch-uclass.c            |   2 +
 arch/x86/lib/relocate.c              |  41 ++--
 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                     |  14 +-
 common/cmd_efi.c                     | 257 ++++++++++++++++++++++++
 config.mk                            |   2 -
 configs/efi-x86_defconfig            |  16 ++
 doc/README.efi                       | 237 ++++++++++++++++++++++
 drivers/core/uclass.c                |   2 +
 drivers/gpio/intel_ich6_gpio.c       |   2 +
 drivers/pci/pci_auto.c               |  52 ++---
 drivers/serial/Kconfig               |   9 +
 drivers/serial/Makefile              |   1 +
 drivers/serial/serial-uclass.c       |   2 +-
 drivers/serial/serial_efi.c          | 157 +++++++++++++++
 drivers/video/vesa_fb.c              |   8 +
 include/asm-generic/global_data.h    |   3 +-
 include/common.h                     |   7 +
 include/configs/efi-x86.h            |  34 ++++
 include/efi.h                        | 368 +++++++++++++++++++++++++++++++++++
 include/efi_api.h                    | 244 +++++++++++++++++++++++
 include/elf.h                        |  26 +++
 include/linux/types.h                |   6 +-
 include/part_efi.h                   |   9 +-
 lib/Kconfig                          |   2 +
 lib/Makefile                         |   1 +
 lib/efi/Kconfig                      |  54 +++++
 lib/efi/Makefile                     |  17 ++
 lib/efi/efi.c                        | 101 ++++++++++
 lib/efi/efi_app.c                    | 139 +++++++++++++
 lib/efi/efi_info.c                   |  47 +++++
 lib/efi/efi_stub.c                   | 363 ++++++++++++++++++++++++++++++++++
 lib/initcall.c                       |   4 +
 scripts/Makefile.lib                 |   3 +-
 85 files changed, 3329 insertions(+), 181 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 include/efi.h
 create mode 100644 include/efi_api.h
 create mode 100644 lib/efi/Kconfig
 create mode 100644 lib/efi/Makefile
 create mode 100644 lib/efi/efi.c
 create mode 100644 lib/efi/efi_app.c
 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