• Andre Przywara's avatar
    fel: Add FIT image parsing and loading · 14b3492e
    Andre Przywara authored
    So far sunxi-fel expects a legacy U-Boot image after the SPL, when
    called with the "uboot" command.
    This only works for (current) 32-bit builds, which only need one image
    to load (U-Boot proper).
    
    64-bit builds also include at least a Trusted Firmware binary, and also
    might contain a firmware image for the ARISC management processor. So
    we use the more capable FIT image, which can contain multiple images
    to load.
    
    Introduce support for that, by adding code to parse a FIT image, find
    the image files included, and load them to their respective load
    addresses. On the way we keep track of the entry point, that only one of
    those images provides, and also note the architecture of this image
    (ARMv7 or AArch64).
    On top of that we detect which of the images is the actual U-Boot proper
    image, and append the chosen DTB to the end of it.
    
    This all mimics the code U-Boot's SPL uses to achieve the same goal when
    running from MMC or SPI flash, compare the implementation of
    spl_load_simple_fit() in U-Boot's common/spl/spl_fit.c:
    https://gitlab.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl_fit.c
    
    
    
    This requires the libfdt library for parsing the FIT image (which is in
    fact a devicetree blob).
    Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
    14b3492e
fit_image.c 7.42 KB