[U-Boot] [RFC PATCH 00/11] extend FIT loading support (plus Pine64/ATF support)

Andrew F. Davis afd at ti.com
Fri Jan 20 18:02:19 CET 2017


On 01/19/2017 07:53 PM, Andre Przywara wrote:
> Currently the FIT format is not used to its full potential in the SPL:
> It only loads the first image from the /images node and appends the
> proper FDT.
> Some boards and platforms would benefit from loading more images before
> starting U-Boot proper, notably Allwinner A64 and ARMv8 Rockchip boards,
> which use an ARM Trusted Firmware (ATF) image to be executed before U-Boot.
> 
> This series tries to solve this in a board agnostic and generic way:
> We extend the SPL FIT loading scheme to allow loading multiple images.
> So apart from loading the image which is referenced by the "firmware"
> property in the respective configuration node and placing the DTB right
> behind it, we iterate over all strings in the "loadable" property.
> Each image referenced there will be loaded to its specified load address.
> The entry point U-Boot eventually branches to will be taken from the
> first image to explicitly provide the "entry" property, or, if none
> of them does so, from the load address of the "firmware" image.
> This keeps the scheme compatible with the FIT images our Makefile creates
> automatically at the moment.
> 
> Apart from the already mentioned ATF scenario this opens up more usage
> scenarios, of which the commit message of patch 04/11 lists some.
> 

I have been thinking about a similar problem we are facing regarding
OP-TEE loading when doing SPL-only boots. I think extending SPL FIT
loader is a good approach, I've just been concerned about SPL bloat. On
our High Security enabled AM335x SoC we only have 41KB of SRAM to load
SPL (last I checked we only have 100 bytes of overhead left), and we
need FIT support as we use it for image authentication (it's what we use
the board_fit_image_post_process() hook for), so any changes to SPL FIT
need to be carefully made.

> The first three patches rework the SPL FIT support to be more flexible
> and to allow easier usage in the fourth patch, which introduces the
> multiple-image loading facility.
> The remaining patches enable that support for the Pine64 board to make
> its SPL support finally useful and to demonstrate usage of this scheme:
> patches 5-7 extend the usable SPL size by about 4 KB to allow AArch64
> compilation of the SPL with FIT support enabled. Patch 8 implements the
> board selector routine, which selects either the Pine64 or Pine64+ DTB
> depending on the detected DRAM size. Patch 9 enables SPL FIT support in
> the Pine64 defconfig.
> To demonstrate the usage, patch 10 provides a FIT source file, which
> loads and executes ATF before the U-Boot proper. Users are expected to
> compile this with "mkimage -f boards/sunxi/pine64_atf.its -E pine64.itb",
> then write the resulting file behind the SPL on an SD card (or any other
> U-Boot supported boot media, for that matter).
> Patch 11 then adds FIT support to the sunxi SPL SPI loading routine,
> which allows to load ATF on boards with SPI flash as well.
> 
> Questions:
> 1) Is this scheme the right one (usage of "firmware" and "loadables",
>    determination of entry point)? Shall we make use of the "setup"
>    property?
> 2) Shall we extend mkimage to allow supplying "loadable" files on the
>    command line, which would allow to build the .itb file automatically?

Where does this end, we may also need to add the load address for
images, etc... eventually we are passing a full .its on the command
line. I'm not against this, as it would help our build process also (we
generate an .its file with all our build artifacts during our distro
build and feed it to mkimage), so if we think this is better than option
3 below, we should think through all the things we may need before
cluttering up the mkimage command line arguments.

Andrew

> 3) Is providing the .its source file for a (family of) boards the right
>    way?
> 4) Does this break any boards which already use SPL FIT loading?
> 
> And for the Pine64 part:
> 5) Is extending the usable SPL size like in patch 5-7 acceptable?
> 
> I have a more generic solution for the .dtb selection in mind: Based on
> some patch from Siarhei we store the .dtb filename in the SPL header and
> select the .dtb from the FIT image by simply matching the name. This would
> allow _one_ build supporting multiple boards. The actual board name would
> need to written into the SPL header or could be copied from there when
> updating the image.
> I can provide the patches once we agreed upon this series.
> 
> Please let me know what you think!
> 
> Cheers,
> Andre.
> 
> Andre Przywara (11):
>   SPL: FIT: refactor FDT loading
>   SPL: FIT: rework U-Boot image loading
>   SPL: FIT: factor out spl_load_fit_image()
>   SPL: FIT: allow loading multiple images
>   tools: mksunxiboot: allow larger SPL binaries
>   sunxi: A64: SPL: allow large SPL binary
>   sunxi: A64: move SPL stack to end of SRAM A2
>   sunxi: SPL: add FIT config selector for Pine64 boards
>   sunxi: Pine64: defconfig: enable SPL FIT support
>   sunxi: Pine64: add FIT image source
>   SPL: SPI: sunxi: add SPL FIT image support
> 
>  board/sunxi/board.c             |  13 +++
>  board/sunxi/pine64_atf.its      |  54 +++++++++
>  common/spl/spl_fit.c            | 241 +++++++++++++++++++++++-----------------
>  configs/pine64_plus_defconfig   |   5 +
>  drivers/mtd/spi/sunxi_spi_spl.c |  39 +++++--
>  include/configs/sunxi-common.h  |   6 +-
>  scripts/Makefile.spl            |   7 +-
>  tools/mksunxiboot.c             |  51 ++++++---
>  8 files changed, 290 insertions(+), 126 deletions(-)
>  create mode 100644 board/sunxi/pine64_atf.its
> 


More information about the U-Boot mailing list