[PATCH v4 0/9] spl: Use common function for loading/parsing images
Sean Anderson
sean.anderson at seco.com
Mon Jul 24 19:12:47 CEST 2023
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: 356/-260 (96)
Function old new delta
spl_load - 308 +308
spl_fit_read 60 104 +44
spl_load_image_ext 364 368 +4
spl_nor_load_image 120 108 -12
spl_load_image_fat 320 256 -64
spl_spi_load_image 304 236 -68
spl_mmc_load 716 600 -116
Total: Before=233350, After=233446, chg +0.04%
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 +100
bytes. However, in the worst case this series will add 300 bytes.
I have only tested EXT, FAT, and MMC raw loaders. Please try booting
your favorite board with NOR/SPI flash or SPI falcon mode.
Changes in v4:
- Fix format specifiers in debug prints
- Reword/fix some of the doc comments for spl_load
- Rebase on u-boot/master
Changes in v3:
- Fix using ffs instead of fls
- Fix using not initializing bl_len when info->filename was NULL
- Fix failing on success
Changes in v2:
- Use reverse-xmas-tree style for locals in spl_simple_read. This is not
complete, since overhead depends on bl_mask.
- Convert semihosting as well
- Consolidate spi_load_image_os into spl_spi_load_image
Sean Anderson (9):
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 semihosting to spl_load
spl: Convert spi to spl_load
spl: spi: Consolidate spi_load_image_os into spl_spi_load_image
common/spl/spl.c | 68 ++++++++++++++++++
common/spl/spl_ext.c | 24 +++++--
common/spl/spl_fat.c | 40 +++--------
common/spl/spl_mmc.c | 73 ++-----------------
common/spl/spl_net.c | 24 ++-----
common/spl/spl_nor.c | 39 ++--------
common/spl/spl_semihosting.c | 39 +++++-----
common/spl/spl_spi.c | 136 ++++++++++-------------------------
include/spl.h | 29 +++++++-
9 files changed, 192 insertions(+), 280 deletions(-)
--
2.35.1.1320.gc452695387.dirty
More information about the U-Boot
mailing list