Skip to content

spl: Use common function for loading/parsing images

Sean Anderson u-boot 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 8 repliesIn review
  2. v29 patches 7 repliesSuperseded
  3. v1 RFC7 patches 10 repliesSuperseded

Changes in v3 from the cover letter

- Fix using ffs instead of fls
- Fix using not initializing bl_len when info->filename was NULL
- Fix failing on success

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9spl: Add generic spl_load functioncommon/spl/spl.c include/spl.h+97 -12 replies
2/9spl: Convert ext to use spl_loadcommon/spl/spl_ext.c+17 -70 replies
3/9spl: Convert fat to spl_loadcommon/spl/spl_fat.c+8 -321 reply
4/9spl: Convert mmc to spl_loadcommon/spl/spl_mmc.c+6 -671 reply
5/9spl: Convert net to spl_loadcommon/spl/spl_net.c+5 -191 reply
6/9spl: Convert nor to spl_loadcommon/spl/spl_nor.c+6 -290 replies
7/9spl: Convert semihosting to spl_loadcommon/spl/spl_semihosting.c+16 -230 replies
8/9spl: Convert spi to spl_loadcommon/spl/spl_spi.c+7 -412 replies
9/9spl: spi: Consolidate spi_load_image_os into spl_spi_load_imagecommon/spl/spl_spi.c+33 -540 replies

Reviews trailers per patch

7 of 9 patches have a Reviewed-by or Acked-by.

PatchStefan RoeseTom Rini
1/9R-b
2/9R-b
3/9R-b T-b
4/9R-b T-b
5/9R-b
6/9R-b
7/9
8/9R-b
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/9] spl: Use common function for loading/parsing images

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/-236 (-12)

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     228     -52
spl_load_image_fat                           320     264     -56
spl_mmc_load                                 716     600    -116

Total: Before=264556, After=264544, 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 have only tested EXT and MMC raw loaders. Please try booting your favorite board with NOR/SPI flash or SPI falcon mode.

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         |  35 ++--------
 common/spl/spl_semihosting.c |  39 +++++------
 common/spl/spl_spi.c         | 131 ++++++++++-------------------------
 include/spl.h                |  30 +++++++-
 9 files changed, 193 insertions(+), 271 deletions(-)
Signature · 1 line
2.35.1.1320.gc452695387.dirty