[RFC PATCH 0/7] spl: Use common function for loading/parsing images

Stefan Roese sr at denx.de
Wed Apr 6 07:26:41 CEST 2022


On 4/1/22 21:03, Sean Anderson wrote:
> This series adds support for loading all image types (Legacy, FIT (with
> and without LOAD_FIT_FULL), and i.MX) to the MMC, SPI, NOR, NET, FAT,
> and EXT load methods. It does this by introducing a helper function
> which handles the minutiae of invoking the proper parsing function, and
> reading the rest of the image.
> 
> Hopefully, this will make it easier for load methods to support all
> image types that U-Boot supports, without having undocumented
> unsupported image types. I applied this to several loaders which were
> invoking spl_load_simple_fit and/or spl_parse_image_header, but I did
> not use it with others (e.g. DFU/RAM) which had complications in the
> mix.
> 
> Here's some bloat-o-meter for j7200_evm_a72_defconfig with ext4 support
> enabled:
> 
> add/remove: 1/0 grow/shrink: 2/4 up/down: 224/-232 (-8)
> Function                                     old     new   delta
> spl_load                                       -     176    +176
> spl_fit_read                                  60     104     +44
> spl_load_image_ext                           364     368      +4
> spl_nor_load_image                           120     108     -12
> spl_spi_load_image                           280     232     -48
> spl_load_image_fat                           320     264     -56
> spl_mmc_load                                 712     596    -116
> Total: Before=264476, After=264468, chg -0.00%
> 
> ext4 support is +48 bytes, because the original image support was so
> bare-bones (just legacy/raw images). For most boards with a few load
> methods (where one of them isn't ext4), this series should be no bloat
> or a net negative. However, in the worst case this series will add
> 150-180 bytes.
> 
> I haven't tested most of this, so this series is marked RFC. I had a
> nand conversion in here as well, but dropped due to difficulties
> outlines in [1].
> 
> [1] https://lore.kernel.org/u-boot/c2ea7097-9e85-b9ec-e404-bd46eb83dd5b@seco.com/
> 
> 
> Sean Anderson (7):
>    spl: Add generic spl_load function
>    spl: Convert ext to use spl_load
>    spl: Convert fat to spl_load
>    spl: Convert mmc to spl_load
>    spl: Convert net to spl_load
>    spl: Convert nor to spl_load
>    spl: Convert spi to spl_load
> 
>   common/spl/spl.c     | 61 ++++++++++++++++++++++++++++++++++++
>   common/spl/spl_ext.c | 24 ++++++++++-----
>   common/spl/spl_fat.c | 36 ++++------------------
>   common/spl/spl_mmc.c | 73 ++++----------------------------------------
>   common/spl/spl_net.c | 24 +++------------
>   common/spl/spl_nor.c | 35 ++++-----------------
>   common/spl/spl_spi.c | 48 +++++------------------------
>   include/spl.h        | 30 +++++++++++++++++-
>   8 files changed, 137 insertions(+), 194 deletions(-)
> 

I like the idea of consolidating this SPL code a lot. Thanks for working
on this.

Thanks,
Stefan


More information about the U-Boot mailing list