[SPAM] [PATCH 20/26] test: spl: Add functions to create images
Sean Anderson
seanga2 at gmail.com
Sat Oct 14 16:37:43 CEST 2023
On 10/13/23 15:44, Xavier Drudis Ferran wrote:
> El Wed, Oct 11, 2023 at 09:56:20PM -0400, Sean Anderson deia:
>> 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 at gmail.com>
>> ---
>>
>> .azure-pipelines.yml | 4 +
>> .gitlab-ci.yml | 7 +
>> arch/sandbox/cpu/u-boot-spl.lds | 2 +
>> configs/sandbox_noinst_defconfig | 6 +
>> configs/sandbox_spl_defconfig | 6 +
>> include/test/spl.h | 117 ++++++++++
>> test/image/spl_load.c | 352 +++++++++++++++++++++++++++++++
>> test/image/spl_load_os.c | 5 +-
>> 8 files changed, 495 insertions(+), 4 deletions(-)
>> create mode 100644 include/test/spl.h
>>
> [...]
>> diff --git a/test/image/spl_load.c b/test/image/spl_load.c
>> index 1a57bf846d2..ca3777cab37 100644
>> --- a/test/image/spl_load.c
>> +++ b/test/image/spl_load.c
>> @@ -4,7 +4,15 @@
>> */
>>
>> #include <common.h>
>> +#include <image.h>
>> +#include <imx_container.h>
>> #include <mapmem.h>
>> +#include <memalign.h>
>> +#include <rand.h>
>> +#include <spl.h>
>> +#include <test/spl.h>
>> +#include <test/ut.h>
>> +#include <u-boot/crc.h>
>>
>> int board_fit_config_name_match(const char *name)
>> {
>> @@ -15,3 +23,347 @@ struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
>> {
>> return map_sysmem(0x100000, 0);
>> }
>> +
>> +/* Try to reuse the load buffer to conserve memory */
>> +void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
>> +{
>> + static void *buf;
>> + static size_t size;
>> + static bool invalid = true;
>> +
>> + if (invalid || size < sectors * bl_len) {
>> + if (!invalid)
>> + free(buf);
>> + buf = malloc_cache_aligned(sectors * bl_len);
>> + invalid = false;
>
> Should size be updated here or am I being thick ?
> size = ALIGN(sectors * bl_len, ARCH_DMA_MINALIGN);
It should.
--Sean
More information about the U-Boot
mailing list