Loading M4 Firmware from root file system

We are trying to load the M4 firmware (.elf-File) from the linux root file system. To achive that, we modified the u-boot environement variable ‘m4Boot’:

setenv m4boot ‘ubi part ubi; ubifsmount ubi0:rootfs1; ubifsload ${loadaddr} /opt/Firmware_M4/FirmwareM4.elf; bootaux ${loadaddr}; ubifsumount’

This is generally working, but every few boot-ups, u-Boot can not mount the rootfs (returning error -19 or error -30).Sometimes the bootfails completely and the OS has to be reinstalled.

What is the correct way to load and start the M4 firmware from the rootfs?

Best regards,
Simon

It’s not recommended to mount UBI_FS based RootFS by U_boot.
Better to keep existing boot scenario (load it from dedicated UBI partition without any FS).
If you need to modify an M4 firmware from Linux you ca use a ubiupdatevol command as described here - https://developer.toradex.com/knowledge-base/freertos-on-the-cortex-m4-of-a-colibri-imx7#Store_a_Firmware_on_Flash_and_Run_it_on_Boot