public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v5 00/30] EFI payload / application support
@ 2016-03-04  0:09 Alexander Graf
  2016-03-04  0:09 ` [U-Boot] [PATCH v5 01/30] thunderx: Calculate TCR dynamically Alexander Graf
                   ` (30 more replies)
  0 siblings, 31 replies; 67+ messages in thread
From: Alexander Graf @ 2016-03-04  0:09 UTC (permalink / raw)
  To: u-boot

This is my (now very late) Christmas present for my openSUSE friends :).

U-Boot is a great project for embedded devices. However, convincing
everyone involved that only for "a few oddball ARM devices" we need to
support different configuration formats from grub2 when all other platforms
(PPC, System Z, x86) are standardized on a single format is a nightmare.

So we started to explore alternatives. At first, people tried to get
grub2 running using the u-boot api interface. However, that one didn't
support relocations, so you had to know where to link grub2 to at compile
time. It also seems to be broken more often than not. And on top of it all,
it's a one-off interface, so yet another thing to maintain.

That led to a nifty idea. What if we can just implement the EFI application
protocol on top of U-Boot? Then we could compile a single grub2 binary for
uEFI based systems and U-Boot based systems and as soon as that one's loaded,
everything looks and feels (almost) the same.

This patch set is the result of pursuing this endeavor.

  - I am successfully able to run grub2 and Linux EFI binaries with this code.
  - When enabled, the resulting U-Boot binary only grows by ~10kb,
    so it's very light weight.
  - It works on 32bit ARM and AArch64. 
  - All storage devices are directly accessible
  - No EFI variables
  - Removable media booting (search for /efi/boot/boota{a64,arm}.efi)
  - Everything in place for runtime service support

Of course, there are still a few things one could do on top:

  - Improve disk media detection (don't scan, use what information we have)
  - Add EFI variable support using NVRAM
  - Add GFX support
  - Make EFI Shell work ;)
  - Network device support
  - Support for payload exit

But so far, I'm very happy with the state of the patches. They completely
eliminate potential arguments against U-Boot internally and give users the
chance to run with the same level of comfort on all firmware types.

Version 5 was successfully tested to boot grub2 and Linux from there on a
beagle-xm. Please apply the arm64 mmu patch set if you want to run this on an
AArch64 system.

If you read this far and want to try out the patches, feel free to grab
the source from git at:

  https://github.com/agraf/u-boot efi-v5

v1 -> v2:
  - move memory allocation to separate patch
  - limit 32/64 to hosts that support it
  - check 32bit optional nt header magic
  - switch to GPLv2+
  - Fix typo s/does now/does not/
  - Add #ifdefs around header to allow inclusion when efi_loader is disabled
  - Add stub efi_restore_gd() function when efi_loader is disabled
  - Disable debug
  - Mark runtime region as such
  - Fix up memory map
  - Allow efi_restore_gd to be called before first efi entry
  - Add 32bit arm cache workaround
  - Move memory map to separate patch
  - Change BTS version to 2.5
  - Fix return values for a few callbacks to more EFI compliant ones
  - Change vendor to "Das U-Boot"
  - Add warning when truncating timer trigger
  - Add runtime detach
  - Enable runtime relocations
  - Add get_time
  - Fix relocation
  - Fix 32bit
  - Add am335x support
  - Move section definition to header
  - Add systab to runtime section
  - Add self-relocation hook table
  - Relocate efi_runtime section early during bootup
  - Fix return values for a number of callbacks to be more UEFI compliant
  - Move to block_drvr array
  - Fix header order
  - Document efi block object struct
  - Use calloc rather than malloc & memset
  - Default to y
  - New patches: 
    - disk/part.c: Expose list of available block drivers
    - arm64: Allow exceptions to return
    - arm64: Allow EFI payload code to take exceptions
    - efi_loader: Add DCACHE_OFF support for arm64
    - efi_loader: Add distro boot script for removable media

v2 -> v3:

  - Add EFIAPI to notify_function
  - Add access denied code
  - use efi_alloc
  - add EFIAPI to function prototypes
  - remove unused macros
  - reorder header inclusion
  - split relocation code into function
  - flush cache after loading
  - Use external efi_memory helpers
  - Add EFIAPI to function prototypes
  - Initialize event timer to -1ULL to prevent early firing
  - Document header
  - Move obj list to lib
  - Remove implicit guid table
  - Add guid compare function
  - Fix return values
  - Implement efi_wait_for_event
  - Add EFIAPI to function prototypes
  - Patch reset to NULL
  - Add EFIAPI to function prototypes
  - Document header
  - Add dm.h include
  - Remove non-dm rtc support
  - Return DEVICE_ERROR in rtc path
  - Adapt to newer u-boot block API
  - Add EFIAPI to function prototypes
  - Document header
  - Check for DEV_TYPE_UNKNOWN
  - Document 16byte limit for dp string
  - Move to new cmd directory
  - Add kconfig option
  - Fix comment style
  - Add help text
  - s/-1/-ENOENT
  - Move obj list to lib
  - Rewrite memory allocation and map
  - Document header
  - Add memory file
  - New files:
    - README patch
    - MAINTAINERS patch

v3 -> v4:

  - Add EFI_PAGE_MASK define
  - Use EFI_PAGE_SHIFT define
  - Flush icache after image load
  - Fix white space in pe header
  - s/polimorphic/polymorphic
  - return EFI_SUCCESS in efi_cout_enable_cursor()
  - Use EFI_PAGE_.* defines
  - Return EFI_OUT_OF_RESOURCES in efi_allocate_pages
  - Add readme section about config options
  - s/10kb/10KB/

v4 -> v5:

  - Provide icache flush stub for archs which don't have it
  - Mark fdt memory as boot services data
  - new patch: arm64: Replace fdt_name env variables with fdtfile
  - new patch: arm: Allow EFI payload code to take exceptions
  - new patch: efi_loader: Call fdt preparation functions
  - new patch: efi_loader: Pass proper device path in on boot
  - PoC converted JeOS-beagle and JeOS-beaglebone images to EFI
    -> http://download.opensuse.org/repositories/home:/algraf:/arm-efi/images/

Alexander Graf (30):
  thunderx: Calculate TCR dynamically
  arm64: Disable TTBR1 maps in EL1
  arm64: Make full va map code more dynamic
  thunderx: Move mmu table into board file
  zymqmp: Replace home grown mmu code with generic table approach
  tegra: Replace home grown mmu code with generic table approach
  vexpress64: Add MMU tables
  dwmmc: Increase retry timeout
  hikey: Add MMU tables
  arm64: Remove non-full-va map code
  arm64: Only allow dcache disabled in SPL builds
  disk/part.c: Expose list of available block drivers
  include/efi_api.h: Add more detailed API definitions
  efi_loader: Add PE image loader
  efi_loader: Add boot time services
  efi_loader: Add console interface
  efi_loader: Add runtime services
  efi_loader: Add disk interfaces
  efi_loader: Add "bootefi" command
  efi_loader: Implement memory allocation and map
  arm64: Allow exceptions to return
  arm64: Allow EFI payload code to take exceptions
  efi_loader: hook up in build environment
  efi_loader: Add distro boot script for removable media
  efi_loader: Add README section in README.efi
  efi_loader: Add MAINTAINERS entry
  arm64: Replace fdt_name env variables with fdtfile
  arm: Allow EFI payload code to take exceptions
  efi_loader: Call fdt preparation functions
  efi_loader: Pass proper device path in on boot

 MAINTAINERS                                    |   7 +
 arch/arm/config.mk                             |   4 +
 arch/arm/cpu/armv8/cache.S                     |  54 ++
 arch/arm/cpu/armv8/cache_v8.c                  | 551 +++++++++++++----
 arch/arm/cpu/armv8/exceptions.S                |  34 ++
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c        |  37 +-
 arch/arm/cpu/armv8/u-boot.lds                  |  16 +
 arch/arm/cpu/armv8/zynqmp/cpu.c                | 217 ++-----
 arch/arm/cpu/u-boot.lds                        |  30 +
 arch/arm/include/asm/arch-fsl-layerscape/cpu.h |  94 +--
 arch/arm/include/asm/armv8/mmu.h               | 123 +---
 arch/arm/include/asm/global_data.h             |   7 +-
 arch/arm/include/asm/system.h                  |  12 +-
 arch/arm/lib/interrupts.c                      |   8 +
 arch/arm/lib/interrupts_64.c                   |   9 +
 arch/arm/lib/sections.c                        |   4 +
 arch/arm/mach-tegra/arm64-mmu.c                | 132 +----
 board/armltd/vexpress64/vexpress64.c           |  21 +
 board/cavium/thunderx/thunderx.c               |  24 +
 board/hisilicon/hikey/hikey.c                  |  21 +
 board/ti/am335x/u-boot.lds                     |  30 +
 cmd/Kconfig                                    |   7 +
 cmd/Makefile                                   |   1 +
 cmd/bootefi.c                                  | 202 +++++++
 cmd/fs.c                                       |   2 +
 common/board_r.c                               |   7 +
 common/image-fdt.c                             |   8 +-
 disk/part.c                                    |   7 +-
 doc/README.arm64                               |  20 -
 doc/README.efi                                 |  83 ++-
 drivers/mmc/dw_mmc.c                           |   2 +-
 include/config_distro_bootcmd.h                |  47 +-
 include/configs/hikey.h                        |   6 +-
 include/configs/thunderx_88xx.h                |  30 -
 include/configs/vexpress_aemv8a.h              |  15 +-
 include/efi.h                                  |   2 +
 include/efi_api.h                              | 198 +++++--
 include/efi_loader.h                           | 157 +++++
 include/part.h                                 |   8 +
 include/pe.h                                   | 263 +++++++++
 lib/Kconfig                                    |   1 +
 lib/Makefile                                   |   1 +
 lib/efi_loader/Kconfig                         |   9 +
 lib/efi_loader/Makefile                        |  12 +
 lib/efi_loader/efi_boottime.c                  | 781 +++++++++++++++++++++++++
 lib/efi_loader/efi_console.c                   | 360 ++++++++++++
 lib/efi_loader/efi_disk.c                      | 212 +++++++
 lib/efi_loader/efi_image_loader.c              | 188 ++++++
 lib/efi_loader/efi_memory.c                    | 319 ++++++++++
 lib/efi_loader/efi_runtime.c                   | 290 +++++++++
 50 files changed, 4003 insertions(+), 670 deletions(-)
 create mode 100644 cmd/bootefi.c
 create mode 100644 include/efi_loader.h
 create mode 100644 include/pe.h
 create mode 100644 lib/efi_loader/Kconfig
 create mode 100644 lib/efi_loader/Makefile
 create mode 100644 lib/efi_loader/efi_boottime.c
 create mode 100644 lib/efi_loader/efi_console.c
 create mode 100644 lib/efi_loader/efi_disk.c
 create mode 100644 lib/efi_loader/efi_image_loader.c
 create mode 100644 lib/efi_loader/efi_memory.c
 create mode 100644 lib/efi_loader/efi_runtime.c

-- 
1.8.5.6

^ permalink raw reply	[flat|nested] 67+ messages in thread

end of thread, other threads:[~2016-03-17  2:03 UTC | newest]

Thread overview: 67+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04  0:09 [U-Boot] [PATCH v5 00/30] EFI payload / application support Alexander Graf
2016-03-04  0:09 ` [U-Boot] [PATCH v5 01/30] thunderx: Calculate TCR dynamically Alexander Graf
2016-03-17  1:59   ` [U-Boot] [U-Boot,v5,01/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 02/30] arm64: Disable TTBR1 maps in EL1 Alexander Graf
2016-03-17  1:59   ` [U-Boot] [U-Boot,v5,02/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 03/30] arm64: Make full va map code more dynamic Alexander Graf
2016-03-17  1:59   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 04/30] thunderx: Move mmu table into board file Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 05/30] zymqmp: Replace home grown mmu code with generic table approach Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 06/30] tegra: " Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 07/30] vexpress64: Add MMU tables Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot,v5,07/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 08/30] dwmmc: Increase retry timeout Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot,v5,08/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 09/30] hikey: Add MMU tables Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot,v5,09/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 10/30] arm64: Remove non-full-va map code Alexander Graf
2016-03-17  2:00   ` [U-Boot] [U-Boot,v5,10/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 11/30] arm64: Only allow dcache disabled in SPL builds Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 12/30] disk/part.c: Expose list of available block drivers Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 13/30] include/efi_api.h: Add more detailed API definitions Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 14/30] efi_loader: Add PE image loader Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot,v5,14/30] " Tom Rini
2016-03-04  0:09 ` [U-Boot] [PATCH v5 15/30] efi_loader: Add boot time services Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot,v5,15/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 16/30] efi_loader: Add console interface Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot,v5,16/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 17/30] efi_loader: Add runtime services Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot,v5,17/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 18/30] efi_loader: Add disk interfaces Alexander Graf
2016-03-17  2:01   ` [U-Boot] [U-Boot,v5,18/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 19/30] efi_loader: Add "bootefi" command Alexander Graf
2016-03-09 23:27   ` [U-Boot] [PATCH v6 " Alexander Graf
2016-03-17  2:01     ` [U-Boot] [U-Boot,v6,19/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 20/30] efi_loader: Implement memory allocation and map Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 21/30] arm64: Allow exceptions to return Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot,v5,21/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 22/30] arm64: Allow EFI payload code to take exceptions Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 23/30] efi_loader: hook up in build environment Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 24/30] efi_loader: Add distro boot script for removable media Alexander Graf
2016-03-09 23:05   ` Alexander Graf
2016-03-09 23:16     ` Tom Rini
2016-03-09 23:26       ` [U-Boot] [PATCH v6 " Alexander Graf
2016-03-17  2:02         ` [U-Boot] [U-Boot, v6, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 25/30] efi_loader: Add README section in README.efi Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 26/30] efi_loader: Add MAINTAINERS entry Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot,v5,26/30] " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 27/30] arm64: Replace fdt_name env variables with fdtfile Alexander Graf
2016-03-17  2:02   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 28/30] arm: Allow EFI payload code to take exceptions Alexander Graf
2016-03-17  2:03   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 29/30] efi_loader: Call fdt preparation functions Alexander Graf
2016-03-17  2:03   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  0:10 ` [U-Boot] [PATCH v5 30/30] efi_loader: Pass proper device path in on boot Alexander Graf
2016-03-17  2:03   ` [U-Boot] [U-Boot, v5, " Tom Rini
2016-03-04  9:19 ` [U-Boot] [PATCH] efi_loader: Reserve 2 additional pages for fdt Alexander Graf
2016-03-04  9:41   ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox