In spl falcon mode, and when in BOOT_DEVICE_RAM, why does it 'load' from RAM to RAM? when it's already loaded..

Chan Kim ckim at
Wed Dec 22 10:32:47 CET 2021

Hello all,


I'm trying booting from RAM using SPL falcon mode. 

Another scp chip loads the image (FIT image) to SDRAM before u-boot-spl

Since the FPGA's DDR interface is not ready, we have on chip 8MB SRAM at the
start of DDR address range. (so it's faking DDR)

I made a 5.8MiB sized FIT image containing (4.6MiB linux kernel, 8.1KiB dtb,
1.1MB initramfs.cpio.gz).

CONFIG_SPL_RAM_SUPPORT and CONFIG_SPL_RAM_DEVICE are both turned on and the
spl_boot_list[0] was set to BOOT_DEVICE_RAM.

When I run it, at some point it in board_init_r function(common/spl/spl.c),
the functions below are called. (A->B means A calls B)

Boot_from_devices -> spl_ram_load_image -> spl_load_simple_fit ->
spl_simple_fit_read -> spl_get_fit_load_buffer -> malloc.

I found in spl_get_fit_load_buffer, it tries to get a buffer the size of the
FIT image. 

I spl_simple_fit_read, before calling spl_get_fit_load_buffer function, I
see thise comment.


     * So far we only have one block of data from the FIT. Read the entire

     * thing, including that first block.


     * For FIT with data embedded, data is loaded as part of FIT image.

     * For FIT with external data, data is not loaded in this step.


In my case, the whole FIT image is already on (fake) DDR starting at

But the comment sounds like it is reading the remainder into a buffer for
that FIT image.(and malloc failed while getting the buffer for that)

Why is it allocating the buffer when the whole data is already loaded?

Because my fake SDRAM size is only 8MB and the FIT image itself is 5.8MB, I
don't have any more big space for the FIT image.

I can't figure out what went wrong.

which didn't work. Just no space..)

Is there any method I can run it without copying the already loaded FIT
image in RAM to another buffer?

I think u-boot-spl regards the RAM as a storage media, so it is tryng to
'load' from the 'media' to RAM, when it doesn't need to 'load' it.

Thank you for reading and any comment will be really appreciated.


Chan Kim

More information about the U-Boot mailing list