[PATCH v3] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm

Benjamin Hahn B.Hahn at phytec.de
Wed Aug 7 11:58:52 CEST 2024


Hi Lukasz,

On 06.08.24 10:11, Lukasz Majewski wrote:
> This command allows easy update on SD card or eMMC of the flash.bin
> generated (with binman) during u-boot build.
>
> Signed-off-by: Lukasz Majewski <lukma at denx.de>
> ---
> Changes for v2:
> - Remove 'update_mmc_part' variable
> - Change path for hostname
> - Use full version of dhcp command (${loadaddr} added)
>
> Changes for v3:
> - Remove +1 when calculating the size of binary to be written
> ---
>   include/configs/phycore_imx8mm.h | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/include/configs/phycore_imx8mm.h b/include/configs/phycore_imx8mm.h
> index ce6dc87c69..361e665676 100644
> --- a/include/configs/phycore_imx8mm.h
> +++ b/include/configs/phycore_imx8mm.h
> @@ -29,6 +29,16 @@
>   	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
>   	"mmcpart=1\0" \
>   	"mmcroot=2\0" \
> +	"update_offset=0x42\0" \
> +	"update_filename=flash.bin\0" \
> +	"hostname=/srv/tftp/\0" \
> +	"update_bootimg="						\
> +		"mmc dev ${mmcdev} ; "		\
> +		"if dhcp ${loadaddr} ${hostname}/${update_filename} ; then "	\

The dhcp and tftp command should take the filepath from the tftp 
directory and get the tftp directory automatically not the absolute path.
So this will try to get the file from 
/path_to_tftp_folder/srv/tftp/flash.bin and will fail because it can't 
find it. So you can drop the ${hostname}.
Also drop the initialization of ${hostname} above since it is no longer 
needed.

Should be like this:

dhcp ${loadaddr} ${update_filename}

> +		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
> +		"setexpr fw_sz ${fw_sz} ; "
I think you can drop this line since it does not do anything.

Benjamin
> 				\
> +		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ; "	\
> +		"fi\0" \
>   	"mmcautodetect=yes\0" \
>   	"mmcargs=setenv bootargs console=${console} " \
>   		"root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw\0" \




More information about the U-Boot mailing list