History log of /u-boot/test/image/spl_load.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 752ed086 27-Apr-2024 Tom Rini <trini@konsulko.com>

test: Remove <common.h> and add needed includes

Remove <common.h> from all "test/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 5b3debc6 08-Nov-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Support testing LEGACY_LZMA filesystem images

These will soon be supported, so we need to be able to test it. Export the
lzma data and generally use the same process in spl_test_mmc_fs as
do_spl_test_load. If we end up needing this in third place in the future,
it would probably be good to refactor things out.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5271e359 08-Nov-2023 Sean Anderson <seanga2@gmail.com>

spl: Only support bl_len when we have to

Aligning addresses and sizes causes overhead which is unnecessary when we
are not loading from block devices. Remove bl_len when it is not needed.

For example, on iot2050 we save 144 bytes with this patch (once the rest of
this series is applied):

add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144)
Function old new delta
spl_load_simple_fit 920 904 -16
load_simple_fit 496 444 -52
spl_spi_load_image 384 308 -76
Total: Before=87431, After=87287, chg -0.16%

We use panic() instead of BUILD_BUG_ON in spl_set_bl_len because we still
need to be able to compile it for things like mmc_load_image_raw_sector,
even if that function will not be used.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 60d76e33 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the SPI load method

Add test for the SPI load method. This one is pretty straightforward. We
can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image
doesn't know the total image size and has to guess from fdt_totalsize. This
doesn't include external data, so loading it will fail.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65efaac4 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the NOR load method

Add a test for the NOR load method. Since NOR is memory-mapped we can
substitute a buffer instead. The only major complication is testing LZMA
decompression. It's too complex to implement LZMA compression in a test, and we
have no in-tree compressor, so we just include some pre-compressed data. This
data was generated through something like

generate_data(plain, plain_size, "lzma")
cat plain.dat | lzma | hexdump -C

and was cleaned up further in my editor.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ba8ecaa 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the MMC load method

Add a test for the MMC load method. This shows the general shape of tests
to come: The main test function calls do_spl_test_load with an appropriate
callback to write the image to the medium.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b93cc1e7 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add functions to create images

This add some basic functions to create images, and a test for said
functions. This is not intended to be a test of the image parsing
functions, but rather a framework for creating minimal images for testing
load methods. That said, it does do an OK job at finding bugs in the image
parsing directly.

Since we have two methods for loading/parsing FIT images, add LOAD_FIT_FULL
as a separate CI run.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c56468a6 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 79e1d289 28-Feb-2022 Simon Glass <sjg@chromium.org>

sandbox: test: Tidy up spl_test_load() calls

Use the new sandbox_find_next_phase() function, which does what is needed
here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f178bebf 05-Jul-2021 Simon Glass <sjg@chromium.org>

sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5b3debc6 08-Nov-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Support testing LEGACY_LZMA filesystem images

These will soon be supported, so we need to be able to test it. Export the
lzma data and generally use the same process in spl_test_mmc_fs as
do_spl_test_load. If we end up needing this in third place in the future,
it would probably be good to refactor things out.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5271e359 08-Nov-2023 Sean Anderson <seanga2@gmail.com>

spl: Only support bl_len when we have to

Aligning addresses and sizes causes overhead which is unnecessary when we
are not loading from block devices. Remove bl_len when it is not needed.

For example, on iot2050 we save 144 bytes with this patch (once the rest of
this series is applied):

add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144)
Function old new delta
spl_load_simple_fit 920 904 -16
load_simple_fit 496 444 -52
spl_spi_load_image 384 308 -76
Total: Before=87431, After=87287, chg -0.16%

We use panic() instead of BUILD_BUG_ON in spl_set_bl_len because we still
need to be able to compile it for things like mmc_load_image_raw_sector,
even if that function will not be used.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 60d76e33 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the SPI load method

Add test for the SPI load method. This one is pretty straightforward. We
can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image
doesn't know the total image size and has to guess from fdt_totalsize. This
doesn't include external data, so loading it will fail.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65efaac4 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the NOR load method

Add a test for the NOR load method. Since NOR is memory-mapped we can
substitute a buffer instead. The only major complication is testing LZMA
decompression. It's too complex to implement LZMA compression in a test, and we
have no in-tree compressor, so we just include some pre-compressed data. This
data was generated through something like

generate_data(plain, plain_size, "lzma")
cat plain.dat | lzma | hexdump -C

and was cleaned up further in my editor.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ba8ecaa 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the MMC load method

Add a test for the MMC load method. This shows the general shape of tests
to come: The main test function calls do_spl_test_load with an appropriate
callback to write the image to the medium.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b93cc1e7 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add functions to create images

This add some basic functions to create images, and a test for said
functions. This is not intended to be a test of the image parsing
functions, but rather a framework for creating minimal images for testing
load methods. That said, it does do an OK job at finding bugs in the image
parsing directly.

Since we have two methods for loading/parsing FIT images, add LOAD_FIT_FULL
as a separate CI run.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c56468a6 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 79e1d289 28-Feb-2022 Simon Glass <sjg@chromium.org>

sandbox: test: Tidy up spl_test_load() calls

Use the new sandbox_find_next_phase() function, which does what is needed
here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f178bebf 05-Jul-2021 Simon Glass <sjg@chromium.org>

sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 60d76e33 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the SPI load method

Add test for the SPI load method. This one is pretty straightforward. We
can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image
doesn't know the total image size and has to guess from fdt_totalsize. This
doesn't include external data, so loading it will fail.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65efaac4 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the NOR load method

Add a test for the NOR load method. Since NOR is memory-mapped we can
substitute a buffer instead. The only major complication is testing LZMA
decompression. It's too complex to implement LZMA compression in a test, and we
have no in-tree compressor, so we just include some pre-compressed data. This
data was generated through something like

generate_data(plain, plain_size, "lzma")
cat plain.dat | lzma | hexdump -C

and was cleaned up further in my editor.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ba8ecaa 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add a test for the MMC load method

Add a test for the MMC load method. This shows the general shape of tests
to come: The main test function calls do_spl_test_load with an appropriate
callback to write the image to the medium.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b93cc1e7 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Add functions to create images

This add some basic functions to create images, and a test for said
functions. This is not intended to be a test of the image parsing
functions, but rather a framework for creating minimal images for testing
load methods. That said, it does do an OK job at finding bugs in the image
parsing directly.

Since we have two methods for loading/parsing FIT images, add LOAD_FIT_FULL
as a separate CI run.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c56468a6 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 79e1d289 28-Feb-2022 Simon Glass <sjg@chromium.org>

sandbox: test: Tidy up spl_test_load() calls

Use the new sandbox_find_next_phase() function, which does what is needed
here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f178bebf 05-Jul-2021 Simon Glass <sjg@chromium.org>

sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 79e1d289 28-Feb-2022 Simon Glass <sjg@chromium.org>

sandbox: test: Tidy up spl_test_load() calls

Use the new sandbox_find_next_phase() function, which does what is needed
here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f178bebf 05-Jul-2021 Simon Glass <sjg@chromium.org>

sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 79e1d289 28-Feb-2022 Simon Glass <sjg@chromium.org>

sandbox: test: Tidy up spl_test_load() calls

Use the new sandbox_find_next_phase() function, which does what is needed
here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f178bebf 05-Jul-2021 Simon Glass <sjg@chromium.org>

sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# f178bebf 05-Jul-2021 Simon Glass <sjg@chromium.org>

sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>