[U-Boot, v2, 1/1] misc: fs_loader: Add request_firmware_into_buf_via_script() for flexible firmware loading via U-Boot script

Marek Vasut marek.vasut at mailbox.org
Sun Jul 27 16:46:49 CEST 2025


On 7/27/25 4:16 PM, Lucien.Jheng wrote:
> This commit introduces a new API, request_firmware_into_buf_via_script(),
> to the fs_loader framework.
> This function allows firmware to be loaded into memory
> using a user-defined U-Boot script,
> providing greater flexibility for firmware loading scenarios that cannot be handled
> by static file paths or device/partition selection alone.

Please run some 'fmt -w 72' on the paragraph above.

[...]

> I've validated this API on the Banana Pi R3 Mini. Here are my test commands and logs:
> 1.  `env set en8811h_load_firmware 'env set fw_addr 0x46000000 && env set fw_size 0x24000 && load mmc 0:3 0x46000000 /boot/EthMD32.dm.bin && load mmc 0:3 0x46004000 /boot/EthMD32.DSP.bin

The 'load' command sets $filesize variable AFTER the load completed. The 
$filesize variable contains the actual size of the loaded data. You will 
likely need to expand the script a bit:

env set fw_addr 0x46000000 && env set fw_size 0x24000 && \
mw.b ${fw_addr} 0 ${fw_size} && # Make sure the memory backing the
                                 # firmware is initialized to some valid
                                 # content.
load mmc 0:3 0x46000000 /boot/EthMD32.dm.bin && \
if test ${filesize} -lt 0x4000 ; then # Validate that the size of loaded
                                       # data is correct
   load mmc 0:3 0x46004000 /boot/EthMD32.DSP.bin
   # Validate loaded data size here again
else
   env set fw_size 0                   # Indicate failure
   exit 1
fi

[...]

Looks pretty good otherwise I think , thanks !


More information about the U-Boot mailing list