Skip to content

test: spl: Test some load methods

Sean Anderson u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest29 patches 13 repliesIn review
  2. v126 patches 56 repliesSuperseded

Changes in v2 from the cover letter · 23 lines

- Use "address of" to describe the "&" operator
- Remove check for zero entry point in spl_load_fit_image
- Use log_err for errors in read_auth_container
- Clarify commit message for patch "Check header before calling spl_load_imx_container"
- Hide SPL_OF_REAL unless SANDBOX is enabled
- Disable sandbox filesystem in SPL instead of compiling it in
- Split ext4 defines into their own commit
- Use SPL_TPL_ for compiling fastboot functions
- Use callbacks to invalidate SPL caches instead of disabling them entirely
- Split off -T support into its own commit
- Compare to PHASE_SPL in sandbox_cmdline_cb_test_fdt for clarity
- Remove redundant condition on CONFIG_SPL_UT_LOAD in test/image/Makefile
- Remove unused mapmem.h include in spl_load_os.c
- Fix size not being updated in board_spl_fit_buffer_addr
- Fix return value documentation for check_image_info
- Explicitly invalidate FAT block device cache before testing
- Remove unused dm.h include in spl_load.c
- Add note about why we enable SPL_TIMER
- Explicitly invalidate FAT block device cache before testing
- Correct return value documentation for do_spl_test_load
- Explicitly invalidate FAT and MMC caches before testing
- Add a comment about why we need to initialize bi_dram
- Clarify generation process for LZMA data

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/29spl: legacy: Fix referencing _image_binary_endcommon/spl/spl_legacy.c+1 -10 replies
2/29spl: nor: Don't allocate header on stackcommon/spl/spl_nor.c+4 -70 replies
3/29spl: fit: Fix entry point for SPL_LOAD_FIT_FULLcommon/spl/spl_fit.c+2 -10 replies
4/29arm: imx: Fix i.MX8 container load addressarch/arm/mach-imx/parse-container.c+1 -10 replies
5/29arm: imx: Add newlines after error messagesarch/arm/mach-imx/parse-container.c+2 -20 replies
6/29arm: imx: Use log_err for errors in read_auth_containerarch/arm/mach-imx/parse-container.c+3 -20 replies
7/29arm: imx: Add function to validate i.MX8 containersarch/arm/include/asm/mach-imx/image.h arch/arm/mach-imx/ele_ahab.c arch/arm/mach-imx/image-container.c +3 more+15 -50 replies
8/29arm: imx: Check header before calling spl_load_imx_containerMAINTAINERS arch/arm/include/asm/mach-imx/ahab.h arch/arm/mach-imx/cmd_dek.c +15 more+34 -140 replies
9/29Move i.MX8 container image loading support to common/splMAINTAINERS arch/arm/mach-imx/Kconfig arch/arm/mach-imx/Makefile +3 more+17 -140 replies
10/29spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same timedrivers/core/Makefile drivers/i2c/i2c-emul-uclass.c drivers/serial/sandbox.c +3 more+10 -70 replies
11/29lib: acpi: Fix linking SPL when ACPIGEN is enableddrivers/core/root.c drivers/i2c/Makefile+2 -20 replies
12/29fs: Disable sandbox filesystem in SPLfs/fs.c+1 -13 replies
13/29fs: ext4: Fix building ext4 in SPL if write is enabledcommon/spl/Kconfig lib/Kconfig lib/Makefile+8 -00 replies
14/29fs: ext4: Add some defines for testinginclude/ext4fs.h include/ext_common.h+15 -01 reply
15/29net: Fix compiling SPL when fastboot is enablednet/Makefile net/net.c+4 -40 replies
16/29net: bootp: Move port numbers to headernet/bootp.c net/bootp.h+3 -32 replies
17/29net: bootp: Fall back to BOOTP from DHCP when unit testingnet/bootp.c+6 -04 replies
18/29spl: Add callbacks to invalidate cached devicescommon/spl/spl_fat.c common/spl/spl_mmc.c include/spl.h+34 -10 replies
19/29spl: Use map_sysmem where appropriatecommon/spl/spl.c common/spl/spl_blk_fs.c common/spl/spl_ext.c +8 more+69 -350 replies
20/29sandbox: Support -T in splarch/sandbox/cpu/start.c+7 -21 reply
21/29test: spl: Split tests up and use some configstest/Kconfig test/Makefile test/image/Kconfig +3 more+106 -790 replies
22/29test: spl: Fix spl_test_load not failing if fname doesn't existconfigs/sandbox_vpl_defconfig test/image/spl_load_os.c+3 -40 replies
23/29test: spl: Add functions to create images.azure-pipelines.yml .gitlab-ci.yml arch/sandbox/cpu/u-boot-spl.lds +5 more+493 -30 replies
24/29test: spl: Add functions to create filesystemsconfigs/sandbox_noinst_defconfig include/test/spl.h test/image/Kconfig +2 more+328 -01 reply
25/29test: spl: Add a test for spl_blk_load_imageconfigs/sandbox_noinst_defconfig test/image/Kconfig test/image/spl_load_fs.c+67 -10 replies
26/29test: spl: Add a test for the MMC load methodconfigs/sandbox_noinst_defconfig include/spl.h include/test/spl.h +3 more+137 -50 replies
27/29test: spl: Add a test for the NET load methodarch/sandbox/cpu/spl.c arch/sandbox/include/asm/spl.h configs/sandbox_noinst_defconfig +3 more+272 -10 replies
28/29test: spl: Add a test for the NOR load methodarch/sandbox/include/asm/spl.h configs/sandbox_noinst_defconfig configs/sandbox_spl_defconfig +5 more+316 -60 replies
29/29test: spl: Add a test for the SPI load methodarch/sandbox/include/asm/spl.h configs/sandbox_noinst_defconfig include/spl.h +5 more+78 -00 replies

Reviews trailers per patch

22 of 29 patches have a Reviewed-by or Acked-by.

PatchSimon GlassTom RiniHeinrich SchuchardtMichael Trimarchi
1/29R-b
2/29R-b R-b
3/29R-b
4/29
5/29
6/29
7/29
8/29
9/29
10/29R-b
11/29R-b
12/29R-b
13/29R-b
14/29R-b
15/29R-b R-b
16/29R-b R-b
17/29R-b
18/29
19/29R-b
20/29R-b
21/29R-b
22/29R-b
23/29R-b
24/29R-b
25/29R-b
26/29R-b
27/29R-b
28/29R-b
29/29R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/29] test: spl: Test some load methods

This series adds some tests for various SPL load methods, with the intent of helping debug v6 of [1]. With that in mind, notable omissions include NAND and ROMAPI, which both lack sandbox implementations, and OS_BOOT, which I have deferred due to its complexity. Semihosting is also omitted, but I think we can test that with qemu.

In order to test all of these methods, we must first generate suitable images, possibly on filesystems. While other tests have historically generated these images using external tools (e.g. mkimage, mkfs, etc.), I have chosen to generate them on the fly. This is for a few reasons:

- By removing external dependencies on pytest to create certain files, the tests become self-contained. This makes them easier to iterate on and debug.
- By generating tests at runtime, we can dynamically vary the content. This helps detect test failures, as even if tests are loaded to the same location, the expected content will be different.
- We are not testing the image parsers themselves (e.g. spl_load_simple_fit or fs_read) but rather the load methods (e.g. spl_mmc_load_image). It is unnecessary to exercise full functionality or generate 100% correct images.
- By reducing functionality to only what is necessary, the complexity of various formats can often be greatly reduced.

This series depends on [2-3], which are small fixes identified through this patch set. The organization of patches in this series is as follows:

- General fixes for bugs which are unlikely to be triggered outside of this series
- Changes to IMX8 container images to facilitate testing
- General prep. work, particularly regarding linker issues
- The tests themselves

Passing CI at [4].

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
[4] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18128

Changes in v2:
- Use "address of" to describe the "&" operator
- Remove check for zero entry point in spl_load_fit_image
- Use log_err for errors in read_auth_container
- Clarify commit message for patch "Check header before calling spl_load_imx_container"
- Hide SPL_OF_REAL unless SANDBOX is enabled
- Disable sandbox filesystem in SPL instead of compiling it in
- Split ext4 defines into their own commit
- Use SPL_TPL_ for compiling fastboot functions
- Use callbacks to invalidate SPL caches instead of disabling them entirely
- Split off -T support into its own commit
- Compare to PHASE_SPL in sandbox_cmdline_cb_test_fdt for clarity
- Remove redundant condition on CONFIG_SPL_UT_LOAD in test/image/Makefile
- Remove unused mapmem.h include in spl_load_os.c
- Fix size not being updated in board_spl_fit_buffer_addr
- Fix return value documentation for check_image_info
- Explicitly invalidate FAT block device cache before testing
- Remove unused dm.h include in spl_load.c
- Add note about why we enable SPL_TIMER
- Explicitly invalidate FAT block device cache before testing
- Correct return value documentation for do_spl_test_load
- Explicitly invalidate FAT and MMC caches before testing
- Add a comment about why we need to initialize bi_dram
- Clarify generation process for LZMA data

Sean Anderson (29):
spl: legacy: Fix referencing _image_binary_end
spl: nor: Don't allocate header on stack
spl: fit: Fix entry point for SPL_LOAD_FIT_FULL
arm: imx: Fix i.MX8 container load address
arm: imx: Add newlines after error messages
arm: imx: Use log_err for errors in read_auth_container
arm: imx: Add function to validate i.MX8 containers
arm: imx: Check header before calling spl_load_imx_container Move i.MX8 container image loading support to common/spl
spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same time
lib: acpi: Fix linking SPL when ACPIGEN is enabled
fs: Disable sandbox filesystem in SPL
fs: ext4: Fix building ext4 in SPL if write is enabled
fs: ext4: Add some defines for testing
net: Fix compiling SPL when fastboot is enabled
net: bootp: Move port numbers to header
net: bootp: Fall back to BOOTP from DHCP when unit testing
spl: Add callbacks to invalidate cached devices
spl: Use map_sysmem where appropriate
sandbox: Support -T in spl
test: spl: Split tests up and use some configs
test: spl: Fix spl_test_load not failing if fname doesn't exist
test: spl: Add functions to create images
test: spl: Add functions to create filesystems
test: spl: Add a test for spl_blk_load_image
test: spl: Add a test for the MMC load method
test: spl: Add a test for the NET load method
test: spl: Add a test for the NOR load method
test: spl: Add a test for the SPI load method

 .azure-pipelines.yml                          |   4 +
 .gitlab-ci.yml                                |   7 +
 MAINTAINERS                                   |   2 +
 arch/arm/include/asm/mach-imx/ahab.h          |   2 +-
 arch/arm/mach-imx/Kconfig                     |  13 -
 arch/arm/mach-imx/Makefile                    |   2 +-
 arch/arm/mach-imx/cmd_dek.c                   |   4 +-
 arch/arm/mach-imx/ele_ahab.c                  |   4 +-
 arch/arm/mach-imx/image-container.c           |   4 +-
 arch/arm/mach-imx/imx8/ahab.c                 |   4 +-
 arch/arm/mach-imx/spl_imx_romapi.c            |   8 +-
 arch/sandbox/cpu/spl.c                        |   4 +
 arch/sandbox/cpu/start.c                      |   9 +-
 arch/sandbox/cpu/u-boot-spl.lds               |   2 +
 arch/sandbox/include/asm/spl.h                |   3 +
 common/spl/Kconfig                            |  15 +
 common/spl/Makefile                           |   1 +
 common/spl/spl.c                              |   4 +-
 common/spl/spl_blk_fs.c                       |   6 +-
 common/spl/spl_ext.c                          |   4 +-
 common/spl/spl_fat.c                          |  16 +-
 common/spl/spl_fit.c                          |  39 +-
 .../spl/spl_imx_container.c                   |  13 +-
 common/spl/spl_legacy.c                       |   8 +-
 common/spl/spl_mmc.c                          |  16 +-
 common/spl/spl_nand.c                         |   4 +-
 common/spl/spl_net.c                          |  10 +-
 common/spl/spl_nor.c                          |  18 +-
 common/spl/spl_spi.c                          |  18 +-
 configs/deneb_defconfig                       |   2 +
 configs/giedi_defconfig                       |   2 +
 configs/imx8qm_mek_defconfig                  |   2 +
 configs/imx8qxp_mek_defconfig                 |   2 +
 configs/sandbox_noinst_defconfig              |  31 +-
 configs/sandbox_spl_defconfig                 |   8 +
 configs/sandbox_vpl_defconfig                 |   1 +
 drivers/core/Makefile                         |   1 +
 drivers/core/root.c                           |   2 +-
 drivers/i2c/Makefile                          |   2 +-
 drivers/i2c/i2c-emul-uclass.c                 |   2 +-
 drivers/serial/sandbox.c                      |   2 +-
 drivers/sysreset/sysreset_sandbox.c           |   2 +-
 drivers/usb/gadget/f_sdp.c                    |   4 +-
 dts/Kconfig                                   |   8 +-
 fs/fs.c                                       |   2 +-
 include/configs/sandbox.h                     |   3 +
 include/ext4fs.h                              |   1 +
 include/ext_common.h                          |  14 +
 .../image.h => include/imx_container.h        |   9 +
 include/spl.h                                 |  36 +
 include/test/spl.h                            | 155 ++++
 lib/Kconfig                                   |   6 +
 lib/Makefile                                  |   1 +
 net/Makefile                                  |   4 +-
 net/bootp.c                                   |   9 +-
 net/bootp.h                                   |   3 +
 net/net.c                                     |   4 +-
 test/Kconfig                                  |   1 +
 test/Makefile                                 |   5 +-
 test/image/Kconfig                            |  50 ++
 test/image/Makefile                           |   7 +-
 test/image/spl_load.c                         | 690 ++++++++++++++++--
 test/image/spl_load_fs.c                      | 428 +++++++++++
 test/image/spl_load_net.c                     | 252 +++++++
 test/image/spl_load_nor.c                     |  39 +
 test/image/spl_load_os.c                      |  76 ++
 test/image/spl_load_spi.c                     |  41 ++
 test/py/tests/test_spl.py                     |  10 +
 test/test-main.c                              |   2 +-
 69 files changed, 2000 insertions(+), 163 deletions(-)
 rename arch/arm/mach-imx/parse-container.c => common/spl/spl_imx_container.c (91%)
 rename arch/arm/include/asm/mach-imx/image.h => include/imx_container.h (82%)
 create mode 100644 include/test/spl.h
 create mode 100644 test/image/Kconfig
 create mode 100644 test/image/spl_load_fs.c
 create mode 100644 test/image/spl_load_net.c
 create mode 100644 test/image/spl_load_nor.c
 create mode 100644 test/image/spl_load_os.c
 create mode 100644 test/image/spl_load_spi.c
Signature · 1 line
2.37.1